in search-list.sml: fix 'delRightFromHere' and 'delLeftFromHere' functions which joined newHd with left/right, rather than the tl, and therefore added new numbers to the list, which is incorrect behaviour. Fixed this by using joining with 'tl' rather than left/right. In build-search-list.sml: make fromRange function return tuple instead of an instance of app. Finally, in app-update.sml: progress towards refactoring 'helpRemoveChr' function to map and delete from searchList as desired.

This commit is contained in:
2024-11-17 09:25:01 +00:00
parent f7cc2d4740
commit e90df37b43
4 changed files with 26 additions and 12 deletions

View File

@@ -420,9 +420,14 @@ struct
let
(* delete char at cursor and then decrement cursorIdx by 1
* if cursorIdx is not 0 *)
val {searchString, ...} = app
val buffer = LineGap.delete (cursorIdx, 1, buffer)
val searchList = SearchList.delete (cursorIdx, 1, #searchString app, searchList)
val searchList = SearchList.delete (cursorIdx, 1, searchString, searchList)
val searchList = SearchList.mapFrom (cursorIdx, ~1, searchList)
val (buffer, searchList) =
BuildSearchList.fromRange
(cursorIdx, 1, buffer, searchString, searchList)
val cursorIdx =
if
@@ -435,9 +440,14 @@ struct
end
else
let
val {searchString, ...} = app
val buffer = LineGap.delete (cursorIdx, 1, buffer)
val searchList = SearchList.delete (cursorIdx, 1, #searchString app, searchList)
val searchList = SearchList.delete (cursorIdx, 1, searchString, searchList)
val searchList = SearchList.mapFrom (cursorIdx, ~1, searchList)
val (buffer, searchList) =
BuildSearchList.fromRange
(cursorIdx, 1, buffer, searchString, searchList)
in
helpRemoveChr (app, buffer, searchList, cursorIdx, count - 1)
end