~vdupras/duskos

192caafde2748553181171609681d6022cc16ced — Virgil Dupras 1 year, 4 months ago ddeb807
text/ged: add some movement keys
2 files changed, 18 insertions(+), 2 deletions(-)

M fs/doc/text/ged.txt
M fs/text/ged.fs
M fs/doc/text/ged.txt => fs/doc/text/ged.txt +4 -1
@@ 20,4 20,7 @@ enters the grid keybindings loop.
## Keybindings

q Quit
All others: select next line down and refresh page.
j move 1 line down
k move 1 line up
] move 1 page down
[ move 1 page up

M fs/text/ged.fs => fs/text/ged.fs +14 -1
@@ 1,5 1,6 @@
require /sys/grid.fs
?f<< /text/ed.fs
?f<< /lib/wordtbl.fs

: nspcs ( n -- ) >r begin SPC grid :putc next ;
: _spitline ( pos line -- )


@@ 13,4 14,16 @@ require /sys/grid.fs
    dup if over grid COLS * over _spitline else over grid :clrline then
    dup if llnext then swap 1+ swap next 2drop ;

: ged begin _spitpage 1 edbuf :godown key 'q' = until ;
\ No newline at end of file
S" qhjkl[]" const KEYS
KEYS c@ wordtbl handlers
'w quit
:w 1 edbuf :goleft ;
:w 1 edbuf :godown ;
:w 1 edbuf :goup ;
:w 1 edbuf :goright ;
:w pagesz edbuf :goup ;
:w pagesz edbuf :godown ;

: ged begin
    _spitpage key KEYS c@+ [c]? ( idx )
    dup 0>= if handlers swap wexec else drop then again ;
\ No newline at end of file