redraw screen when we change from NORMAL_MODE to NORMAL_SEARCH_MODE, so it is visually clear that we have changed modes
This commit is contained in:
@@ -5,14 +5,14 @@ struct
|
|||||||
open AppType
|
open AppType
|
||||||
open InputMsg
|
open InputMsg
|
||||||
|
|
||||||
(* todo: create draw msg showing search bar *)
|
|
||||||
fun switchToNormalSearchMode (app: app_type) =
|
fun switchToNormalSearchMode (app: app_type) =
|
||||||
let
|
let
|
||||||
val mode =
|
val mode =
|
||||||
NORMAL_SEARCH_MODE
|
NORMAL_SEARCH_MODE
|
||||||
{searchString = "", tempSearchList = Vector.fromList []}
|
{searchString = "", tempSearchList = Vector.fromList []}
|
||||||
in
|
in
|
||||||
NormalModeWith.mode (app, mode, [])
|
NormalSearchFinish.onSearchChanged
|
||||||
|
(app, "", Vector.fromList [], #buffer app)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun getNumLength (pos, str) =
|
fun getNumLength (pos, str) =
|
||||||
|
|||||||
53
fcore/normal-mode/normal-search-finish.sml
Normal file
53
fcore/normal-mode/normal-search-finish.sml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
structure NormalSearchFinish =
|
||||||
|
struct
|
||||||
|
open AppType
|
||||||
|
|
||||||
|
fun onSearchChanged (app: app_type, searchString, tempSearchList, buffer) =
|
||||||
|
let
|
||||||
|
open DrawMsg
|
||||||
|
|
||||||
|
val {buffer, cursorIdx, startLine, windowWidth, windowHeight, ...} = app
|
||||||
|
val mode =
|
||||||
|
NORMAL_SEARCH_MODE
|
||||||
|
{searchString = searchString, tempSearchList = tempSearchList}
|
||||||
|
|
||||||
|
val floatWindowWidth = Real32.fromInt windowWidth
|
||||||
|
val floatWindowHeight = Real32.fromInt windowHeight
|
||||||
|
|
||||||
|
val searchStringPosY = windowHeight - TextConstants.ySpace - 5
|
||||||
|
|
||||||
|
val initialTextAcc = TextBuilder.buildLineToList
|
||||||
|
( searchString
|
||||||
|
, 5
|
||||||
|
, searchStringPosY
|
||||||
|
, windowWidth
|
||||||
|
, floatWindowWidth
|
||||||
|
, floatWindowHeight
|
||||||
|
)
|
||||||
|
|
||||||
|
val buffer = LineGap.goToLine (startLine, buffer)
|
||||||
|
val startLine = TextWindow.getStartLine
|
||||||
|
(buffer, startLine, cursorIdx, windowWidth, windowHeight)
|
||||||
|
|
||||||
|
val remainingWindowHeight = windowHeight - (TextConstants.ySpace * 2)
|
||||||
|
|
||||||
|
val msgs = TextBuilder.buildWithExisting
|
||||||
|
( startLine
|
||||||
|
, cursorIdx
|
||||||
|
, buffer
|
||||||
|
, windowWidth
|
||||||
|
, remainingWindowHeight
|
||||||
|
, floatWindowWidth
|
||||||
|
, floatWindowHeight
|
||||||
|
, tempSearchList
|
||||||
|
, searchString
|
||||||
|
, []
|
||||||
|
, initialTextAcc
|
||||||
|
, []
|
||||||
|
)
|
||||||
|
in
|
||||||
|
NormalSearchModeWith.changeTempSearchString
|
||||||
|
(app, buffer, startLine, mode, msgs)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -4,54 +4,6 @@ struct
|
|||||||
open InputMsg
|
open InputMsg
|
||||||
open MailboxType
|
open MailboxType
|
||||||
|
|
||||||
fun onSearchChanged (app: app_type, searchString, tempSearchList, buffer) =
|
|
||||||
let
|
|
||||||
open DrawMsg
|
|
||||||
|
|
||||||
val {buffer, cursorIdx, startLine, windowWidth, windowHeight, ...} = app
|
|
||||||
val mode =
|
|
||||||
NORMAL_SEARCH_MODE
|
|
||||||
{searchString = searchString, tempSearchList = tempSearchList}
|
|
||||||
|
|
||||||
val floatWindowWidth = Real32.fromInt windowWidth
|
|
||||||
val floatWindowHeight = Real32.fromInt windowHeight
|
|
||||||
|
|
||||||
val searchStringPosY = windowHeight - TextConstants.ySpace - 5
|
|
||||||
|
|
||||||
val initialTextAcc = TextBuilder.buildLineToList
|
|
||||||
( searchString
|
|
||||||
, 5
|
|
||||||
, searchStringPosY
|
|
||||||
, windowWidth
|
|
||||||
, floatWindowWidth
|
|
||||||
, floatWindowHeight
|
|
||||||
)
|
|
||||||
|
|
||||||
val buffer = LineGap.goToLine (startLine, buffer)
|
|
||||||
val startLine = TextWindow.getStartLine
|
|
||||||
(buffer, startLine, cursorIdx, windowWidth, windowHeight)
|
|
||||||
|
|
||||||
val remainingWindowHeight = windowHeight - (TextConstants.ySpace * 2)
|
|
||||||
|
|
||||||
val msgs = TextBuilder.buildWithExisting
|
|
||||||
( startLine
|
|
||||||
, cursorIdx
|
|
||||||
, buffer
|
|
||||||
, windowWidth
|
|
||||||
, remainingWindowHeight
|
|
||||||
, floatWindowWidth
|
|
||||||
, floatWindowHeight
|
|
||||||
, tempSearchList
|
|
||||||
, searchString
|
|
||||||
, []
|
|
||||||
, initialTextAcc
|
|
||||||
, []
|
|
||||||
)
|
|
||||||
in
|
|
||||||
NormalSearchModeWith.changeTempSearchString
|
|
||||||
(app, buffer, startLine, mode, msgs)
|
|
||||||
end
|
|
||||||
|
|
||||||
fun addChr (app: app_type, searchString, chr) =
|
fun addChr (app: app_type, searchString, chr) =
|
||||||
let
|
let
|
||||||
val {cursorIdx, buffer, ...} = app
|
val {cursorIdx, buffer, ...} = app
|
||||||
@@ -63,7 +15,8 @@ struct
|
|||||||
val tempSearchList =
|
val tempSearchList =
|
||||||
SearchList.buildRange (buffer, searchString, cursorIdx + 1111)
|
SearchList.buildRange (buffer, searchString, cursorIdx + 1111)
|
||||||
in
|
in
|
||||||
onSearchChanged (app, searchString, tempSearchList, buffer)
|
NormalSearchFinish.onSearchChanged
|
||||||
|
(app, searchString, tempSearchList, buffer)
|
||||||
end
|
end
|
||||||
|
|
||||||
(* return to normal mode, keeping the same searchString and searchList
|
(* return to normal mode, keeping the same searchString and searchList
|
||||||
|
|||||||
1
shf.mlb
1
shf.mlb
@@ -39,6 +39,7 @@ fcore/cursor.sml
|
|||||||
fcore/text-window.sml
|
fcore/text-window.sml
|
||||||
|
|
||||||
fcore/normal-mode/normal-finish.sml
|
fcore/normal-mode/normal-finish.sml
|
||||||
|
fcore/normal-mode/normal-search-finish.sml
|
||||||
fcore/move.sml
|
fcore/move.sml
|
||||||
|
|
||||||
fcore/normal-mode/normal-move.sml
|
fcore/normal-mode/normal-move.sml
|
||||||
|
|||||||
Reference in New Issue
Block a user