mirror of
https://github.com/tstack/lnav.git
synced 2024-10-26 13:16:11 +03:00
[hotkeys] add ctrl-d/ctrl-u hotkeys for moving by half a page
Also fixed a bug that caused the bottom status line to be updated with the wrong line number. Related to #945
This commit is contained in:
parent
2c981dbe25
commit
b92663b38a
2
NEWS.md
2
NEWS.md
@ -5,6 +5,8 @@ Features:
|
||||
be toggled by pressing CTRL-X. While in cursor mode, any
|
||||
operations that would normally work on the "top" line now
|
||||
operate on the selected line instead.
|
||||
* Added CTRL-D and CTRL-U hotkeys to move down/up by half
|
||||
a page.
|
||||
|
||||
## lnav v0.11.1
|
||||
|
||||
|
@ -70,7 +70,13 @@
|
||||
"command": ":reset-session"
|
||||
},
|
||||
"x18": {
|
||||
"command": ";UPDATE lnav_views SET movement = (CASE movement WHEN 'top' THEN 'cursor' ELSE 'top' END) WHERE name = (SELECT name FROM lnav_view_stack ORDER BY rowid DESC LIMIT 1)"
|
||||
"command": ";UPDATE lnav_views SET movement = (CASE movement WHEN 'top' THEN 'cursor' ELSE 'top' END) WHERE name = (SELECT name FROM lnav_top_view)"
|
||||
},
|
||||
"x04": {
|
||||
"command": ";UPDATE lnav_views SET top = top + (height / 2) WHERE name = (SELECT name FROM lnav_top_view)"
|
||||
},
|
||||
"x15": {
|
||||
"command": ";UPDATE lnav_views SET top = top - (height / 2) WHERE name = (SELECT name FROM lnav_top_view)"
|
||||
},
|
||||
"x3d": {
|
||||
"command": ";UPDATE lnav_views SET paused = 1 - paused"
|
||||
|
21
src/lnav.cc
21
src/lnav.cc
@ -739,6 +739,20 @@ clear_last_user_mark(listview_curses* lv)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_view_position(listview_curses* lv)
|
||||
{
|
||||
lnav_data.ld_view_stack.top() | [lv](auto* top_lv) {
|
||||
if (lv != top_lv) {
|
||||
return;
|
||||
}
|
||||
|
||||
lnav_data.ld_bottom_source.update_line_number(lv);
|
||||
lnav_data.ld_bottom_source.update_percent(lv);
|
||||
lnav_data.ld_bottom_source.update_marks(lv);
|
||||
};
|
||||
}
|
||||
|
||||
class lnav_behavior : public mouse_behavior {
|
||||
public:
|
||||
void mouse_event(int button, bool release, int x, int y) override
|
||||
@ -1304,12 +1318,7 @@ looper()
|
||||
lnav_data.ld_view_stack.push_back(&lnav_data.ld_views[LNV_LOG]);
|
||||
|
||||
sb.push_back(clear_last_user_mark);
|
||||
sb.push_back(bind_mem(&bottom_status_source::update_line_number,
|
||||
&lnav_data.ld_bottom_source));
|
||||
sb.push_back(bind_mem(&bottom_status_source::update_percent,
|
||||
&lnav_data.ld_bottom_source));
|
||||
sb.push_back(bind_mem(&bottom_status_source::update_marks,
|
||||
&lnav_data.ld_bottom_source));
|
||||
sb.push_back(update_view_position);
|
||||
vsb.push_back(
|
||||
bind_mem(&term_extra::update_title, injector::get<term_extra*>()));
|
||||
vsb.push_back([](listview_curses* lv) {
|
||||
|
Loading…
Reference in New Issue
Block a user