Merge remote-tracking branches 'ohaitch/fix-dojo-unlink', 'ohaitch/talk-interior-edits' and 'ohaitch/fix-cp'

fix urbit/urbit#555
fix urbit/urbit#628: talk interior edits
fix #125
This commit is contained in:
Raymond Pasco 2016-05-10 11:48:04 -04:00
commit 597797ec29
6 changed files with 53 additions and 46 deletions

View File

@ -286,6 +286,11 @@
^+ +>+>
(dy-ford way `silk`[%call [%$ %noun gat] [%$ %noun sam]])
::
++ dy-errd :: reject change, abet
|= {rev/(unit sole-edit) err/@u}
^+ +>+>
(he-errd(poy `+>+<) rev err)
::
++ dy-diff :: send effects, abet
|= fec/sole-effect
^+ +>+>
@ -402,8 +407,7 @@
!&(?=($del -.u.per) =(+(p.u.per) (lent buf.say)))
==
dy-abet(per ~)
=^ lic say (~(transmit sole say) u.per)
(dy-diff(per ~) %mor [%det lic] [%err q.q.cag] ~)
(dy-errd(per ~) per q.q.cag)
::
++ dy-done :: dialog submit
|= txt/tape
@ -642,7 +646,7 @@
|= cag/cage
^+ +>+>
?. ?=(^ q.q.cag)
(dy-diff %err q.q.cag)
(dy-errd ~ q.q.cag)
=+ tan=((list tank) +2.q.q.cag)
=. +>+>.$ (he-diff %tan tan)
=+ vax=(spec (slot 3 q.cag))
@ -664,7 +668,7 @@
|= cag/cage
^+ +>+>
?. ?=(^ q.q.cag)
(dy-diff %err q.q.cag)
(dy-errd ~ q.q.cag)
=+ tan=((list tank) +2.q.q.cag)
=. +>+>.$ (he-diff %tan tan)
=+ vax=(spec (slot 3 q.cag))
@ -841,6 +845,12 @@
?^ poy .
he-prom:he-pone
::
++ he-errd :: reject update
|= {rev/(unit sole-edit) err/@u} ^+ +>
=+ red=(fall rev [%nop ~]) :: required for error location sync
=^ lic say (~(transmit sole say) red)
(he-diff %mor [%det lic] [%err err] ~)
::
++ he-pone :: clear prompt
^+ .
=^ cal say (~(transmit sole say) [%set ~])
@ -924,9 +934,8 @@
=+ foy=(he-dope (tufa buf.say))
?: ?=($& -.foy) +>.$
:: ~& [%bad-change dat ted.cal]
=^ lic say (~(transmit sole say) dat)
:: ~& [%our-leg leg.say]
(he-diff %mor [%det lic] [%err q.p.foy] ~)
(he-errd `dat q.p.foy)
::
++ he-plan :: execute command
|= mad/dojo-command
@ -946,10 +955,10 @@
==
=+ doy=(he-duke txt)
?- -.doy
$| (he-diff [%err p.doy])
$| (he-errd ~ p.doy)
$&
?~ p.doy
(he-diff [%err (lent txt)])
(he-errd ~ (lent txt))
=+ old=(weld ?~(buf "> " " ") (tufa buf.say))
=^ cal say (~(transmit sole say) [%set ~])
=. +>.$ (he-diff %mor txt+old nex+~ det+cal ~)

View File

@ -115,12 +115,11 @@
++ poke-helm-begin (wrap poke-begin):from-helm
++ poke-hood-sync (wrap poke-sync):from-kiln
++ poke-hood-init-sync (wrap poke-init-sync):from-kiln
++ poke-kiln-cp (wrap poke-cp):from-kiln
++ poke-kiln-info (wrap poke-info):from-kiln
++ poke-kiln-label (wrap poke-label):from-kiln
++ poke-kiln-merge (wrap poke-merge):from-kiln
++ poke-kiln-cancel (wrap poke-cancel):from-kiln
++ poke-kiln-mount (wrap poke-mount):from-kiln
++ poke-kiln-mv (wrap poke-mv):from-kiln
++ poke-kiln-rm (wrap poke-rm):from-kiln
++ poke-kiln-schedule (wrap poke-schedule):from-kiln
++ poke-kiln-track (wrap poke-track):from-kiln

View File

@ -834,37 +834,42 @@
::
++ sh-sane :: sanitize input
|= {inv/sole-edit buf/(list @c)}
^- (list sole-edit)
^- {lit/(list sole-edit) err/(unit @u)}
=+ res=(rose (tufa buf) sh-scad)
?: ?=($| -.res) [inv ~]
=+ wok=`(unit work)`p.res
?: ?=($| -.res) [[inv]~ `p.res]
:_ ~
?~ p.res ~
=+ wok=u.p.res
|- ^- (list sole-edit)
?~ wok ~
?+ -.u.wok ~
$target $(wok q.u.wok)
?+ -.wok ~
$target ?~(q.wok ~ $(wok u.q.wok))
$say |- :: XX per line
?~ p.u.wok ~
?: ?=($lin -.i.p.u.wok)
?~ p.wok ~
?: ?=($lin -.i.p.wok)
(sh-sane-chat buf)
$(p.u.wok t.p.u.wok)
$(p.wok t.p.wok)
==
::
++ sh-slug :: edit to sanity
|= lit/(list sole-edit)
|= {lit/(list sole-edit) err/(unit @u)}
^+ +>
?~ lit +>
=^ lic say.she
(~(transmit sole say.she) `sole-edit`?~(t.lit i.lit [%mor lit]))
(sh-fact [%mor [%det lic] ~])
(sh-fact [%mor [%det lic] ?~(err ~ [%err u.err]~)])
::
++ sh-stir :: apply edit
|= cal/sole-change
^+ +>
=^ inv say.she (~(transceive sole say.she) cal)
=+ lit=(sh-sane inv buf.say.she)
?~ lit
=+ fix=(sh-sane inv buf.say.she)
?~ lit.fix
+>.$
(sh-slug lit)
?~ err.fix
(sh-slug fix) :: just capital correction
?. &(?=($del -.inv) =(+(p.inv) (lent buf.say.she)))
+>.$ :: allow interior edits, deletes
(sh-slug fix)
::
++ sh-lame :: send error
|= txt/tape
@ -1143,9 +1148,9 @@
--
::
++ sh-done :: apply result
=+ lit=(sh-sane [%nop ~] buf.say.she)
?^ lit
(sh-slug lit)
=+ fix=(sh-sane [%nop ~] buf.say.she)
?^ lit.fix
(sh-slug fix)
=+ jub=(rust (tufa buf.say.she) sh-scad)
?~ jub (sh-fact %bel ~)
%. u.jub

View File

@ -3,4 +3,7 @@
::
/? 310
:- %say
|=({^ {input/path output/path $~} $~} kiln-cp+[input output])
|= {^ {input/path output/path $~} $~}
:+ %kiln-info "copied"
?> =(-:(flop input) -:(flop output))
(foal output -:(flop input) [%atom %t ~] .^(* %cx input)) :: XX type

View File

@ -3,4 +3,8 @@
::
/? 310
:- %say
|=({^ {input/path output/path $~} $~} kiln-mv+[input output])
|= {^ {input/path output/path $~} $~}
:+ %kiln-info "moved"
?> =(-:(flop input) -:(flop output))
%+ furl (fray input)
(foal output -:(flop input) [%noun .^(* %cx input)])

View File

@ -143,33 +143,20 @@
|= syd/desk
abet:(emit %drop /cancel our syd)
::
++ do-info
++ poke-info
|= {mez/tape tor/toro}
abet:(emit:(spam leaf+mez ~) %info /kiln our tor)
::
++ poke-rm |=(a/path (do-info "removed" (fray a)))
++ poke-cp
|= {input/path output/path}
%+ do-info "copied"
?> =(-:(flop input) -:(flop output))
(foal output -:(flop input) [%atom %t ~] .^(* %cx input)) :: XX type
::
++ poke-mv
|= {input/path output/path}
%+ do-info "moved"
?> =(-:(flop input) -:(flop output))
%+ furl (fray input)
(foal output -:(flop input) %noun .^(* %cx input))
::
++ poke-rm |=(a/path (poke-info "removed" (fray a)))
++ poke-label
|= {syd/desk lab/@tas}
=+ pax=/(scot %p our)/[syd]/[lab]
(do-info "labeled {(spud pax)}" [syd %| lab])
(poke-info "labeled {(spud pax)}" [syd %| lab])
::
++ poke-schedule
|= {where/path tym/@da eve/@t}
=. where (welp where /sched)
%+ do-info "scheduled"
%+ poke-info "scheduled"
=+ old=;;((map @da cord) (fall (file where) ~))
(foal where %sched !>((~(put by old) tym eve)))
::