зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-09-07 07:55:50 +03:00
fix cursor position after undo delete_line_by_head
Этот коммит содержится в:
@@ -632,7 +632,8 @@ impl<'a> TextArea<'a> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let row = self.cursor.0;
|
let cursor_before = self.cursor;
|
||||||
|
let row = cursor_before.0;
|
||||||
let line = &mut self.lines[row];
|
let line = &mut self.lines[row];
|
||||||
if let Some((i, _)) = line.char_indices().nth(col) {
|
if let Some((i, _)) = line.char_indices().nth(col) {
|
||||||
let bytes = line[i..]
|
let bytes = line[i..]
|
||||||
@@ -644,7 +645,7 @@ impl<'a> TextArea<'a> {
|
|||||||
line.replace_range(i..i + bytes, "");
|
line.replace_range(i..i + bytes, "");
|
||||||
|
|
||||||
self.cursor = (row, col);
|
self.cursor = (row, col);
|
||||||
self.push_history(EditKind::Remove(removed.clone(), i), (row, col));
|
self.push_history(EditKind::Remove(removed.clone(), i), cursor_before);
|
||||||
self.yank = removed;
|
self.yank = removed;
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user