block editor: refactorings in the display code

FossilOrigin-Name: 5b5f78a200c397487ffc4d0284968b9ddd3270265099390a56c6e6d2af6945de
This commit is contained in:
crc 2019-03-01 15:46:26 +00:00
parent afdba33807
commit ee8b56bd0d

View file

@ -30,7 +30,7 @@ This presents a visual, (briefly) modal interface.
| | | |
| | | |
0---------1---------2---------3---------4---------5---------6--- 0---------1---------2---------3---------4---------5---------6---
#2 1:0 :: Block 2 | 1:0 | Stack:
The horizontal rulers have column indicators, there are cursor The horizontal rulers have column indicators, there are cursor
position indicators (and the actual cursor location shows at the position indicators (and the actual cursor location shows at the
@ -170,26 +170,24 @@ It should be pretty straightforward though.
:tty:clear (-) #27 c:put '[2J s:put #27 c:put '[0;0H s:put ; :tty:clear (-) #27 c:put '[2J s:put #27 c:put '[0;0H s:put ;
{{ {{
:cursor (cl-) :cursor (cl-) ASCII:ESC '%c[%n;%nH s:format s:put ;
ASCII:ESC c:put :indicate:column @CurrentCol #4 + #0 cursor $# c:put ;
$[ c:put n:put :indicate:row #2 @CurrentLine #2 + cursor $# c:put ;
$; c:put n:put $H c:put ; :indicators indicate:row indicate:column ;
:indicators @CurrentCol #4 + #0 cursor $# c:put
#2 @CurrentLine #2 + cursor $# c:put
#0 #24 cursor ;
:ruler :ruler
'___0---------1---------2---------3 s:put '___0---------1---------2--------- s:put
'---------4---------5---------6--- s:put nl ; '3---------4---------5---------6--- s:put nl ;
:block# $# c:put @CurrentBlock n:put ; :| '_|_ s:put ;
:pos @CurrentLine n:put $: c:put @CurrentCol n:put ; :block# @CurrentBlock 'Block_%n s:format s:put ;
:status block# sp pos '_::_ s:put dump-stack ; :pos @CurrentCol @CurrentLine '%n,%n s:format s:put ;
:format '_|_ s:put call '_| s:put nl ; :status #0 #24 cursor block#
| pos | 'Stack:_ s:put dump-stack ;
:format | call | nl ;
:line [ #64 [ fetch-next c:put ] times ] format ; :line [ #64 [ fetch-next c:put ] times ] format ;
:code &Block #16 [ line ] times<with-index> drop ; :code &Block #16 [ line ] times<with-index> drop ;
:format '_|_ s:put call '_| s:put nl ;
:tob &TOB #4 [ line ] times drop ; :tob &TOB #4 [ line ] times drop ;
---reveal--- ---reveal---
:block:display (-) :block:display (-) hook
tty:clear ruler code ruler tob ruler indicators status ; tty:clear ruler code ruler tob ruler indicators status ;
}} }}
~~~ ~~~