[cursor] update docs and more tweaks

pull/1170/head
Tim Stack 12 months ago
parent 0eee0afd37
commit 8f8874c718

@ -3,8 +3,8 @@
Features:
* A "cursor" mode has been added to the main view that can
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.
operations that would normally work on the "top" line will
now operate on the focused line instead.
* Added CTRL-D and CTRL-U hotkeys to move down/up by half
a page.
* Added an `auto-width` flag to the elements of the

@ -255,7 +255,7 @@ Display
- Toggle the hiding of log message fields. The hidden fields will be
replaced with three bullets and highlighted in yellow.
* - :kbd:`Ctrl` + :kbd:`x`
- Toggle the cursor mode. Allows moving the selected line instead of
- Toggle the cursor mode. Allows moving the focused line instead of
keeping it fixed at the top of the current screen.
* - :kbd:`=`
- Pause/unpause loading of new file data.

@ -24,6 +24,16 @@ pressing :kbd:`q`. You can switch forward to the new view by pressing
:kbd:`Shift` + :kbd:`q` and :kbd:`Shift` + :kbd:`a` will synchronize the top
times in the views.
**lnav** provides many operations to work with the log/text data in the
main view. For example, you can add comments and tags to log messages.
By default, the top line is used as the reference point to edit the
comment or tags. Alternatively, you can press :kbd:`Ctrl` + :kbd:`x`
to switch to "cursor" mode where the "focused" line is highlighted and
most operations now work with that line. When in "cursor" mode, the
:kbd:`↑` and :kbd:`↓` keys now move the focused line instead of scrolling
the view. Jumping to bookmarks, like errors, will also move the focused
line instead of moving the next error to the top of the view.
The right side of the display has a proportionally sized 'scrollbar' that
shows:

@ -2669,14 +2669,17 @@ SELECT tbl_name FROM sqlite_master WHERE sql LIKE 'CREATE VIRTUAL TABLE%'
tc.set_selectable(lnav_config.lc_ui_movement.mode
== config_movement_mode::CURSOR);
};
lnav_data.ld_views[LNV_LOG].tc_reload_config_delegate = sel_reload_delegate;
lnav_data.ld_views[LNV_LOG].set_reload_config_delegate(sel_reload_delegate);
lnav_data.ld_views[LNV_TEXT].set_sub_source(&lnav_data.ld_text_source);
lnav_data.ld_views[LNV_LOG].tc_reload_config_delegate = sel_reload_delegate;
lnav_data.ld_views[LNV_TEXT].set_reload_config_delegate(
sel_reload_delegate);
lnav_data.ld_views[LNV_HISTOGRAM].set_sub_source(
&lnav_data.ld_hist_source2);
lnav_data.ld_views[LNV_DB].set_sub_source(&lnav_data.ld_db_row_source);
lnav_data.ld_db_overlay.dos_labels = &lnav_data.ld_db_row_source;
lnav_data.ld_views[LNV_DB].set_overlay_source(&lnav_data.ld_db_overlay);
lnav_data.ld_views[LNV_DB]
.set_reload_config_delegate(sel_reload_delegate)
.set_overlay_source(&lnav_data.ld_db_overlay);
lnav_data.ld_spectro_source = std::make_unique<spectrogram_source>();
lnav_data.ld_views[LNV_SPECTRO]
.set_sub_source(lnav_data.ld_spectro_source.get())

@ -533,7 +533,7 @@ static const json_path_handler_base::enum_value_t _movement_values[] = {
static const struct json_path_container movement_handlers = {
yajlpp::property_handler("mode")
.with_synopsis("mode_name")
.with_synopsis("top|cursor")
.with_enum_values(_movement_values)
.with_example("top")
.with_example("cursor")

@ -91,7 +91,7 @@ enum class config_movement_mode : unsigned int {
};
struct movement_config {
config_movement_mode mode;
config_movement_mode mode{config_movement_mode::TOP};
};
struct _lnav_config {

@ -442,9 +442,23 @@ add_config_possibilities()
} else {
rc->add_possibility(ln_mode_t::COMMAND, "config-option", path);
if (jph.jph_synopsis) {
rc->add_prefix(ln_mode_t::COMMAND,
std::vector<std::string>{"config", path},
jph.jph_synopsis);
if (jph.jph_enum_values) {
rc->add_prefix(ln_mode_t::COMMAND,
std::vector<std::string>{"config", path},
path);
for (size_t lpc = 0;
jph.jph_enum_values[lpc].first != nullptr;
lpc++)
{
rc->add_possibility(ln_mode_t::COMMAND,
path,
jph.jph_enum_values[lpc].first);
}
} else {
rc->add_prefix(ln_mode_t::COMMAND,
std::vector<std::string>{"config", path},
jph.jph_synopsis);
}
}
}
};

@ -1,11 +1,14 @@
{
"$schema": "https://lnav.org/schemas/config-v1.schema.json",
"ui" : {
"ui": {
"clock-format": "%Y-%m-%dT%H:%M:%S %Z",
"dim-text": false,
"default-colors": true,
"keymap": "default",
"theme": "default"
"theme": "default",
"movement": {
"mode": "top"
}
},
"tuning": {
"archive-manager": {

@ -700,8 +700,17 @@ public:
listview_curses::invoke_scroll();
}
textview_curses& set_reload_config_delegate(
std::function<void(textview_curses&)> func)
{
this->tc_reload_config_delegate = std::move(func);
if (this->tc_reload_config_delegate) {
this->tc_reload_config_delegate(*this);
}
return *this;
}
std::function<void(textview_curses&)> tc_state_event_handler;
std::function<void(textview_curses&)> tc_reload_config_delegate;
nonstd::optional<role_t> tc_cursor_role;
@ -761,6 +770,7 @@ protected:
std::string tc_previous_search;
std::shared_ptr<grep_highlighter> tc_search_child;
std::shared_ptr<grep_proc<vis_line_t>> tc_source_search_child;
std::function<void(textview_curses&)> tc_reload_config_delegate;
};
#endif

Loading…
Cancel
Save