Skip to content

Commit

Permalink
update mouse shape parsing function
Browse files Browse the repository at this point in the history
  • Loading branch information
reykjalin committed Oct 19, 2024
1 parent b67cf84 commit 683d134
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
14 changes: 7 additions & 7 deletions wezterm-gui/src/termwindow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3541,13 +3541,13 @@ impl TermWindow {
}
}

fn parse_mouse_cursor_shape_string(
&self,
mouse_cursor_shape_string: Option<String>,
) -> Option<MouseCursor> {
match mouse_cursor_shape_string.as_deref()? {
"pointer" => Some(MouseCursor::Hand),
_ => None,
fn parse_mouse_cursor_shape(&self, mouse_cursor_shape: &str) -> MouseCursor {
match mouse_cursor_shape {
"pointer" => MouseCursor::Hand,
"text" => MouseCursor::Text,
"row-resize" | "ns-resize" => MouseCursor::SizeUpDown,
"col-resize" | "ew-resize" => MouseCursor::SizeLeftRight,
_ => MouseCursor::Arrow,
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions wezterm-gui/src/termwindow/mouseevent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -839,14 +839,12 @@ impl super::TermWindow {
MouseCursor::Hand
} else if pane.is_mouse_grabbed() || outside_window {
MouseCursor::Arrow
} else if let Some(shape) = pane.get_mouse_cursor_shape() {
self.parse_mouse_cursor_shape(shape.as_str())
} else {
MouseCursor::Text
}));

if let Some(pane) = self.get_active_pane_or_overlay() {
context.set_cursor(self.parse_mouse_cursor_shape_string(pane.get_mouse_cursor_shape()));
}

let event_trigger_type = match &event.kind {
WMEK::Press(press) => {
let press = mouse_press_to_tmb(press);
Expand Down

0 comments on commit 683d134

Please sign in to comment.