mirror of
https://github.com/urbit/shrub.git
synced 2024-12-24 20:47:27 +03:00
dill: stop redrawing the prompt & cursor
No longer inserts newlines or redraws the prompt post-print, pushing this responsibility down to drum where it belongs. Additionally, separates the flow for dill's own output, from that of the console application. This lets us keep the desired behavior for now, and will ease reworking in the future. Last-printed-line and cursor position are still kept around in dill state, in order to respond to the relevant scry endpoints. These should either be refactored to scry into the underlying console app, or be removed entirely in favor of %hey.
This commit is contained in:
parent
7ab6d7dc9c
commit
3fdef14688
@ -538,6 +538,15 @@
|
||||
leaf+(weld (scag (sub edg 3) tape) "...")
|
||||
leaf+tape
|
||||
::
|
||||
++ se-blin :: print and newline
|
||||
|= lin=dill-blit:dill
|
||||
^+ +>
|
||||
:: newline means we need to redraw the prompt,
|
||||
:: so update the prompt mirror accordingly.
|
||||
::
|
||||
=. mir [0 ~]
|
||||
(se-blit %mor lin [%nel ~] ~)
|
||||
::
|
||||
++ se-dump :: print tanks
|
||||
|= tac=(list tank)
|
||||
^+ +>
|
||||
@ -548,7 +557,7 @@
|
||||
?. ((sane %t) (crip i.wol)) :: XX upstream validation
|
||||
~& bad-text+<`*`i.wol>
|
||||
$(wol t.wol)
|
||||
$(wol t.wol, +>.^$ (se-blit %out (tuba i.wol)))
|
||||
$(wol t.wol, +>.^$ (se-blin %out (tuba i.wol)))
|
||||
::
|
||||
++ se-join :: confirm connection
|
||||
|= gyl=gill:gall
|
||||
@ -587,9 +596,7 @@
|
||||
|= lin=(pair @ud stub)
|
||||
^+ +>
|
||||
?: =(mir lin) +>
|
||||
=. +> ?:(=(p.mir p.lin) +> (se-blit %hop p.lin))
|
||||
=. +> ?:(=(q.mir q.lin) +> (se-blit %pom q.lin))
|
||||
+>(mir lin)
|
||||
(se-blit(mir lin) %mor [%pom q.lin] [%hop p.lin] ~)
|
||||
::
|
||||
++ se-just :: adjusted buffer
|
||||
|= [pom=stub lin=(pair @ud (list @c))]
|
||||
@ -627,7 +634,7 @@
|
||||
?. ((sane %t) (crip txt)) :: XX upstream validation
|
||||
~& bad-text+<`*`txt>
|
||||
+>
|
||||
(se-blit %out (tuba txt))
|
||||
(se-blin %out (tuba txt))
|
||||
::
|
||||
++ se-poke :: send a poke
|
||||
|= [gyl=gill:gall par=cage]
|
||||
@ -806,7 +813,7 @@
|
||||
[%bye *] +>(..ta (se-klin gyl))
|
||||
[%det *] (ta-got +.fec)
|
||||
[%err *] (ta-err p.fec)
|
||||
[%klr *] +>(..ta (se-blit %klr (make:klr p.fec)))
|
||||
[%klr *] +>(..ta (se-blin %klr (make:klr p.fec)))
|
||||
[%mor *] |- ^+ +>.^$
|
||||
?~ p.fec +>.^$
|
||||
$(p.fec t.p.fec, +>.^$ ^$(fec i.p.fec))
|
||||
|
@ -1060,7 +1060,7 @@
|
||||
[%clr ~] :: clear the screen
|
||||
[%hop p=$@(@ud [r=@ud c=@ud])] :: set cursor row/pos
|
||||
[%klr p=stub] :: set styled line
|
||||
[%lin p=(list @c)] :: set current line
|
||||
[%lin p=(list @c)] :: set line at cursor
|
||||
[%nel ~] :: newline
|
||||
[%sag p=path q=*] :: save to jamfile
|
||||
[%sav p=path q=@] :: save to file
|
||||
|
@ -107,7 +107,7 @@
|
||||
%harm +>
|
||||
%hail (send %hey ~)
|
||||
%belt (send `dill-belt`p.kyz)
|
||||
%text (from %out (tuba p.kyz))
|
||||
%text (fore (tuba p.kyz) ~)
|
||||
%crud :: (send `dill-belt`[%cru p.kyz q.kyz])
|
||||
(crud p.kyz q.kyz)
|
||||
%blew (send %rez p.p.kyz q.p.kyz)
|
||||
@ -134,9 +134,8 @@
|
||||
%+ turn (flop tac)
|
||||
|=(a=tank (~(win re a) [0 wid]))
|
||||
==
|
||||
|- ^+ +>.^$
|
||||
?~ wall +>.^$
|
||||
$(wall t.wall, +>.^$ (from %out (tuba i.wall)))
|
||||
?: =(~ wall) +>.$
|
||||
(fore (turn wall tuba))
|
||||
::
|
||||
++ dump :: pass down to hey
|
||||
|= git=gift
|
||||
@ -159,6 +158,29 @@
|
||||
|= [=wire =note]
|
||||
+>(moz :_(moz [hen %pass wire note]))
|
||||
::
|
||||
++ fore :: send dill output
|
||||
::NOTE there are still implicit assumptions
|
||||
:: about the underlying console app's
|
||||
:: semantics here. specifically, trailing
|
||||
:: newlines are important to not getting
|
||||
:: overwritten by the drum prompt, and a
|
||||
:: bottom-of-screen cursor position gives
|
||||
:: nicest results. a more agnostic solution
|
||||
:: will need to replace this arm, someday.
|
||||
:: perhaps +send this to .ram instead?
|
||||
::
|
||||
|= liz=(list (list @c))
|
||||
^+ +>
|
||||
=. +>
|
||||
=| biz=(list blit)
|
||||
|- ^+ +>.^$
|
||||
?~ liz (done %blit biz)
|
||||
$(liz t.liz, biz (welp biz [%lin i.liz] [%nel ~] ~))
|
||||
:: since dill is acting on its own accord,
|
||||
:: we %hey the term app so it may clean up.
|
||||
::
|
||||
(send %hey ~)
|
||||
::
|
||||
++ from :: receive blit
|
||||
|= bit=dill-blit
|
||||
^+ +>
|
||||
@ -167,25 +189,13 @@
|
||||
?~ p.bit +>.^$
|
||||
$(p.bit t.p.bit, +>.^$ ^$(bit i.p.bit))
|
||||
?: ?=(%out -.bit)
|
||||
%+ done %blit
|
||||
:~ [%lin p.bit]
|
||||
[%nel ~]
|
||||
see
|
||||
[%hop pos]
|
||||
==
|
||||
?: ?=(%klr -.bit)
|
||||
%+ done %blit
|
||||
:~ [%klr p.bit]
|
||||
[%nel ~]
|
||||
see
|
||||
[%hop pos]
|
||||
==
|
||||
(done %blit [%lin p.bit]~)
|
||||
?: ?=(%pro -.bit)
|
||||
=. see [%lin p.bit]
|
||||
(done %blit [see [%hop pos] ~])
|
||||
(done %blit [%lin p.bit]~)
|
||||
?: ?=(%pom -.bit)
|
||||
=. see [%klr p.bit]
|
||||
(done %blit [see [%hop pos] ~])
|
||||
(done %blit [%klr p.bit]~)
|
||||
?: ?=(%hop -.bit)
|
||||
(done(pos p.bit) %blit [bit ~])
|
||||
?: ?=(%qit -.bit)
|
||||
@ -253,7 +263,7 @@
|
||||
:: ~& [%take-gall-onto +>.sih]
|
||||
?- -.+>.sih
|
||||
%| (crud %onto p.p.+>.sih)
|
||||
%& (done %blit [%lin (tuba "{<p.p.sih>}")]~)
|
||||
%& (fore (tuba "{<p.p.sih>}") ~)
|
||||
==
|
||||
::
|
||||
[%gall %unto *]
|
||||
@ -268,7 +278,7 @@
|
||||
==
|
||||
::
|
||||
[%clay %note *]
|
||||
(from %out (tuba p.sih ' ' ~(ram re q.sih)))
|
||||
(fore (tuba p.sih ' ' ~(ram re q.sih)) ~)
|
||||
::
|
||||
[?(%behn %clay) %writ *]
|
||||
init
|
||||
|
Loading…
Reference in New Issue
Block a user