Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mouse right click selection #10067

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 17 additions & 13 deletions helix-term/src/ui/editor.rs
Expand Up @@ -1231,24 +1231,28 @@ impl EditorView {
}

MouseEventKind::Up(MouseButton::Right) => {
if let Some((coords, view_id)) = gutter_coords_and_view(cxt.editor, row, column) {
if let Some((pos, view_id)) = gutter_coords_and_view(cxt.editor, row, column) {
cxt.editor.focus(view_id);

let (view, doc) = current!(cxt.editor);
if let Some(pos) =
view.pos_at_visual_coords(doc, coords.row as u16, coords.col as u16, true)
{
doc.set_selection(view_id, Selection::point(pos));
if modifiers == KeyModifiers::ALT {
commands::MappableCommand::dap_edit_log.execute(cxt);
} else {
commands::MappableCommand::dap_edit_condition.execute(cxt);
}
if let Some((pos, _)) = pos_and_view(cxt.editor, row, column, true) {
doc_mut!(cxt.editor).set_selection(view_id, Selection::point(pos));
} else {
let (view, doc) = current!(cxt.editor);

return EventResult::Consumed(None);
if let Some(pos) = view.pos_at_visual_coords(doc, pos.row as u16, 0, true) {
doc.set_selection(view_id, Selection::point(pos));
match modifiers {
KeyModifiers::ALT => {
commands::MappableCommand::dap_edit_log.execute(cxt)
}
_ => commands::MappableCommand::dap_edit_condition.execute(cxt),
};
}
}
}

cxt.editor.ensure_cursor_in_view(view_id);
return EventResult::Consumed(None);
diegostafa marked this conversation as resolved.
Show resolved Hide resolved
}
EventResult::Ignored(None)
}

Expand Down