summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-09-10 09:53:59 -0400
committerpommicket <pommicket@gmail.com>2023-09-10 09:54:08 -0400
commit5485676270378a47a579d0707d5d7262aa293599 (patch)
treea14de0a879647fbbf1c91e6a59fe5ba332f451da /buffer.c
parent21cb2ba466ec0876d4e04fcca117650101d9359f (diff)
fix problem where on the last line of a buffer shift+up end backspace acts weird
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/buffer.c b/buffer.c
index eb6d438..8ea982f 100644
--- a/buffer.c
+++ b/buffer.c
@@ -2605,8 +2605,14 @@ void buffer_delete_chars_at_pos(TextBuffer *buffer, BufferPos pos, i64 nchars_)
buffer_remove_last_edit_if_empty(buffer);
+ const EditInfo info = {
+ .pos = pos,
+ .end = end_pos,
+ .chars_inserted = 0,
+ .chars_deleted = deletion_len,
+ };
// cursor position could have been invalidated by this edit
- buffer_validate_cursor(buffer);
+ buffer_pos_move_according_to_edit(&buffer->cursor_pos, &info);
// we need to do this *after* making the change to the buffer
// because of how non-incremental syncing works.
@@ -2617,12 +2623,6 @@ void buffer_delete_chars_at_pos(TextBuffer *buffer, BufferPos pos, i64 nchars_)
buffer_lines_modified(buffer, line_idx, line_idx);
signature_help_retrigger(buffer->ted);
- const EditInfo info = {
- .pos = pos,
- .end = end_pos,
- .chars_inserted = 0,
- .chars_deleted = deletion_len,
- };
// move diagnostics around as needed
arr_foreach_ptr(buffer->diagnostics, Diagnostic, d) {
buffer_pos_move_according_to_edit(&d->pos, &info);