documents: simplify text+loc.

windows-high-dpi
John Benediktsson 2018-02-12 17:45:48 -08:00
parent 0bd052500e
commit 3e15dfc4cb
1 changed files with 6 additions and 8 deletions

View File

@ -77,14 +77,12 @@ CONSTANT: doc-start { 0 0 }
: (doc-range) ( from to line# document -- slice )
[ start/end-on-line ] 2keep doc-line <slice> ;
: text+loc ( lines loc -- loc )
over [
over length 1 = [
nip first2
] [
first swap length 1 - + 0
] if
] dip last length + 2array ;
:: text+loc ( lines loc -- loc )
lines length 1 = [
loc first2
] [
loc first lines length 1 - + 0
] if lines last length + 2array ;
: prepend-first ( str seq -- )
0 swap [ append ] change-nth ;