1
1
mirror of https://github.com/tstack/lnav.git synced 2024-10-04 00:31:31 +03:00

[blog] add post for cursor mode

This commit is contained in:
Tim Stack 2023-06-23 16:16:58 -07:00
parent 19de26e4c2
commit 7f18aa9cd9
7 changed files with 158 additions and 35 deletions

View File

@ -43,5 +43,6 @@ Amos Bird
Cristian Chiru
Peter Schiffer
Pedro Pombeiro
Florian Münchbach
Fredrik Forséll
Tobias Gruetzmacher

View File

@ -1,43 +1,42 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.0.5.1)
activesupport (7.0.5)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.8.1)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.11.1)
colorator (1.1.0)
commonmarker (0.23.8)
concurrent-ruby (1.1.10)
dnsruby (1.61.9)
simpleidn (~> 0.1)
commonmarker (0.23.9)
concurrent-ruby (1.2.2)
dnsruby (1.70.0)
simpleidn (~> 0.2.1)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
ethon (0.15.0)
ethon (0.16.0)
ffi (>= 1.15.0)
eventmachine (1.2.7)
execjs (2.8.1)
faraday (2.5.2)
faraday (2.7.7)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.0)
faraday-net_http (3.0.2)
ffi (1.15.5)
forwardable-extended (2.6.0)
gemoji (3.0.1)
github-pages (227)
github-pages (228)
github-pages-health-check (= 1.17.9)
jekyll (= 3.9.2)
jekyll (= 3.9.3)
jekyll-avatar (= 0.7.0)
jekyll-coffeescript (= 1.1.1)
jekyll-commonmark-ghpages (= 0.2.0)
jekyll-commonmark-ghpages (= 0.4.0)
jekyll-default-layout (= 0.1.4)
jekyll-feed (= 0.15.1)
jekyll-gist (= 1.5.0)
@ -71,7 +70,7 @@ GEM
jemoji (= 0.12.0)
kramdown (= 2.3.2)
kramdown-parser-gfm (= 1.1.0)
liquid (= 4.0.3)
liquid (= 4.0.4)
mercenary (~> 0.3)
minima (= 2.5.1)
nokogiri (>= 1.13.6, < 2.0)
@ -83,17 +82,17 @@ GEM
octokit (~> 4.0)
public_suffix (>= 3.0, < 5.0)
typhoeus (~> 1.3)
html-pipeline (2.14.2)
html-pipeline (2.14.3)
activesupport (>= 2)
nokogiri (>= 1.4)
http_parser.rb (0.8.0)
i18n (0.9.5)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
jekyll (3.9.2)
jekyll (3.9.3)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 0.7)
i18n (>= 0.7, < 2)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 2.0)
kramdown (>= 1.17, < 3)
@ -109,11 +108,11 @@ GEM
coffee-script-source (~> 1.11.1)
jekyll-commonmark (1.4.0)
commonmarker (~> 0.22)
jekyll-commonmark-ghpages (0.2.0)
commonmarker (~> 0.23.4)
jekyll-commonmark-ghpages (0.4.0)
commonmarker (~> 0.23.7)
jekyll (~> 3.9.0)
jekyll-commonmark (~> 1.4.0)
rouge (>= 2.0, < 4.0)
rouge (>= 2.0, < 5.0)
jekyll-default-layout (0.1.4)
jekyll (~> 3.0)
jekyll-feed (0.15.1)
@ -201,8 +200,8 @@ GEM
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.7.1)
liquid (4.0.4)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6)
@ -210,10 +209,10 @@ GEM
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.16.3)
nokogiri (1.14.3-arm64-darwin)
minitest (5.18.1)
nokogiri (1.15.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.14.3-x86_64-linux)
nokogiri (1.15.2-x86_64-linux)
racc (~> 1.4)
octokit (4.25.1)
faraday (>= 1, < 3)
@ -221,7 +220,7 @@ GEM
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.7)
racc (1.6.2)
racc (1.7.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
@ -242,20 +241,19 @@ GEM
unf (~> 0.1.4)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.10)
thread_safe (~> 0.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
webrick (1.7.0)
zeitwerk (2.6.0)
webrick (1.8.1)
PLATFORMS
arm64-darwin-21
arm64-darwin-22
x86_64-linux
DEPENDENCIES

17
docs/_layouts/post.html Normal file
View File

@ -0,0 +1,17 @@
---
layout: default
---
<div class="post">
<header class="post-header">
<h1 class="post-title">{{ page.title }}</h1>
</header>
<article class="post-content">
{{ content }}
</article>
<script src="/assets/js/codeblock.js"></script>
</div>

View File

@ -0,0 +1,30 @@
---
layout: post
title: Cursor Mode
excerpt: Move around the main view using a cursor
---
*(This change is in [**v0.11.2+**](https://github.com/tstack/lnav/releases/tag/v0.11.2-rc3))*
The major change in the v0.11.2 release is the addition of a "cursor mode"
for the main view. Instead of focusing on the top line for interacting
with **lnav**, a cursor line is displayed and interactions focus on that.
The arrow keys and the hotkeys that jump between bookmarks, like search
hits and errors, now move the focused line instead of scrolling the view.
To help provide context for what you're looking at, large jumps will keep
the focused line in the middle of the view. Smaller movements, like
moving the cursor above the top line, will scroll the view a small amount
so as not to be jarring.
You can enable/disable cursor mode interactively by pressing `CTRL` + `x`.
Or, you can permanently enable cursor mode by running the following
`:config` command:
```
:config /ui/movement/mode cursor
```
<script async
id="asciicast-d94CmxlGM01I0L5HNn9qDn917"
src="https://asciinema.org/a/d94CmxlGM01I0L5HNn9qDn917.js">
</script>

View File

@ -0,0 +1,23 @@
var codeBlocks = document.querySelectorAll('pre.highlight');
codeBlocks.forEach(function (codeBlock) {
var copyButton = document.createElement('button');
copyButton.className = 'copy';
copyButton.type = 'button';
copyButton.ariaLabel = 'Copy code to clipboard';
copyButton.innerText = 'Copy';
codeBlock.append(copyButton);
copyButton.addEventListener('click', function () {
var code = codeBlock.querySelector('code').innerText.trim();
window.navigator.clipboard.writeText(code);
copyButton.innerText = 'Copied';
var fourSeconds = 4000;
setTimeout(function () {
copyButton.innerText = 'Copy';
}, fourSeconds);
});
});

View File

@ -29,3 +29,55 @@
#playground-box .prompt {
color: #4f4;
}
pre.highlight {
padding: 8px 12px;
position: relative;
// override skeleton styles
> code {
border: 0;
overflow-x: auto;
padding-right: 0;
padding-left: 0;
}
&.highlight {
border-left: 15px solid #35383c;
color: #c1c2c3;
overflow: auto;
white-space: pre;
word-wrap: normal;
&,
code {
background-color: #222;
font-size: 14px;
}
}
// code to clipboard
.copy {
color: #4AF626;
position: absolute;
right: 1.2rem;
top: 1.2rem;
opacity: 0;
&:active,
&:focus,
&:hover {
background: rgba(0, 0, 0, 0.7);
opacity: 1;
}
}
&:active .copy,
&:focus .copy,
&:hover .copy {
background: rgba(0, 0, 0, 0.7);
opacity: 1;
}
}

View File

@ -204,6 +204,8 @@ listview_curses::do_update()
if (this->lv_selectable) {
if (this->lv_selection < 0_vl) {
this->set_top(0_vl);
} else if (this->lv_sync_selection_and_top) {
this->set_top(this->lv_selection);
} else if (this->lv_selection
>= (this->lv_top + height - this->lv_tail_space - 1_vl))
{