fix known errors in LineGap.sub function
This commit is contained in:
@@ -2263,10 +2263,10 @@ struct
|
|||||||
end
|
end
|
||||||
|
|
||||||
fun subRight (findIdx, curIdx, hd, tl) =
|
fun subRight (findIdx, curIdx, hd, tl) =
|
||||||
if findIdx > curIdx + String.size hd then
|
if findIdx > curIdx + String.size hd - 1 then
|
||||||
case tl of
|
case tl of
|
||||||
hd :: tl =>
|
hd :: tl =>
|
||||||
if findIdx > curIdx + String.size hd then
|
if findIdx > curIdx + String.size hd - 1 then
|
||||||
subRight (findIdx, curIdx + String.size hd, hd, tl)
|
subRight (findIdx, curIdx + String.size hd, hd, tl)
|
||||||
else
|
else
|
||||||
let val strIdx = findIdx - curIdx
|
let val strIdx = findIdx - curIdx
|
||||||
@@ -2301,14 +2301,14 @@ struct
|
|||||||
end
|
end
|
||||||
|
|
||||||
fun sub (findIdx, buffer: t) =
|
fun sub (findIdx, buffer: t) =
|
||||||
if findIdx < #idx buffer then
|
if findIdx >= #idx buffer then
|
||||||
case #leftStrings buffer of
|
|
||||||
hd :: tl => subLeft (findIdx, #idx buffer, hd, tl)
|
|
||||||
| [] => raise Fail "not found"
|
|
||||||
else
|
|
||||||
case #rightStrings buffer of
|
case #rightStrings buffer of
|
||||||
hd :: tl => subRight (findIdx, #idx buffer, hd, tl)
|
hd :: tl => subRight (findIdx, #idx buffer, hd, tl)
|
||||||
| [] => raise Fail "not found"
|
| [] => raise Fail "not found"
|
||||||
|
else
|
||||||
|
case #leftStrings buffer of
|
||||||
|
hd :: tl => subLeft (findIdx, #idx buffer, hd, tl)
|
||||||
|
| [] => raise Fail "not found"
|
||||||
|
|
||||||
local
|
local
|
||||||
fun consIfNotEmpty (s, acc) =
|
fun consIfNotEmpty (s, acc) =
|
||||||
|
|||||||
Reference in New Issue
Block a user