mirror of
https://github.com/tstack/lnav.git
synced 2024-08-16 16:30:25 +03:00
[mouse] move scrollbar on double click and handle mouse in spectro
This commit is contained in:
parent
45d8e27ae4
commit
e805ca8a8a
74
NEWS.md
74
NEWS.md
@ -1,6 +1,53 @@
|
||||
## lnav v0.12.2
|
||||
|
||||
Features:
|
||||
* Added mouse support that can be toggled with `F2` or enabled
|
||||
by default with: `:config /ui/mouse/mode enabled`. With
|
||||
mouse support enabled, many of the UI 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;
|
||||
- shift + 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;
|
||||
- when double-clicking text: if the mouse pointer is inside
|
||||
a quoted string, the contents of the string will be selected;
|
||||
if the mouse pointer is on the quote, the quote will be included
|
||||
in the selection; if the mouse pointer is over a bracket
|
||||
(e.g. [],{},()) where the matching bracket is on the same line,
|
||||
the selection will span from one bracket to the other;
|
||||
- when text is selected, a menu will pop up that can be used
|
||||
to filter based on the current text, search for it, or copy
|
||||
it to the clipboard;
|
||||
- right-clicking the start of a log message in the main view
|
||||
will open the parser details overlay;
|
||||
- the parser details now displays a diamond next to fields to
|
||||
indicate whether they are shown/hidden and this can be
|
||||
clicked to toggle the state;
|
||||
- the parser details will show a bar chart icon for fields with
|
||||
values which, when clicked, will open either the spectrogram
|
||||
view for the given field or open the DB query prompt with a
|
||||
PRQL query to generate a histogram of the field values;
|
||||
- clicking in the scroll area will move the view by a page,
|
||||
double-clicking will move the view to that area, and
|
||||
dragging the scrollbar will move the view to the given spot;
|
||||
- clicking on the breadcrumb bar will select a crumb and
|
||||
selecting a possibility from the popup will move to that
|
||||
location in the view;
|
||||
- clicking on portions of the bottom status bar will trigger
|
||||
a relevant action (e.g. clicking the line number will open
|
||||
the command prompt with `:goto <current-line>`);
|
||||
- clicking on the configuration panel tabs (i.e. Files/Filters)
|
||||
will open the selected panel and clicking parts of the
|
||||
display in there will perform the relevant action (e.g.
|
||||
clicking the diamond will enable/disable the file/filter);
|
||||
- clicking in a prompt will move the cursor to the location;
|
||||
- clicking on a column in the spectrogram view will select it.
|
||||
|
||||
(Note that this is new work, so there are likely to be some
|
||||
glitches.)
|
||||
* Added a `journald://` URL handler that will call `journalctl`
|
||||
and pass any query parameters as options. For example, the
|
||||
following command:
|
||||
@ -22,33 +69,6 @@ Features:
|
||||
of archive contents.
|
||||
* Added `humanize_id` SQL function that colorizes a string using
|
||||
ANSI escape codes.
|
||||
* Added mouse support that can be toggled with `F2` or enabled
|
||||
by default with: `:config /ui/mouse/mode enabled`. With
|
||||
mouse support enabled, many of the UI 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;
|
||||
- shift + clicking/dragging in the main view will highlight
|
||||
lines and then toggle their bookmark status on release;
|
||||
- double-clicking will select the underlying token and
|
||||
drag-selecting within a line will select the given text;
|
||||
- when text is selected, a menu will pop up that can be used
|
||||
to filter based on the current text, search for it, or copy
|
||||
it to the clipboard;
|
||||
- clicking in the scroll area will move the view by a page and
|
||||
dragging the scrollbar will move the view to the given spot;
|
||||
- clicking on the breadcrumb bar will select a crumb and
|
||||
selecting a possibility from the popup will move to that
|
||||
location in the view;
|
||||
- clicking on portions of the bottom status bar will trigger
|
||||
a relevant action (e.g. clicking the line number will open
|
||||
the command prompt with `:goto <current-line>`);
|
||||
- clicking on the configuration panel tabs (i.e. Files/Filters)
|
||||
will open the selected panel and clicking parts of the
|
||||
display in there will perform the relevant action (e.g.
|
||||
clicking the diamond will enable/disable the file/filter);
|
||||
- clicking in a prompt will move the cursor to the location.
|
||||
This is new work, so there are likely to be some glitches.
|
||||
* Added a `selected_text` column to the `lnav_views` table that
|
||||
reports information about text that was selected with a mouse.
|
||||
This makes it possible to script operations that use the
|
||||
|
@ -428,26 +428,42 @@ 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;
|
||||
* shift + clicking/dragging in the main view will highlight
|
||||
lines and then toggle their bookmark status on release;
|
||||
* double-clicking will select the underlying token and
|
||||
drag-selecting within a line will select the given text;
|
||||
* double-clicking in the main view will select the underlying
|
||||
text and drag-selecting within a line will select the given
|
||||
text;
|
||||
* when double-clicking text: if the mouse pointer is inside
|
||||
a quoted string, the contents of the string will be selected;
|
||||
if the mouse pointer is on the quote, the quote will be included
|
||||
in the selection; if the mouse pointer is over a bracket
|
||||
(e.g. [],{},()) where the matching bracket is on the same line,
|
||||
the selection will span from one bracket to the other;
|
||||
* when text is selected, a menu will pop up that can be used
|
||||
to filter based on the current text, search for it, or copy
|
||||
it to the clipboard;
|
||||
* clicking in the scroll area will move the view by a page and
|
||||
* right-clicking the start of a log message in the main view
|
||||
will open the parser details overlay;
|
||||
* the parser details now displays a diamond next to fields to
|
||||
indicate whether they are shown/hidden and this can be
|
||||
clicked to toggle the state;
|
||||
* the parser details will show a bar chart icon for fields with
|
||||
values which, when clicked, will open either the spectrogram
|
||||
view for the given field or open the DB query prompt with a
|
||||
PRQL query to generate a histogram of the field values;
|
||||
* clicking in the scroll area will move the view by a page,
|
||||
double-clicking will move the view to that area, and
|
||||
dragging the scrollbar will move the view to the given spot;
|
||||
* clicking on the breadcrumb bar will select a crumb and
|
||||
selecting a possibility from the popup will move to that
|
||||
location in the view;
|
||||
* clicking on portions of the bottom status bar will trigger
|
||||
a relevant action (e.g. clicking the line number will open
|
||||
the command prompt with `:goto <current-line>`);
|
||||
the command prompt with :code:`:goto <current-line>`);
|
||||
* clicking on the configuration panel tabs (i.e. Files/Filters)
|
||||
will open the selected panel and clicking parts of the
|
||||
display in there will perform the relevant action (e.g.
|
||||
clicking the diamond will enable/disable the file/filter);
|
||||
* clicking in a prompt will move the cursor to the location.
|
||||
* clicking in a prompt will move the cursor to the location;
|
||||
* clicking on a column in the spectrogram view will select it.
|
||||
|
||||
.. note::
|
||||
|
||||
|
@ -849,6 +849,16 @@ listview_curses::handle_mouse(mouse_event& me)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (me.is_double_click_in(mouse_button_t::BUTTON_LEFT,
|
||||
line_range{(int) width - 2, (int) width}))
|
||||
{
|
||||
auto pct = (double) inner_height / (double) height;
|
||||
auto new_top = (int) floor(((double) me.me_y * pct) + 0.5);
|
||||
this->set_top(vis_line_t(new_top), true);
|
||||
this->lv_mouse_mode = lv_mode_t::NONE;
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (this->lv_mouse_mode) {
|
||||
case lv_mode_t::NONE: {
|
||||
if (me.me_x < (int) (width - 2)) {
|
||||
|
@ -177,6 +177,35 @@ spectrogram_source::list_input_handle_key(listview_curses& lv, int ch)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
spectrogram_source::text_handle_mouse(
|
||||
textview_curses& tc,
|
||||
const listview_curses::display_line_content_t&,
|
||||
mouse_event& me)
|
||||
{
|
||||
auto sel = tc.get_selection();
|
||||
const auto& s_row = this->load_row(tc, sel);
|
||||
|
||||
for (int lpc = 0; lpc <= (int) s_row.sr_width; lpc++) {
|
||||
int col_value = s_row.sr_values[lpc].rb_counter;
|
||||
|
||||
if (col_value == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto lr = line_range{lpc, lpc + 1};
|
||||
if (me.is_click_in(mouse_button_t::BUTTON_LEFT, lr)) {
|
||||
this->ss_cursor_column = lr.lr_start;
|
||||
this->ss_details_source.reset();
|
||||
|
||||
tc.reload_data();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
spectrogram_source::list_value_for_overlay(const listview_curses& lv,
|
||||
vis_line_t row,
|
||||
|
@ -117,7 +117,8 @@ class spectrogram_source
|
||||
: public text_sub_source
|
||||
, public text_time_translator
|
||||
, public list_overlay_source
|
||||
, public list_input_delegate {
|
||||
, public list_input_delegate
|
||||
, public text_delegate {
|
||||
public:
|
||||
~spectrogram_source() override = default;
|
||||
|
||||
@ -130,6 +131,10 @@ public:
|
||||
|
||||
bool list_input_handle_key(listview_curses& lv, int ch) override;
|
||||
|
||||
bool text_handle_mouse(textview_curses& tc,
|
||||
const listview_curses::display_line_content_t&,
|
||||
mouse_event& me) override;
|
||||
|
||||
bool list_static_overlay(const listview_curses& lv,
|
||||
int y,
|
||||
int bottom,
|
||||
|
Loading…
Reference in New Issue
Block a user