From fd7f121f042ea98cbfb3ec7280f3605b8c5480df Mon Sep 17 00:00:00 2001 From: crc Date: Wed, 15 Nov 2017 01:11:34 +0000 Subject: [PATCH] editor: now has [ ] to move to start, end of file FossilOrigin-Name: 8bb96123f16e8a104abdc8104a72f4c1caf49c9e81f50fc8d9c0089b6d518eda --- README.md | 3 +-- example/edit.forth | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3a73c89..ff80fa7 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ adapt to various uses. For FreeBSD, macOS, Linux: - make + ./build Binaries will be found in the `bin` directory. The ones of interest are: @@ -44,4 +44,3 @@ working directory to operate. Wrapping a shell script, some RETRO code, and using the `rre` interface, this is a slightly nicer alternative to the basic `repl` for interactive use. - diff --git a/example/edit.forth b/example/edit.forth index a11382b..4fa55fb 100755 --- a/example/edit.forth +++ b/example/edit.forth @@ -238,6 +238,14 @@ One more command: a word to jump to a particular line in the file. gets s:to-number !CurrentLine ; ~~~ +~~~ +:goto-start (-) + #0 !CurrentLine ; + +:goto-end (-) + @LineCount !CurrentLine ; +~~~ + And now tie everything together. There's a key handler and a top level loop. ~~~ @@ -268,6 +276,8 @@ And now tie everything together. There's a key handler and a top level loop. $v [ paste-line ] case $< [ dedent-line ] case $> [ indent-line ] case + $[ [ goto-start ] case + $] [ goto-end ] case $j [ &CurrentLine v:inc constrain ] case $k [ &CurrentLine v:dec constrain ] case $g [ goto constrain ] case