done replacing direct calls to 'LineGap.delete' with calls to 'SearchList.deleteBufferAndSearchList', so that the search list is also deleted from whenever the buffer is deleted from

This commit is contained in:
2026-02-07 22:27:44 +00:00
parent 9b520d71f5
commit 0c40cad77a
2 changed files with 14 additions and 9 deletions

View File

@@ -889,16 +889,21 @@ struct
fun deleteToStart (app: app_type, time) : AppType.app_type = fun deleteToStart (app: app_type, time) : AppType.app_type =
let let
val {cursorIdx, buffer, windowWidth, windowHeight, dfa, ...} = app val {cursorIdx, buffer, windowWidth, windowHeight, dfa, searchList, ...} =
app
val buffer = LineGap.goToIdx (cursorIdx, buffer) val buffer = LineGap.goToIdx (cursorIdx, buffer)
val cursorIdx = Cursor.viDlrForDelete (buffer, cursorIdx, 1) val cursorIdx = Cursor.viDlrForDelete (buffer, cursorIdx, 1)
val buffer = LineGap.goToIdx (cursorIdx, buffer) val buffer = LineGap.goToIdx (cursorIdx, buffer)
val initialMsg = Fn.initMsgs (0, cursorIdx, buffer) val initialMsg = Fn.initMsgs (0, cursorIdx, buffer)
val buffer = LineGap.delete (0, cursorIdx, buffer) val (buffer, searchList) = SearchList.deleteBufferAndSearchList
(0, cursorIdx, buffer, searchList, dfa)
val buffer = val buffer =
if #textLength buffer = 0 then LineGap.fromString "\n" else buffer (* todo: adjust searchList if we call SearchList.fromString *)
if #textLength buffer = 0 then LineGap.fromString "\n"
else buffer
val buffer = LineGap.goToIdx (cursorIdx - 1111, buffer) val buffer = LineGap.goToIdx (cursorIdx - 1111, buffer)
val (buffer, searchList) = SearchList.build (buffer, dfa) val (buffer, searchList) = SearchList.build (buffer, dfa)
@@ -973,13 +978,13 @@ struct
fun helpDeleteToMatch (app: app_type, low, high, time) = fun helpDeleteToMatch (app: app_type, low, high, time) =
let let
val {buffer, dfa, ...} = app val {buffer, dfa, searchList, ...} = app
val buffer = LineGap.goToIdx (high, buffer) val buffer = LineGap.goToIdx (high, buffer)
val length = high - low val length = high - low
val initialMsg = Fn.initMsgs (low, length, buffer) val initialMsg = Fn.initMsgs (low, length, buffer)
val buffer = LineGap.delete (low, length, buffer) val (buffer, searchList) = SearchList.deleteBufferAndSearchList
val (buffer, searchList) = SearchList.build (buffer, dfa) (low, length, buffer, searchList, dfa)
val buffer = LineGap.goToIdx (low, buffer) val buffer = LineGap.goToIdx (low, buffer)
in in
@@ -1111,8 +1116,8 @@ struct
val buffer = LineGap.goToIdx (high, buffer) val buffer = LineGap.goToIdx (high, buffer)
val initialMsg = Fn.initMsgs (deleteLow, length, buffer) val initialMsg = Fn.initMsgs (deleteLow, length, buffer)
val buffer = LineGap.delete (deleteLow, length, buffer) val (buffer, searchList) = SearchList.deleteBufferAndSearchList
val (buffer, searchList) = SearchList.build (buffer, dfa) (deleteLow, length, buffer, #searchList app, dfa)
val buffer = LineGap.goToIdx (low, buffer) val buffer = LineGap.goToIdx (low, buffer)
in in

View File

@@ -1,5 +1,5 @@
# To-do list # To-do list
- Make sure that all delete function in make-normal-delete.sml also delete from searchList - Address to-do notes in make-normal-delete.sml (update searchList in light of insertion)
- Add normal-delete tests for each motion, checking that searchList is as expected - Add normal-delete tests for each motion, checking that searchList is as expected
- Add tests for other yank motoins - Add tests for other yank motoins
- Tests should be based on existing tests for delete-motions, and in the same order. - Tests should be based on existing tests for delete-motions, and in the same order.