mirror of
https://github.com/narrrl/narl-workspace.git
synced 2026-11-04 17:07:00 +01:00
help: the whole sheet, walked by key
The help was a box narrower than the screen that had to be scrolled with the mouse. It is now as big as the porthole, in newspaper columns that run on to the right: h/l and j/k move a column, Ctrl-D/U and Space a screen, g/G to either end. A row is never split between columns, and says what it says before its first dash; / filters the rows by key or words, and shows the ones left whole. The prose footer became an 'in the editor' group.
This commit is contained in:
1 parent
38d15afda2
commit
304c67151c
4 files changed
+261
-88
No files matched your search
+47
-1
@@ -9,7 +9,7 @@
|
||||
import DocumentPane from './lib/DocumentPane.svelte'
|
||||
import FilePane from './lib/FilePane.svelte'
|
||||
import Headings from './lib/Headings.svelte'
|
||||
import Help from './lib/Help.svelte'
|
||||
import Help, { focusHelpFilter, scrollHelp } from './lib/Help.svelte'
|
||||
import Hints from './lib/Hints.svelte'
|
||||
import Verify from './lib/Verify.svelte'
|
||||
import Login from './lib/Login.svelte'
|
||||
@@ -378,6 +378,46 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The help's keys: its columns run on to the right, so h/l and j/k move a
|
||||
* column, Ctrl-D/U a screen, g/G to either end, and `/` narrows it down.
|
||||
*/
|
||||
function helpKey(event: KeyboardEvent): boolean {
|
||||
if (event.ctrlKey) {
|
||||
if (event.key !== 'd' && event.key !== 'u') return false
|
||||
scrollHelp(event.key === 'd' ? 'pagedown' : 'pageup')
|
||||
return true
|
||||
}
|
||||
switch (event.key) {
|
||||
case 'l':
|
||||
case 'j':
|
||||
case 'ArrowRight':
|
||||
case 'ArrowDown':
|
||||
scrollHelp(1)
|
||||
return true
|
||||
case 'h':
|
||||
case 'k':
|
||||
case 'ArrowLeft':
|
||||
case 'ArrowUp':
|
||||
scrollHelp(-1)
|
||||
return true
|
||||
case ' ':
|
||||
scrollHelp(event.shiftKey ? 'pageup' : 'pagedown')
|
||||
return true
|
||||
case 'g':
|
||||
scrollHelp('start')
|
||||
return true
|
||||
case 'G':
|
||||
scrollHelp('end')
|
||||
return true
|
||||
case '/':
|
||||
focusHelpFilter()
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/** `gO`'s list: j/k down the headings, Enter to the one picked. */
|
||||
function outlineKey(event: KeyboardEvent): boolean {
|
||||
const last = Math.max(workspace.outline.length - 1, 0)
|
||||
@@ -682,6 +722,12 @@
|
||||
|
||||
// The command line over an overlay — `D` in the agenda — keeps its keys.
|
||||
const listening = cmdline === null && !isTypingTarget(event.target)
|
||||
if (workspace.overlay === 'help' && listening && !event.metaKey && !event.altKey) {
|
||||
if (helpKey(event)) {
|
||||
event.preventDefault()
|
||||
return
|
||||
}
|
||||
}
|
||||
if (workspace.overlay === 'overview' && listening && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
||||
if (overviewKey(event)) {
|
||||
event.preventDefault()
|
||||
|
||||
Reference in new issue
Block a user