Fix bug in go-to-line.

Wasn't checking for maximum against the lines in the file.
This commit is contained in:
Nathan Vegdahl 2021-06-15 23:18:52 -07:00
parent 27572c8838
commit 8776b96879
2 changed files with 7 additions and 4 deletions

6
Cargo.lock generated
View File

@ -520,13 +520,13 @@ dependencies = [
[[package]] [[package]]
name = "unicode-segmentation" name = "unicode-segmentation"
version = "1.6.0" version = "1.6.0"
source = "git+https://github.com/unicode-rs/unicode-segmentation.git#fbba2a660b38dad86eebcd7fe73138c5cbfb9469" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
[[package]] [[package]]
name = "unicode-segmentation" name = "unicode-segmentation"
version = "1.6.0" version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/unicode-rs/unicode-segmentation.git#fbba2a660b38dad86eebcd7fe73138c5cbfb9469"
checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"

View File

@ -564,7 +564,10 @@ impl Editor {
); );
} }
let pos = self.buffer.text.line_to_char(n); let pos = self
.buffer
.text
.line_to_char(n.min(self.buffer.text.len_lines()));
let pos = self.formatter.set_horizontal( let pos = self.formatter.set_horizontal(
&self.buffer.text, &self.buffer.text,
pos, pos,