add dfa field to app_type so that we don't rebuild DFA each time we want to execute a search again (like after deleting)

This commit is contained in:
2025-10-08 05:02:15 +01:00
parent 7f68084398
commit fd8385fa81
5 changed files with 27 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ struct
, cursorIdx: int
(* column to start drawing text at for horizontal scrolling. *)
, visualScrollColumn: int
, dfa: int vector vector
(* msgs to send after an update.
* The list of messages is reset on each invocation of AppUpdate.update. *)
, msgs: MailboxType.t list
@@ -40,6 +41,7 @@ struct
, startLine = 0
, cursorIdx = 0
, visualScrollColumn = 0
, dfa = Vector.fromList []
, msgs = []
}
end

View File

@@ -16,6 +16,7 @@ struct
, searchString
, startLine
, cursorIdx
, dfa
} = app
in
{ mode = newMode
@@ -29,6 +30,7 @@ struct
, searchString = searchString
, startLine = startLine
, cursorIdx = cursorIdx
, dfa = dfa
}
end
@@ -55,6 +57,7 @@ struct
, searchString
, startLine
, cursorIdx
, dfa
} = app
in
{ mode = mode
@@ -68,6 +71,7 @@ struct
, searchString = searchString
, startLine = startLine
, cursorIdx = cursorIdx
, dfa = dfa
}
end
@@ -95,6 +99,7 @@ struct
, searchString
, windowWidth
, windowHeight
, dfa
} = app
in
{ mode = newMode
@@ -108,6 +113,7 @@ struct
, searchString = searchString
, windowWidth = windowWidth
, windowHeight = windowHeight
, dfa = dfa
}
end
@@ -125,6 +131,7 @@ struct
, windowHeight
, startLine
, visualScrollColumn
, dfa
} = app
in
{ mode = newMode
@@ -138,6 +145,7 @@ struct
, windowHeight = windowHeight
, startLine = startLine
, visualScrollColumn = visualScrollColumn
, dfa = dfa
}
end
@@ -155,6 +163,7 @@ struct
, windowHeight
, startLine
, visualScrollColumn
, dfa
} = app
in
{ mode = newMode
@@ -168,10 +177,10 @@ struct
, windowHeight = windowHeight
, startLine = startLine
, visualScrollColumn = visualScrollColumn
, dfa = dfa
}
end
fun searchList
( app: app_type
, newSearchList
@@ -192,6 +201,7 @@ struct
, windowHeight
, startLine
, visualScrollColumn
, dfa
} = app
in
{ searchList = newSearchList
@@ -205,6 +215,7 @@ struct
, windowHeight = windowHeight
, startLine = startLine
, visualScrollColumn = visualScrollColumn
, dfa = dfa
}
end
end

View File

@@ -7,7 +7,7 @@ struct
fun switchToNormalSearchMode (app: app_type) =
NormalSearchFinish.onSearchChanged
(app, "", PersistentVector.empty, 0, 0, true, #buffer app)
(app, "", PersistentVector.empty, 0, 0, false, #buffer app)
fun getNumLength (pos, str) =
if pos = String.size str then

View File

@@ -9,6 +9,7 @@ struct
, newSearchList
, newStartLine
, newMode
, newDfa
, newMsgs
) =
let
@@ -19,6 +20,7 @@ struct
, searchList = _
, startLine = _
, msgs = _
, dfa = _
, bufferModifyTime
, windowWidth
, windowHeight
@@ -31,6 +33,7 @@ struct
, searchString = newSearchString
, searchList = newSearchList
, startLine = newStartLine
, dfa = newDfa
, bufferModifyTime = bufferModifyTime
, msgs = newMsgs
, windowWidth = windowWidth
@@ -55,6 +58,7 @@ struct
, windowHeight
, cursorIdx
, visualScrollColumn
, dfa
} = app
in
{ mode = newMode
@@ -68,6 +72,7 @@ struct
, windowHeight = windowHeight
, cursorIdx = cursorIdx
, visualScrollColumn = visualScrollColumn
, dfa = dfa
}
end
@@ -85,6 +90,7 @@ struct
, windowHeight
, cursorIdx
, visualScrollColumn
, dfa
} = app
in
{ mode = mode
@@ -98,6 +104,7 @@ struct
, windowHeight = windowHeight
, cursorIdx = cursorIdx
, visualScrollColumn = visualScrollColumn
, dfa = dfa
}
end
@@ -122,6 +129,7 @@ struct
, bufferModifyTime
, cursorIdx
, visualScrollColumn
, dfa
} = app
in
{ mode = newMode
@@ -135,6 +143,7 @@ struct
, bufferModifyTime = bufferModifyTime
, cursorIdx = cursorIdx
, visualScrollColumn = visualScrollColumn
, dfa = dfa
}
end
end

View File

@@ -93,9 +93,11 @@ struct
val msgs = DRAW drawMsg :: initialMsg
val mode = NORMAL_MODE ""
val dfa = raise Fail "todo"
in
NormalSearchModeWith.returnToNormalMode
(app, buffer, searchString, tempSearchList, startLine, mode, msgs)
(app, buffer, searchString, tempSearchList, startLine, mode, dfa, msgs)
end
fun backspace