fix bug when saving search from NORMAL_SEARCH_MODE. Previously, when pressing <Enter> to save the search, the tempSearchList (which searches against a subset of the buffer's text instead of all of it, to ensure we do not spend too much time was spent while the user was entering the regex/search string) was being saved instead of the newly built searchList (which executes the DFA against all of the text)
This commit is contained in:
@@ -63,9 +63,8 @@ struct
|
|||||||
(app, buffer, cursorIdx, searchList, [], bufferModifyTime)
|
(app, buffer, cursorIdx, searchList, [], bufferModifyTime)
|
||||||
end
|
end
|
||||||
|
|
||||||
(* save search string and tempSearchList and return to normal mode *)
|
(* save search string and searchList and return to normal mode *)
|
||||||
fun saveSearch
|
fun saveSearch (app: app_type, searchString, caseSensitive, time) =
|
||||||
(app: app_type, searchString, tempSearchList, caseSensitive, time) =
|
|
||||||
let
|
let
|
||||||
val
|
val
|
||||||
{ buffer
|
{ buffer
|
||||||
@@ -82,7 +81,7 @@ struct
|
|||||||
else CaseInsensitiveDfa.fromString searchString
|
else CaseInsensitiveDfa.fromString searchString
|
||||||
|
|
||||||
val buffer = LineGap.goToStart buffer
|
val buffer = LineGap.goToStart buffer
|
||||||
val searchList = SearchList.build (buffer, dfa)
|
val (buffer, searchList) = SearchList.build (buffer, dfa)
|
||||||
|
|
||||||
(* 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)
|
||||||
@@ -96,7 +95,7 @@ struct
|
|||||||
, buffer
|
, buffer
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
, tempSearchList
|
, searchList
|
||||||
, visualScrollColumn
|
, visualScrollColumn
|
||||||
)
|
)
|
||||||
val drawMsg = Vector.concat drawMsg
|
val drawMsg = Vector.concat drawMsg
|
||||||
@@ -106,7 +105,7 @@ struct
|
|||||||
val mode = NORMAL_MODE ""
|
val mode = NORMAL_MODE ""
|
||||||
in
|
in
|
||||||
NormalSearchModeWith.returnToNormalMode
|
NormalSearchModeWith.returnToNormalMode
|
||||||
(app, buffer, tempSearchList, startLine, mode, dfa, msgs)
|
(app, buffer, searchList, startLine, mode, dfa, msgs)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun backspace
|
fun backspace
|
||||||
@@ -233,8 +232,7 @@ struct
|
|||||||
, caseSensitive
|
, caseSensitive
|
||||||
)
|
)
|
||||||
| KEY_ESC => exitToNormalMode app
|
| KEY_ESC => exitToNormalMode app
|
||||||
| KEY_ENTER =>
|
| KEY_ENTER => saveSearch (app, searchString, caseSensitive, time)
|
||||||
saveSearch (app, searchString, tempSearchList, caseSensitive, time)
|
|
||||||
| ARROW_LEFT =>
|
| ARROW_LEFT =>
|
||||||
moveLeft
|
moveLeft
|
||||||
( app
|
( app
|
||||||
|
|||||||
Reference in New Issue
Block a user