Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion frontends/rioterm/src/screen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,12 @@ impl Screen<'_> {
pub fn clear_selection(&mut self) {
// Clear the selection on the terminal.
let mut terminal = self.context_manager.current_mut().terminal.lock();
terminal.selection.take();
let old_selection = terminal
.selection
.take()
.and_then(|s| s.to_range(&terminal));
let display_offset = terminal.display_offset();
terminal.update_selection_damage(old_selection, display_offset);
drop(terminal);
self.context_manager.current_mut().set_selection(None);
}
Expand Down
18 changes: 18 additions & 0 deletions rio-backend/src/crosswords/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,10 @@ impl<U: EventListener> Crosswords<U> {
let previous_cursor =
mem::replace(&mut self.damage.last_cursor, self.grid.cursor.pos);

let previous_vim_cursor = mem::replace(
&mut self.damage.last_vi_cursor_point,
Some(self.vi_mode_cursor.pos),
);
if self.damage.full {
return TermDamage::Full;
}
Expand All @@ -550,6 +554,13 @@ impl<U: EventListener> Crosswords<U> {
let previous_line = previous_cursor.row.0 as usize;
self.damage.damage_line(previous_line);
}
if let (Some(prev_cursor), Some(curr_cursor)) =
(previous_vim_cursor, self.damage.last_vi_cursor_point)
{
if prev_cursor != curr_cursor {
self.damage.damage_line(prev_cursor.row.0 as usize);
}
}

// Always damage current cursor.
self.damage_cursor();
Expand Down Expand Up @@ -877,6 +888,12 @@ impl<U: EventListener> Crosswords<U> {
self.damage_line(cursor_line);
}

#[inline]
pub fn damage_vi_cursor_line(&mut self) {
let vi_cursor_line = self.vi_mode_cursor.pos.row.0 as usize;
self.damage.damage_line(vi_cursor_line);
}

/// Damage an entire line
#[inline]
pub fn damage_line(&mut self, line: usize) {
Expand All @@ -887,6 +904,7 @@ impl<U: EventListener> Crosswords<U> {
pub fn damage_cursor(&mut self) {
// Use line-based damage approach for better reliability
self.damage_cursor_line();
self.damage_vi_cursor_line();
}

#[inline]
Expand Down
Loading