fix(multiuser): properly clear fake cursors (#3845)

This commit is contained in:
Aram Drevekenin 2024-12-06 17:32:26 +01:00 committed by GitHub
parent 213a9e09e6
commit 9332714e9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 0 deletions

View file

@ -806,6 +806,20 @@ impl Pane for TerminalPane {
self.style.rounded_corners = rounded_corners;
self.frame.clear();
}
fn drain_fake_cursors(&mut self) -> Option<HashSet<(usize, usize)>> {
if !self.fake_cursor_locations.is_empty() {
for (y, _x) in &self.fake_cursor_locations {
// we do this because once these fake_cursor_locations
// have been drained, we have to make sure to render the line
// they appeared on so that whatever clears their location
// won't leave a hole
self.grid.update_line_for_rendering(*y);
}
Some(self.fake_cursor_locations.drain().collect())
} else {
None
}
}
}
impl TerminalPane {

View file

@ -500,6 +500,9 @@ pub trait Pane {
fn query_should_be_suppressed(&self) -> bool {
false
}
fn drain_fake_cursors(&mut self) -> Option<HashSet<(usize, usize)>> {
None
}
}
#[derive(Clone, Debug)]

View file

@ -57,6 +57,10 @@ impl<'a> PaneContentsAndUi<'a> {
) -> Result<()> {
let err_context = "failed to render pane contents to multiple clients";
// here we drop the fake cursors so that their lines will be updated
// and we can clear them from the UI below
drop(self.pane.drain_fake_cursors());
if let Some((character_chunks, raw_vte_output, sixel_image_chunks)) =
self.pane.render(None).context(err_context)?
{