implement first pass of 'MakeNormalDelete.deleteLine'; have to add tests for this next
This commit is contained in:
@@ -396,26 +396,17 @@ struct
|
|||||||
|
|
||||||
val buffer = LineGap.goToLine (endLine, buffer)
|
val buffer = LineGap.goToLine (endLine, buffer)
|
||||||
val endLineIdx = LineGap.lineNumberToIdx (endLine, buffer)
|
val endLineIdx = LineGap.lineNumberToIdx (endLine, buffer)
|
||||||
val endLineIdx =
|
|
||||||
if endLineIdx = #textLength buffer then Int.max (endLineIdx - 1, 0)
|
|
||||||
else endLineIdx
|
|
||||||
val buffer = LineGap.goToIdx (endLineIdx, buffer)
|
val buffer = LineGap.goToIdx (endLineIdx, buffer)
|
||||||
in
|
val endLineIdx =
|
||||||
if Cursor.isCursorAtStartOfLine (buffer, endLineIdx) then
|
if Cursor.isCursorAtStartOfLine (buffer, endLineIdx) then endLineIdx + 1
|
||||||
let
|
else endLineIdx
|
||||||
val endLineIdx =
|
|
||||||
if endLineIdx = #textLength buffer - 1 then endLineIdx - 1
|
|
||||||
else endLineIdx + 1
|
|
||||||
|
|
||||||
val length = endLineIdx - startIdx
|
val length = endLineIdx - startIdx
|
||||||
val initialMsg = Fn.initMsgs (startIdx, length, buffer)
|
val initialMsg = Fn.initMsgs (startIdx, length, buffer)
|
||||||
val buffer = LineGap.delete (startIdx, length, buffer)
|
val buffer = LineGap.delete (startIdx, length, buffer)
|
||||||
in
|
in
|
||||||
(* just need to reposition the cursor *)
|
(* just need to reposition the cursor *)
|
||||||
moveCursorAfterDeletingLines (app, buffer, time, initialMsg, startIdx)
|
moveCursorAfterDeletingLines (app, buffer, time, initialMsg, startIdx)
|
||||||
end
|
|
||||||
else
|
|
||||||
app
|
|
||||||
end
|
end
|
||||||
|
|
||||||
fun deleteLineDown (app: app_type, count, time) =
|
fun deleteLineDown (app: app_type, count, time) =
|
||||||
|
|||||||
Reference in New Issue
Block a user