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