Skip to content

Commit 69da885

Browse files
committed
Update Location::show_code
1 parent 3991e5f commit 69da885

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/parser/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mxmlextrema-as3parser"
3-
version = "1.3.3"
3+
version = "1.3.4"
44
edition = "2021"
55
authors = ["Matheus Dias de Souza <[email protected]>"]
66
repository = "https://github.com/mxmlextrema/as3parser"

crates/parser/compilation_unit/location.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,13 @@ impl Location {
196196
}
197197
indent_length += ch.len_utf8();
198198
}
199-
subregion = &subregion[indent_length..];
199+
let mut line_terminator_length = 0usize;
200+
for ch in subregion.chars().rev() {
201+
if CharacterValidator::is_line_terminator(ch) {
202+
line_terminator_length += ch.len_utf8();
203+
}
204+
}
205+
subregion = &subregion[indent_length..(subregion.len() - line_terminator_length)];
200206
if subregion.len() >= 150 {
201207
subregion = &subregion[..149];
202208
}

0 commit comments

Comments
 (0)