prefix search string with a / in NORMAL_SEARCH_MODE, just like in Vim

This commit is contained in:
2025-09-01 02:39:16 +01:00
parent 0f945c9646
commit 3f7009bf09
2 changed files with 21 additions and 4 deletions

View File

@@ -77,7 +77,7 @@ struct
end end
(* save search string and tempSearchList and return to normal mode *) (* save search string and tempSearchList and return to normal mode *)
fun finishSearch (app: app_type, searchString, tempSearchList) = fun saveSearch (app: app_type, searchString, tempSearchList) =
let let
val {buffer, cursorIdx, windowWidth, windowHeight, startLine, ...} = app val {buffer, cursorIdx, windowWidth, windowHeight, startLine, ...} = app
val buffer = LineGap.goToStart buffer val buffer = LineGap.goToStart buffer
@@ -114,7 +114,7 @@ struct
case msg of case msg of
CHAR_EVENT chr => addChr (app, searchString, chr) CHAR_EVENT chr => addChr (app, searchString, chr)
| KEY_ESC => exitToNormalMode app | KEY_ESC => exitToNormalMode app
| KEY_ENTER => finishSearch (app, searchString, tempSearchList) | KEY_ENTER => saveSearch (app, searchString, tempSearchList)
| RESIZE_EVENT (width, height) => app | RESIZE_EVENT (width, height) => app
| WITH_SEARCH_LIST searchList => app | WITH_SEARCH_LIST searchList => app
end end

View File

@@ -347,8 +347,25 @@ struct
* Todo: Add | cursor to show position of search-string-cursor. *) * Todo: Add | cursor to show position of search-string-cursor. *)
fun buildLineToList fun buildLineToList
(str, startX, startY, endX, floatWindowWidth, floatWindowHeight) = (str, startX, startY, endX, floatWindowWidth, floatWindowHeight) =
loop let
(0, str, startX, startY, endX, [], floatWindowWidth, floatWindowHeight) val r: Real32.real = 0.67
val g: Real32.real = 0.51
val b: Real32.real = 0.83
val acc = makeChr
(#"/", startX, startY, floatWindowWidth, floatWindowHeight, r, g, b)
val posX = startX + TC.xSpace
in
loop
( 0
, str
, posX
, startY
, endX
, [acc]
, floatWindowWidth
, floatWindowHeight
)
end
end end
fun buildTextStringSearch fun buildTextStringSearch