add missing implementation of Cursor.matchPair when strIdx is in tl
This commit is contained in:
@@ -1632,18 +1632,7 @@ struct
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun matchPair (lineGap: LineGap.t, cursorIdx) =
|
fun startMatchPair (strIdx, shd, stl, cursorIdx) =
|
||||||
let
|
|
||||||
val {rightStrings, idx = bufferIdx, leftStrings, ...} = lineGap
|
|
||||||
in
|
|
||||||
case rightStrings of
|
|
||||||
shd :: stl =>
|
|
||||||
let
|
|
||||||
(* convert absolute cursorIdx to idx relative to hd string *)
|
|
||||||
val strIdx = cursorIdx - bufferIdx
|
|
||||||
in
|
|
||||||
if strIdx < String.size shd then
|
|
||||||
(* strIdx is in this string *)
|
|
||||||
let
|
let
|
||||||
val chr = String.sub (shd, strIdx)
|
val chr = String.sub (shd, strIdx)
|
||||||
in
|
in
|
||||||
@@ -1690,6 +1679,20 @@ struct
|
|||||||
)
|
)
|
||||||
| _ => cursorIdx)
|
| _ => cursorIdx)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fun matchPair (lineGap: LineGap.t, cursorIdx) =
|
||||||
|
let
|
||||||
|
val {rightStrings, idx = bufferIdx, leftStrings, ...} = lineGap
|
||||||
|
in
|
||||||
|
case rightStrings of
|
||||||
|
shd :: stl =>
|
||||||
|
let
|
||||||
|
(* convert absolute cursorIdx to idx relative to hd string *)
|
||||||
|
val strIdx = cursorIdx - bufferIdx
|
||||||
|
in
|
||||||
|
if strIdx < String.size shd then
|
||||||
|
(* strIdx is in this string *)
|
||||||
|
startMatchPair (strIdx, shd, stl, cursorIdx)
|
||||||
else
|
else
|
||||||
(* strIdx is in tl *)
|
(* strIdx is in tl *)
|
||||||
(case stl of
|
(case stl of
|
||||||
@@ -1698,7 +1701,7 @@ struct
|
|||||||
val strIdx = strIdx - String.size shd
|
val strIdx = strIdx - String.size shd
|
||||||
val leftStrings = shd :: leftStrings
|
val leftStrings = shd :: leftStrings
|
||||||
in
|
in
|
||||||
(print "match pair throw err\n"; raise Match)
|
startMatchPair (strIdx, stlhd, leftStrings, cursorIdx)
|
||||||
end
|
end
|
||||||
| [] => cursorIdx)
|
| [] => cursorIdx)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user