similar loop optimisations described in previous commit to app-update.sml's 'helpDeleteToChr' function
This commit is contained in:
@@ -277,7 +277,7 @@ struct
|
|||||||
(* move LineGap to cursorIdx, which is necessary for finding newCursorIdx *)
|
(* move LineGap to cursorIdx, which is necessary for finding newCursorIdx *)
|
||||||
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||||
val newCursorIdx = fMove (buffer, cursorIdx, chr)
|
val newCursorIdx = fMove (buffer, cursorIdx, chr)
|
||||||
val newCount = if cursorIdx = newCursorIdx then 0 else cursorIdx - 1
|
val newCount = if cursorIdx = newCursorIdx then 0 else count - 1
|
||||||
in
|
in
|
||||||
helpMoveToChr (app, buffer, newCursorIdx, newCount, fMove, chr)
|
helpMoveToChr (app, buffer, newCursorIdx, newCount, fMove, chr)
|
||||||
end
|
end
|
||||||
@@ -453,13 +453,10 @@ struct
|
|||||||
let
|
let
|
||||||
val buffer = LineGap.goToIdx (otherIdx, buffer)
|
val buffer = LineGap.goToIdx (otherIdx, buffer)
|
||||||
val newOtherIdx = fMove (buffer, otherIdx, chr)
|
val newOtherIdx = fMove (buffer, otherIdx, chr)
|
||||||
val newCount =
|
val newCount = if newOtherIdx = otherIdx then 0 else count - 1
|
||||||
if newOtherIdx = otherIdx
|
|
||||||
then 0
|
|
||||||
else count - 1
|
|
||||||
val newOtherIdx = fInc (newOtherIdx, 1)
|
val newOtherIdx = fInc (newOtherIdx, 1)
|
||||||
in
|
in
|
||||||
helpDeleteToChr (app, buffer, cursorIdx, otherIdx, newCount, fMove, fInc, chr)
|
helpDeleteToChr (app, buffer, cursorIdx, newOtherIdx, newCount, fMove, fInc, chr)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun deleteToChr (app: app_type, count, fMove, fInc, chr) =
|
fun deleteToChr (app: app_type, count, fMove, fInc, chr) =
|
||||||
|
|||||||
Reference in New Issue
Block a user