From da3ccfa23874e7d23f406e86b7e93c7ac60f6b4d Mon Sep 17 00:00:00 2001 From: Joseph Bryan Date: Tue, 28 Feb 2017 15:51:39 -0500 Subject: [PATCH] resets drum input offset on sole-edit discontinuities ($set) and renames ++ta-off -> ++ta-pos --- lib/drum.hoon | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/drum.hoon b/lib/drum.hoon index 32361fcdf..9345e7a39 100644 --- a/lib/drum.hoon +++ b/lib/drum.hoon @@ -570,7 +570,7 @@ $v ta-bel $w ?: =(0 pos.inp) ta-bel - =+ sop=(ta-off %l %ace pos.inp) + =+ sop=(ta-pos %l %ace pos.inp) (ta-kil %l [(sub pos.inp sop) sop]) $x +>(..ta se-anon) $y ?: =(0 num.kil) @@ -632,22 +632,31 @@ == == :: + ++ ta-off :: reset buffer offset + |= ted/sole-edit + =. off ?: |- ?. ?=({$mor *} ted) + ?=({$set *} ted) + |- ?~(p.ted | |(^$(ted i.p.ted) $(p.ted t.p.ted))) + 0 + off + +> + :: ++ ta-got :: apply change |= cal/sole-change =^ ted say.inp (~(receive sole say.inp) cal) - (ta-dog ted) + (ta-dog:(ta-off ted.cal) ted) :: ++ ta-hom :: local edit |= ted/sole-edit ^+ +> - =. +> (ta-det ted) + =. +> (ta-det:(ta-off ted) ted) (ta-dog(say.inp (~(commit sole say.inp) ted)) ted) :: ++ ta-jump :: buffer pos |= {dir/?($l $r) til/?($ace $edg $wrd) pos/@ud} ^- @ud %- ?:(?=($l dir) sub add) - [pos (ta-off dir til pos)] + [pos (ta-pos dir til pos)] :: ++ ta-kil :: kill selection |= {dir/?($l $r) sel/{@ @}} @@ -688,7 +697,7 @@ :: $bac ?: =(0 pos.inp) :: kill left-word ta-bel - =+ sop=(ta-off %l %edg pos.inp) + =+ sop=(ta-pos %l %edg pos.inp) (ta-kil %l [(sub pos.inp sop) sop]) :: $b ?: =(0 pos.inp) :: jump left-word @@ -705,7 +714,7 @@ :: $d ?: =(pos.inp (lent buf.say.inp)) :: kill right-word ta-bel - (ta-kil %r [pos.inp (ta-off %r %edg pos.inp)]) + (ta-kil %r [pos.inp (ta-pos %r %edg pos.inp)]) :: $f ?: =(pos.inp (lent buf.say.inp)) :: jump right-word ta-bel @@ -722,7 +731,7 @@ ?: =(b c) ta-bel =+ next=[b (sub a b)] - =+ prev=[c (ta-off %r %edg c)] + =+ prev=[c (ta-pos %r %edg c)] %- ta-hom(pos.inp a) :~ %mor (rep:edit next (swag prev buf.say.inp)) @@ -734,7 +743,7 @@ ta-bel =+ case=?:(?=($u key) cuss cass) =+ sop=(ta-jump %r %wrd pos.inp) - =+ sel=[sop (ta-off %r %edg sop)] + =+ sel=[sop (ta-pos %r %edg sop)] %- ta-hom %+ rep:edit sel ^- (list @c) ^- (list @) :: XX unicode @@ -777,7 +786,7 @@ old.hit [buf.say.inp old.hit] == :: - ++ ta-off :: buffer pos offset + ++ ta-pos :: buffer pos offset |= {dir/?($l $r) til/?($ace $edg $wrd) pos/@ud} ^- @ud %- ?- til $ace ace:offset