syntax: bail out of find_width_of_character_at_span if the span doesn't start and end in the same file.

This commit is contained in:
Eduard-Mihai Burtescu
2019-05-29 00:27:42 +03:00
parent 3e5beb2c6f
commit 95013e612d
+5
View File
@@ -727,6 +727,11 @@ fn find_width_of_character_at_span(&self, sp: Span, forwards: bool) -> u32 {
debug!("find_width_of_character_at_span: local_begin=`{:?}`, local_end=`{:?}`",
local_begin, local_end);
if local_begin.sf.start_pos != local_end.sf.start_pos {
debug!("find_width_of_character_at_span: begin and end are in different files");
return 1;
}
let start_index = local_begin.pos.to_usize();
let end_index = local_end.pos.to_usize();
debug!("find_width_of_character_at_span: start_index=`{:?}`, end_index=`{:?}`",