duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 6266742c8ae47e60b924597181370849f624979a
parent 867e92969725196fcc2e1858297a4ac1c88346db
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Sat, 21 Jan 2023 11:04:57 -0500

text/ed: fix "dl" bugs for first and last lines

Diffstat:
Mfs/tests/text/ed.fs | 4+++-
Mfs/text/ed.fs | 3++-
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/tests/text/ed.fs b/fs/tests/text/ed.fs @@ -26,8 +26,10 @@ capture o appended line S" appended line\n ^\n4 / 16\n" #s= capture O inserted line S" inserted line\n ^\n4 / 17\n" #s= +0 g 1 capture dl +S" with some text\n ^\n0 / 16\n" #s= 0 g capture O at the beginning of the buf -S" at the beginning of the buf\n ^\n0 / 18\n" #s= +S" at the beginning of the buf\n ^\n0 / 17\n" #s= \ Now let's save this to a BlobFile 2 const TOTSEC diff --git a/fs/text/ed.fs b/fs/text/ed.fs @@ -109,7 +109,8 @@ extends IO struct[ Edbuf : :dellines ( n self -- ) over not if 2drop exit then >r \ V1=self >r V1 sel dup begin llnext dup not if leave then next ( delpoint tgt ) - tuck swap V1 lines llprev ( tgt tgt prev ) ! r> _sel! ; + tuck swap V1 to' lines llprev ( tgt tgt prev ) ! ( tgt ) + ?dup not if V1 lines llend then r> _sel! ; ]struct Edbuf :new structbind Edbuf edbuf