implement functionality for left and right arrow keys to move cursor left/right when entering searchString in NORMAL_SEARCH_MODE
This commit is contained in:
@@ -267,4 +267,9 @@ struct
|
|||||||
NormalFinish.withSearchList (app, searchList)
|
NormalFinish.withSearchList (app, searchList)
|
||||||
| KEY_ENTER => app
|
| KEY_ENTER => app
|
||||||
| KEY_BACKSPACE => app
|
| KEY_BACKSPACE => app
|
||||||
|
(* todo *)
|
||||||
|
| ARROW_RIGHT => app
|
||||||
|
| ARROW_LEFT => app
|
||||||
|
| ARROW_UP => app
|
||||||
|
| ARROW_DOWN => app
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -102,6 +102,28 @@ struct
|
|||||||
(app, searchString, tempSearchList, searchCursorIdx, buffer)
|
(app, searchString, tempSearchList, searchCursorIdx, buffer)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fun moveLeft (app, searchString, tempSearchList, searchCursorIdx) =
|
||||||
|
if searchCursorIdx = 0 then
|
||||||
|
app
|
||||||
|
else
|
||||||
|
let
|
||||||
|
val searchCursorIdx = searchCursorIdx - 1
|
||||||
|
in
|
||||||
|
NormalSearchFinish.onSearchChanged
|
||||||
|
(app, searchString, tempSearchList, searchCursorIdx, #buffer app)
|
||||||
|
end
|
||||||
|
|
||||||
|
fun moveRight (app, searchString, tempSearchList, searchCursorIdx) =
|
||||||
|
if searchCursorIdx = String.size searchString then
|
||||||
|
app
|
||||||
|
else
|
||||||
|
let
|
||||||
|
val searchCursorIdx = searchCursorIdx + 1
|
||||||
|
in
|
||||||
|
NormalSearchFinish.onSearchChanged
|
||||||
|
(app, searchString, tempSearchList, searchCursorIdx, #buffer app)
|
||||||
|
end
|
||||||
|
|
||||||
fun update (app, {searchString, tempSearchList, searchCursorIdx}, msg, time) =
|
fun update (app, {searchString, tempSearchList, searchCursorIdx}, msg, time) =
|
||||||
case msg of
|
case msg of
|
||||||
CHAR_EVENT chr => addChr (app, searchString, searchCursorIdx, chr)
|
CHAR_EVENT chr => addChr (app, searchString, searchCursorIdx, chr)
|
||||||
@@ -111,4 +133,10 @@ struct
|
|||||||
| KEY_ENTER => saveSearch (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
|
||||||
|
| ARROW_LEFT =>
|
||||||
|
moveLeft (app, searchString, tempSearchList, searchCursorIdx)
|
||||||
|
| ARROW_RIGHT =>
|
||||||
|
moveRight (app, searchString, tempSearchList, searchCursorIdx)
|
||||||
|
| ARROW_UP => app
|
||||||
|
| ARROW_DOWN => app
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user