From 130a7263d4b55e47d54a149fe4bbd31f70218584 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 20 Jun 2019 21:39:47 -0700 Subject: [PATCH] avoid repeated emission of cursor updates when scrolled back --- src/server/listener.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/server/listener.rs b/src/server/listener.rs index 9218c56d1..2de1e85f8 100644 --- a/src/server/listener.rs +++ b/src/server/listener.rs @@ -439,10 +439,14 @@ impl ClientSurfaceState { let (x, y) = self.surface.cursor_position(); let cursor = renderable.get_cursor_position(); if (x != cursor.x) || (y as i64 != cursor.y) { - self.surface.add_change(Change::CursorPosition { - x: Position::Absolute(cursor.x), - y: Position::Absolute(cursor.y as usize), - }); + // Update the cursor, but if we're scrolled back + // and it is our of range, skip the update. + if cursor.y < rows as i64 { + self.surface.add_change(Change::CursorPosition { + x: Position::Absolute(cursor.x), + y: Position::Absolute(cursor.y as usize), + }); + } } let mut changes = vec![];