1
1
mirror of https://github.com/tstack/lnav.git synced 2024-09-11 13:05:51 +03:00

[mouse] treat ctrl+click the same as shift+click

Some terminals capture shift+click so add ctrl+click as
an alternate way to highlight/mark lines.
This commit is contained in:
Tim Stack 2024-05-14 15:04:32 -07:00
parent fdecf28699
commit 77b9829224
3 changed files with 17 additions and 5 deletions

View File

@ -13,6 +13,10 @@ Interface Changes:
* In the Gantt chart view, pressing `ENTER` will focus on
the preview pane so you can scroll through messages
with the selected Op ID.
* With mouse mode enabled, `CTRL` can be used as an alternate
to `SHIFT` when clicking/dragging in the main view to
highlight lines. A few terminals capture shift+clicks as a
way to select text and do not pass them to the application.
Bug Fixes:
* Log messages in formats with custom timestamp formats were

View File

@ -428,6 +428,9 @@ elements will respond to mouse inputs:
* clicking on the main view will move the cursor to the given
row and dragging will scroll the view as needed;
* :bkd:`Shift` (or :kbd:`CTRL`) clicking/dragging in the main
view will highlight lines and then toggle their bookmark
status on release;
* double-clicking in the main view will select the underlying
text and drag-selecting within a line will select the given
text;

View File

@ -184,13 +184,15 @@ const bookmark_type_t textview_curses::BM_SEARCH("search");
const bookmark_type_t textview_curses::BM_META("meta");
const bookmark_type_t textview_curses::BM_PARTITION("partition");
textview_curses::textview_curses()
textview_curses::
textview_curses()
: lnav_config_listener(__FILE__), tc_search_action(noop_func{})
{
this->set_data_source(this);
}
textview_curses::~textview_curses()
textview_curses::~
textview_curses()
{
this->tc_search_action = noop_func{};
}
@ -471,8 +473,10 @@ textview_curses::handle_mouse(mouse_event& me)
if (this->vc_enabled) {
if (this->tc_supports_marks
&& me.me_button == mouse_button_t::BUTTON_LEFT
&& me.is_modifier_pressed(
mouse_event::modifier_t::shift))
&& (me.is_modifier_pressed(
mouse_event::modifier_t::shift)
|| me.is_modifier_pressed(
mouse_event::modifier_t::ctrl)))
{
this->tc_selection_start = mc.mc_line;
}
@ -1296,7 +1300,8 @@ text_sub_source::text_crumbs_for_line(int line,
{
}
logfile_filter_state::logfile_filter_state(std::shared_ptr<logfile> lf)
logfile_filter_state::
logfile_filter_state(std::shared_ptr<logfile> lf)
: tfs_logfile(std::move(lf))
{
memset(this->tfs_filter_count, 0, sizeof(this->tfs_filter_count));