editor improvements from Kiyoshi
FossilOrigin-Name: 7a31037a55020c31bf0ae5e926304760eae297d5a777153ad8f241c696d7f4a9
This commit is contained in:
parent
7ad127ea4a
commit
6d93de7ecd
1 changed files with 9 additions and 6 deletions
|
@ -119,7 +119,8 @@ This just displays the separator bars.
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
:---- (-)
|
:---- (-)
|
||||||
COLS [ $- c:put ] times nl ;
|
#7 [ $- c:put ] times
|
||||||
|
#0 COLS #10 / [ dup n:put #9 [ $- c:put ] times n:inc ] times n:put nl ;
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
Next, a word to display the header. Currently just the name of
|
Next, a word to display the header. Currently just the name of
|
||||||
|
@ -196,7 +197,7 @@ to aid in later readability.
|
||||||
@FID file:close
|
@FID file:close
|
||||||
here TEMP-FILE file:slurp here @SourceFile file:spew ;
|
here TEMP-FILE file:slurp here @SourceFile file:spew ;
|
||||||
|
|
||||||
:current? (n-nf)
|
:current (ns-nsf)
|
||||||
over @CurrentLine eq? ;
|
over @CurrentLine eq? ;
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
|
@ -217,8 +218,9 @@ Then a word to discard the current line, removing it from the file.
|
||||||
And the inverse, a word to inject a new line into the file.
|
And the inverse, a word to inject a new line into the file.
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
:add-line (-)
|
:add-line (-)
|
||||||
[ current? [ ASCII:LF @FID file:write ] if file:s:put n:inc ] process-lines ;
|
[ current? [ file:s:put ASCII:LF @FID file:write ]
|
||||||
|
[ file:s:put ] choose n:inc ] process-lines CurrentLine v:inc ;
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
Replacing a line is next. Much like the `delete-line`, this
|
Replacing a line is next. Much like the `delete-line`, this
|
||||||
|
@ -239,8 +241,9 @@ file with the dummy one.
|
||||||
[ repeat c:get dup ASCII:LF -eq? 0; drop save again ] call drop ] sip ;
|
[ repeat c:get dup ASCII:LF -eq? 0; drop save again ] call drop ] sip ;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
:replace-line (-)
|
:replace-line (-)
|
||||||
[ current? [ drop s:get ] if file:s:put n:inc ] process-lines ;
|
[ current? [ drop #7 [ ASCII:SPACE c:put ] times s:get ] if
|
||||||
|
file:s:put n:inc ] process-lines ;
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
The next four are just things I find useful. They allow me to
|
The next four are just things I find useful. They allow me to
|
||||||
|
|
Loading…
Reference in a new issue