only update search list if timestamp for search message is greater than the buffer's modified time
This commit is contained in:
@@ -49,14 +49,21 @@ struct
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun withSearchList (app: app_type, searchList) =
|
fun withSearchList (app: app_type, searchList, searchTime) =
|
||||||
let
|
let
|
||||||
val {buffer, searchString, cursorIdx, bufferModifyTime, ...} = app
|
open Time
|
||||||
val app = NormalModeWith.searchList
|
|
||||||
(app, searchList, buffer, searchString, bufferModifyTime)
|
|
||||||
in
|
in
|
||||||
buildTextAndClear
|
if searchTime >= #bufferModifyTime app then
|
||||||
(app, buffer, cursorIdx, searchList, [], bufferModifyTime)
|
let
|
||||||
|
val {buffer, searchString, cursorIdx, bufferModifyTime, ...} = app
|
||||||
|
val app = NormalModeWith.searchList
|
||||||
|
(app, searchList, buffer, searchString, bufferModifyTime)
|
||||||
|
in
|
||||||
|
buildTextAndClear
|
||||||
|
(app, buffer, cursorIdx, searchList, [], bufferModifyTime)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
app
|
||||||
end
|
end
|
||||||
|
|
||||||
fun resizeText (app: app_type, newWidth, newHeight) =
|
fun resizeText (app: app_type, newWidth, newHeight) =
|
||||||
|
|||||||
@@ -522,8 +522,8 @@ struct
|
|||||||
| KEY_ESC => NormalFinish.clearMode app
|
| KEY_ESC => NormalFinish.clearMode app
|
||||||
| RESIZE_EVENT (width, height) =>
|
| RESIZE_EVENT (width, height) =>
|
||||||
NormalFinish.resizeText (app, width, height)
|
NormalFinish.resizeText (app, width, height)
|
||||||
| WITH_SEARCH_LIST searchList =>
|
| WITH_SEARCH_LIST (searchList, time) =>
|
||||||
NormalFinish.withSearchList (app, searchList)
|
NormalFinish.withSearchList (app, searchList, time)
|
||||||
|
|
||||||
(* Don't need to handle these keys in normal mode.
|
(* Don't need to handle these keys in normal mode.
|
||||||
* Everything that is possible through them in Vi and Vim
|
* Everything that is possible through them in Vi and Vim
|
||||||
|
|||||||
@@ -141,8 +141,8 @@ struct
|
|||||||
moveLeft (app, searchString, tempSearchList, searchCursorIdx)
|
moveLeft (app, searchString, tempSearchList, searchCursorIdx)
|
||||||
| ARROW_RIGHT =>
|
| ARROW_RIGHT =>
|
||||||
moveRight (app, searchString, tempSearchList, searchCursorIdx)
|
moveRight (app, searchString, tempSearchList, searchCursorIdx)
|
||||||
| WITH_SEARCH_LIST searchList =>
|
| WITH_SEARCH_LIST (searchList, time) =>
|
||||||
NormalSearchModeWith.searchList (app, searchList)
|
NormalFinish.withSearchList (app, searchList, time)
|
||||||
| RESIZE_EVENT (width, height) =>
|
| RESIZE_EVENT (width, height) =>
|
||||||
NormalSearchFinish.resize
|
NormalSearchFinish.resize
|
||||||
(app, width, height, searchCursorIdx, tempSearchList)
|
(app, width, height, searchCursorIdx, tempSearchList)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ struct
|
|||||||
| KEY_ENTER
|
| KEY_ENTER
|
||||||
| KEY_BACKSPACE
|
| KEY_BACKSPACE
|
||||||
| RESIZE_EVENT of int * int
|
| RESIZE_EVENT of int * int
|
||||||
| WITH_SEARCH_LIST of int vector
|
| WITH_SEARCH_LIST of int vector * Time.time
|
||||||
| ARROW_LEFT
|
| ARROW_LEFT
|
||||||
| ARROW_UP
|
| ARROW_UP
|
||||||
| ARROW_RIGHT
|
| ARROW_RIGHT
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ struct
|
|||||||
let
|
let
|
||||||
val (buffer, searchString, time) = Mailbox.recv searchMailbox
|
val (buffer, searchString, time) = Mailbox.recv searchMailbox
|
||||||
val searchList = SearchList.build (buffer, searchString)
|
val searchList = SearchList.build (buffer, searchString)
|
||||||
val () = Mailbox.send (inputMailbox, InputMsg.WITH_SEARCH_LIST searchList)
|
val msg = InputMsg.WITH_SEARCH_LIST (searchList, time)
|
||||||
|
val () = Mailbox.send (inputMailbox, msg)
|
||||||
in
|
in
|
||||||
loop (searchMailbox, inputMailbox)
|
loop (searchMailbox, inputMailbox)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user