editor: dont display lines beyond end of file
FossilOrigin-Name: 7a4ad9315c80e43507c925b0b4abdbb783287bb4858c095c2c3d9c2d504529ab
This commit is contained in:
parent
9e7c27fcc7
commit
a445f95e36
1 changed files with 5 additions and 3 deletions
|
@ -12,6 +12,7 @@ the rest of the code.
|
|||
~~~
|
||||
'SourceFile var
|
||||
'CurrentLine var
|
||||
'LineCount var
|
||||
'FID var
|
||||
~~~
|
||||
|
||||
|
@ -59,7 +60,7 @@ advance to the currently selected line.
|
|||
|
||||
~~~
|
||||
:count-lines (-)
|
||||
#0 @SourceFile [ drop n:inc ] file:for-each-line ;
|
||||
#0 @SourceFile [ drop n:inc ] file:for-each-line dup !LineCount ;
|
||||
|
||||
:skip-to
|
||||
@CurrentLine #0 n:max [ @FID file:read-line drop ] times ;
|
||||
|
@ -73,7 +74,7 @@ be adjusted for your chosen terminal.
|
|||
|
||||
~~~
|
||||
:clear-display (-)
|
||||
ASCII:ESC '%c[2J s:with-format puts nl ;
|
||||
ASCII:ESC dup '%c[2J%c[0;0H s:with-format puts nl ;
|
||||
~~~
|
||||
|
||||
This just displays the separator bars.
|
||||
|
@ -115,7 +116,8 @@ The indicator is an asterisk, and visually marks the current line.
|
|||
putn ':_ puts ;
|
||||
|
||||
:display-line (n-n)
|
||||
dup mark-if-current pad line# n:inc @FID file:read-line puts nl ;
|
||||
dup @LineCount lteq?
|
||||
[ dup mark-if-current pad line# n:inc @FID file:read-line puts nl ] if ;
|
||||
~~~
|
||||
|
||||
~~~
|
||||
|
|
Loading…
Reference in a new issue