From 3f7009bf09f0f595c8679ff9f7fd2189a1fa4fa5 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Mon, 1 Sep 2025 02:39:16 +0100 Subject: [PATCH] prefix search string with a / in NORMAL_SEARCH_MODE, just like in Vim --- fcore/normal-mode/normal-search-mode.sml | 4 ++-- fcore/text-builder.sml | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/fcore/normal-mode/normal-search-mode.sml b/fcore/normal-mode/normal-search-mode.sml index 43c593b..ce78dae 100644 --- a/fcore/normal-mode/normal-search-mode.sml +++ b/fcore/normal-mode/normal-search-mode.sml @@ -77,7 +77,7 @@ struct end (* 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 val {buffer, cursorIdx, windowWidth, windowHeight, startLine, ...} = app val buffer = LineGap.goToStart buffer @@ -114,7 +114,7 @@ struct case msg of CHAR_EVENT chr => addChr (app, searchString, chr) | KEY_ESC => exitToNormalMode app - | KEY_ENTER => finishSearch (app, searchString, tempSearchList) + | KEY_ENTER => saveSearch (app, searchString, tempSearchList) | RESIZE_EVENT (width, height) => app | WITH_SEARCH_LIST searchList => app end diff --git a/fcore/text-builder.sml b/fcore/text-builder.sml index 390fbc2..f456dbe 100644 --- a/fcore/text-builder.sml +++ b/fcore/text-builder.sml @@ -347,8 +347,25 @@ struct * Todo: Add | cursor to show position of search-string-cursor. *) fun buildLineToList (str, startX, startY, endX, floatWindowWidth, floatWindowHeight) = - loop - (0, str, startX, startY, endX, [], floatWindowWidth, floatWindowHeight) + let + 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 fun buildTextStringSearch