when constructing SEARCH message, include time in the message as well. This will enable us to ignore any messages when we have a 'later' state available.
This commit is contained in:
@@ -12,7 +12,7 @@ struct
|
||||
let
|
||||
val searchString = #searchString app
|
||||
val buffer = LineGap.goToStart buffer
|
||||
val msgs = SEARCH (buffer, searchString) :: initialMsg
|
||||
val msgs = SEARCH (buffer, searchString, time) :: initialMsg
|
||||
|
||||
val buffer = LineGap.goToIdx (low - 1111, buffer)
|
||||
val searchList = SearchList.buildRange (buffer, searchString, low + 1111)
|
||||
@@ -106,7 +106,7 @@ struct
|
||||
* Instead, a single character is deleted at different places.
|
||||
* So it doesn't make any sense to use Fn.initMsgs
|
||||
* which expects a range. *)
|
||||
finishAfterDeletingBuffer (app, cursorIdx, buffer, time, [])
|
||||
finishAfterDeletingBuffer (app, cursorIdx, buffer, time, [])
|
||||
else
|
||||
let
|
||||
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||
@@ -198,7 +198,7 @@ struct
|
||||
val buffer = LineGap.delete (low, length, buffer)
|
||||
val buffer = LineGap.goToStart buffer
|
||||
val searchString = #searchString app
|
||||
val initialMsg = SEARCH (buffer, searchString) :: initialMsg
|
||||
val initialMsg = SEARCH (buffer, searchString, time) :: initialMsg
|
||||
|
||||
val buffer = LineGap.goToIdx (cursorIdx - 1111, buffer)
|
||||
val searchList =
|
||||
@@ -413,7 +413,7 @@ struct
|
||||
|
||||
val buffer = LineGap.delete (0, cursorIdx, buffer)
|
||||
val buffer = LineGap.goToStart buffer
|
||||
val initialMsg = SEARCH (buffer, #searchString app) :: initialMsg
|
||||
val initialMsg = SEARCH (buffer, #searchString app, time) :: initialMsg
|
||||
|
||||
val buffer = LineGap.goToIdx (cursorIdx - 1111, buffer)
|
||||
val searchList =
|
||||
@@ -449,7 +449,7 @@ struct
|
||||
|
||||
val buffer = LineGap.delete (low, length, buffer)
|
||||
val buffer = LineGap.goToStart buffer
|
||||
val initialMsg = SEARCH (buffer, searchString) :: initialMsg
|
||||
val initialMsg = SEARCH (buffer, searchString, time) :: initialMsg
|
||||
|
||||
val buffer = LineGap.goToIdx (low - 1111, buffer)
|
||||
val searchList = SearchList.buildRange (buffer, searchString, low + 1111)
|
||||
@@ -507,7 +507,7 @@ struct
|
||||
val buffer = LineGap.delete (low, length, buffer)
|
||||
|
||||
val buffer = LineGap.goToStart buffer
|
||||
val initialMsg = SEARCH (buffer, searchString) :: initialMsg
|
||||
val initialMsg = SEARCH (buffer, searchString, time) :: initialMsg
|
||||
|
||||
val buffer = LineGap.goToIdx (low - 1111, buffer)
|
||||
val searchList =
|
||||
@@ -539,7 +539,7 @@ struct
|
||||
val buffer = LineGap.delete (low, length, buffer)
|
||||
|
||||
val buffer = LineGap.goToStart buffer
|
||||
val initialMsg = SEARCH (buffer, searchString) :: initialMsg
|
||||
val initialMsg = SEARCH (buffer, searchString, time) :: initialMsg
|
||||
|
||||
val buffer = LineGap.goToIdx (low - 1111, buffer)
|
||||
val searchList =
|
||||
@@ -568,7 +568,7 @@ struct
|
||||
|
||||
val buffer = LineGap.delete (low, length, buffer)
|
||||
val buffer = LineGap.goToStart buffer
|
||||
val initialMsg = SEARCH (buffer, searchString) :: initialMsg
|
||||
val initialMsg = SEARCH (buffer, searchString, time) :: initialMsg
|
||||
|
||||
val buffer = LineGap.goToIdx (low - 1111, buffer)
|
||||
val searchList =
|
||||
@@ -682,7 +682,7 @@ struct
|
||||
|
||||
val searchString = #searchString app
|
||||
val buffer = LineGap.goToStart buffer
|
||||
val initialMsg = SEARCH (buffer, searchString) :: initialMsg
|
||||
val initialMsg = SEARCH (buffer, searchString, time) :: initialMsg
|
||||
|
||||
val buffer = LineGap.goToIdx (low - 1111, buffer)
|
||||
val searchList =
|
||||
|
||||
@@ -39,7 +39,7 @@ struct
|
||||
val buffer = LineGap.insert (lineStart, indentString, buffer)
|
||||
|
||||
val buffer = LineGap.goToStart buffer
|
||||
val initialMsg = [SEARCH (buffer, searchString)]
|
||||
val initialMsg = [SEARCH (buffer, searchString, time)]
|
||||
in
|
||||
NormalDelete.finishAfterDeletingBuffer
|
||||
(app, cursorIdx, buffer, time, initialMsg)
|
||||
|
||||
@@ -45,13 +45,13 @@ struct
|
||||
end
|
||||
|
||||
(* save search string and tempSearchList and return to normal mode *)
|
||||
fun saveSearch (app: app_type, searchString, tempSearchList) =
|
||||
fun saveSearch (app: app_type, searchString, tempSearchList, time) =
|
||||
let
|
||||
val {buffer, cursorIdx, windowWidth, windowHeight, startLine, ...} = app
|
||||
|
||||
val buffer = LineGap.goToStart buffer
|
||||
val searchString = EscapeString.unescape searchString
|
||||
val initialMsg = [SEARCH (buffer, searchString)]
|
||||
val initialMsg = [SEARCH (buffer, searchString, time)]
|
||||
|
||||
(* move LineGap to first line displayed on screen *)
|
||||
val buffer = LineGap.goToLine (startLine, buffer)
|
||||
@@ -136,7 +136,7 @@ struct
|
||||
| KEY_BACKSPACE =>
|
||||
backspace (app, searchString, tempSearchList, searchCursorIdx)
|
||||
| KEY_ESC => exitToNormalMode app
|
||||
| KEY_ENTER => saveSearch (app, searchString, tempSearchList)
|
||||
| KEY_ENTER => saveSearch (app, searchString, tempSearchList, time)
|
||||
| ARROW_LEFT =>
|
||||
moveLeft (app, searchString, tempSearchList, searchCursorIdx)
|
||||
| ARROW_RIGHT =>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
structure MailboxType =
|
||||
struct datatype t = DRAW of DrawMsg.t | SEARCH of LineGap.t * string end
|
||||
struct datatype t = DRAW of DrawMsg.t | SEARCH of LineGap.t * string * Time.time end
|
||||
|
||||
@@ -5,7 +5,7 @@ struct
|
||||
(* Prerequisite to sending message: move buffer to end. *)
|
||||
fun loop (searchMailbox, inputMailbox) =
|
||||
let
|
||||
val (buffer, searchString) = Mailbox.recv searchMailbox
|
||||
val (buffer, searchString, time) = Mailbox.recv searchMailbox
|
||||
val searchList = SearchList.build (buffer, searchString)
|
||||
val () = Mailbox.send (inputMailbox, InputMsg.WITH_SEARCH_LIST searchList)
|
||||
in
|
||||
|
||||
@@ -7,8 +7,8 @@ struct
|
||||
fun sendMsg (msg, drawMailbox, searchMailbox) =
|
||||
case msg of
|
||||
DRAW msg => Mailbox.send (drawMailbox, msg)
|
||||
| SEARCH (buffer, searchString) =>
|
||||
Mailbox.send (searchMailbox, (buffer, searchString))
|
||||
| SEARCH (buffer, searchString, time) =>
|
||||
Mailbox.send (searchMailbox, (buffer, searchString, time))
|
||||
|
||||
fun sendMsgs (msgList, drawMailbox, searchMailbox) =
|
||||
case msgList of
|
||||
|
||||
Reference in New Issue
Block a user