editor: fix constraing issue
FossilOrigin-Name: fd27b3b776ca6d506980a1de2c2235e074e2c8bb168e87fb040f80fb09a8f0b1
This commit is contained in:
parent
a13bbdd928
commit
3f36e8a42d
2 changed files with 4 additions and 4 deletions
|
@ -4,7 +4,7 @@ Most words in RETRO have a stack comment. These look like:
|
|||
(nn-n)
|
||||
|
||||
As with all comments, a stack comment begins with ( and should end with
|
||||
a ). There are two parts to the comment. On the left side of the - is
|
||||
a ). There are two parts to the comment. On the left side of the - is
|
||||
what the word *consumes*. On the right is what it *leaves*.
|
||||
|
||||
RETRO uses a short notation, with one character per value taken or left.
|
||||
|
|
6
example/edit.forth
Executable file → Normal file
6
example/edit.forth
Executable file → Normal file
|
@ -125,7 +125,7 @@ indicator can be toggled via the ~ key.
|
|||
@ShowEOL [ $~ putc ] if nl ;
|
||||
|
||||
:display-line (n-n)
|
||||
dup @LineCount lteq?
|
||||
dup @LineCount lt?
|
||||
[ dup mark-if-current pad line# n:inc @FID file:read-line puts eol ] if ;
|
||||
|
||||
:display (-)
|
||||
|
@ -243,7 +243,7 @@ to the start or end of the file.
|
|||
#0 !CurrentLine ;
|
||||
|
||||
:goto-end (-)
|
||||
@LineCount !CurrentLine ;
|
||||
@LineCount n:dec !CurrentLine ;
|
||||
~~~
|
||||
|
||||
And now tie everything together. There's a key handler and a top level loop.
|
||||
|
@ -275,7 +275,7 @@ And now tie everything together. There's a key handler and a top level loop.
|
|||
~~~
|
||||
|
||||
~~~
|
||||
:constrain (-) &CurrentLine #0 @LineCount v:limit ;
|
||||
:constrain (-) &CurrentLine #0 @LineCount n:dec v:limit ;
|
||||
:handler
|
||||
getc
|
||||
$1 [ replace-line ] case
|
||||
|
|
Loading…
Reference in a new issue