From 5485676270378a47a579d0707d5d7262aa293599 Mon Sep 17 00:00:00 2001 From: pommicket Date: Sun, 10 Sep 2023 09:53:59 -0400 Subject: fix problem where on the last line of a buffer shift+up end backspace acts weird --- buffer.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'buffer.c') 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); -- cgit v1.2.3