Fix numeric underflow when text editing
This commit is contained in:
parent
9057eaec7e
commit
ee3f269d93
1 changed files with 1 additions and 1 deletions
|
@ -101,7 +101,7 @@ impl Galley {
|
||||||
if y_dist < best_y_dist {
|
if y_dist < best_y_dist {
|
||||||
best_y_dist = y_dist;
|
best_y_dist = y_dist;
|
||||||
let mut column = line.char_at(pos.x);
|
let mut column = line.char_at(pos.x);
|
||||||
if column == line.char_count() && line.ends_with_newline {
|
if column == line.char_count() && line.ends_with_newline && column > 0 {
|
||||||
// handle the case where line ends with a \n and we click after it.
|
// handle the case where line ends with a \n and we click after it.
|
||||||
// We should return the position BEFORE the \n!
|
// We should return the position BEFORE the \n!
|
||||||
column -= 1;
|
column -= 1;
|
||||||
|
|
Loading…
Reference in a new issue