create an 'exitToNormalMode' function which exits NORMAL_SEARCH_MODE and creates a message to redraw the screen so that it looks like normal mode

This commit is contained in:
2025-09-01 02:26:25 +01:00
parent 561e45c556
commit 0f945c9646

View File

@@ -66,6 +66,16 @@ struct
onSearchChanged (app, searchString, tempSearchList, buffer)
end
(* return to normal mode, keeping the same searchString and searchList
* from before entering this mode. *)
fun exitToNormalMode (app: app_type) =
let
val {buffer, cursorIdx, searchList, bufferModifyTime, ...} = app
in
NormalFinish.buildTextAndClear
(app, buffer, cursorIdx, searchList, [], bufferModifyTime)
end
(* save search string and tempSearchList and return to normal mode *)
fun finishSearch (app: app_type, searchString, tempSearchList) =
let
@@ -103,7 +113,7 @@ struct
fun update (app, {searchString, tempSearchList}, msg, time) =
case msg of
CHAR_EVENT chr => addChr (app, searchString, chr)
| KEY_ESC => NormalFinish.clearMode app
| KEY_ESC => exitToNormalMode app
| KEY_ENTER => finishSearch (app, searchString, tempSearchList)
| RESIZE_EVENT (width, height) => app
| WITH_SEARCH_LIST searchList => app