Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2555,8 +2555,7 @@ impl TextBuffer {
self.set_cursor_internal(cursor);

// If both the last and this are a Write/Delete operation, we skip allocating a new undo history item.
if cursor_before.offset != cursor.offset
|| history_type != self.last_history_type
if history_type != self.last_history_type

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm is there a risk in removing this check

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if the self.cursor moves without the last_history_type being reset to "other" would break this because it would group unrelated writes/deletes.

However, the commit that introduced this in the first place does make sure to reset the last_history_type from what I can tell, so this is fine.

|| !matches!(history_type, HistoryType::Write | HistoryType::Delete)
{
self.redo_stack.clear();
Expand Down