M fs/doc/sys/grid.txt => fs/doc/sys/grid.txt +3 -0
@@ 54,6 54,9 @@ its methods, namely:
:pcell! ( c self -- )
Set content of the cell at current pos to character "c".
+:pos! ( pos self -- )
+ Set current pos to "pos" and update cursor position.
+
:clrline ( ln self -- )
Set all cells in line number "ln" to spaces.
M fs/doc/text/ged.txt => fs/doc/text/ged.txt +4 -0
@@ 20,7 20,11 @@ enters the grid keybindings loop.
## Keybindings
q Quit
+h move 1 character left
j move 1 line down
k move 1 line up
+l move 1 character right
+H move to the beginning of the line
+L move to the end of the line
] move 1 page down
[ move 1 page up
M fs/text/ged.fs => fs/text/ged.fs +6 -3
@@ 12,15 12,18 @@ require /sys/grid.fs
: _spitpage ( -- )
grid LINES 1- >r 0 edbuf sel begin ( lineno line )
dup if over grid COLS * over _spitline else over grid :clrline then
- dup if llnext then swap 1+ swap next 2drop ;
+ dup if llnext then swap 1+ swap next 2drop
+ edbuf cpos grid :pos! ;
-S" qhjkl[]" const KEYS
+S" qhjklHL[]" const KEYS
KEYS c@ wordtbl handlers
-'w quit
+:w grid LINES 1- dup grid :clrline grid COLS * grid :pos! quit ;
:w 1 edbuf :goleft ;
:w 1 edbuf :godown ;
:w 1 edbuf :goup ;
:w 1 edbuf :goright ;
+:w $ffff edbuf :goleft ;
+:w $ffff edbuf :goright ;
:w pagesz edbuf :goup ;
:w pagesz edbuf :godown ;