diff --git a/docs/changelog.md b/docs/changelog.md index 1d1e011eb..e8184cd14 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -45,6 +45,7 @@ As features stabilize some brief notes about them will accumulate here. * Scroll to the bottom on mouse input when mouse reporting is enabled [#2447](https://github.com/wez/wezterm/issues/2447) * ssh: correctly expand `%h` ssh_config tokens [#2448](https://github.com/wez/wezterm/issues/2448) * ssh: `CloseCurrentPane` wouldn't release all resources associated with the pane and could lead to a `too many open files` error for a long running `wezterm ssh` session. [#2466](https://github.com/wez/wezterm/issues/2466) +* mouse cursor is now reset to arrow when the mouse leaves the window [#2471](https://github.com/wez/wezterm/issues/2471) ### 20220807-113146-c2fee766 diff --git a/wezterm-gui/src/termwindow/mouseevent.rs b/wezterm-gui/src/termwindow/mouseevent.rs index 01a812705..06abe2c70 100644 --- a/wezterm-gui/src/termwindow/mouseevent.rs +++ b/wezterm-gui/src/termwindow/mouseevent.rs @@ -235,6 +235,7 @@ impl super::TermWindow { pub fn mouse_leave_impl(&mut self, context: &dyn WindowOps) { self.current_mouse_event = None; self.update_title(); + context.set_cursor(Some(MouseCursor::Arrow)); context.invalidate(); } @@ -709,11 +710,16 @@ impl super::TermWindow { } }; + let outside_window = event.coords.x < 0 + || event.coords.x as usize > self.dimensions.pixel_width + || event.coords.y < 0 + || event.coords.y as usize > self.dimensions.pixel_height; + context.set_cursor(Some(if self.current_highlight.is_some() { // When hovering over a hyperlink, show an appropriate // mouse cursor to give the cue that it is clickable MouseCursor::Hand - } else if pane.is_mouse_grabbed() { + } else if pane.is_mouse_grabbed() || outside_window { MouseCursor::Arrow } else { MouseCursor::Text