add search list to app type

This commit is contained in:
2024-11-14 08:12:27 +00:00
parent 91663a6cae
commit cae9f19787
5 changed files with 37 additions and 10 deletions

View File

@@ -1,11 +1,12 @@
signature APP_TYPE = signature APP_TYPE =
sig sig
datatype mode = datatype mode = NORMAL_MODE of string
NORMAL_MODE of string
type app_type = type app_type =
{ mode: mode { mode: mode
, buffer: LineGap.t , buffer: LineGap.t
, searchList: SearchList.t
, searchString: string
, windowWidth: int , windowWidth: int
, windowHeight: int , windowHeight: int
(* line to start drawing from *) (* line to start drawing from *)
@@ -19,12 +20,13 @@ end
structure AppType :> APP_TYPE = structure AppType :> APP_TYPE =
struct struct
datatype mode = datatype mode = NORMAL_MODE of string
NORMAL_MODE of string
type app_type = type app_type =
{ mode: mode { mode: mode
, buffer: LineGap.t , buffer: LineGap.t
, searchList: SearchList.t
, searchString: string
, windowWidth: int , windowWidth: int
, windowHeight: int , windowHeight: int
(* line to start drawing from *) (* line to start drawing from *)
@@ -36,6 +38,8 @@ struct
fun init (buffer, windowWidth, windowHeight) : app_type = fun init (buffer, windowWidth, windowHeight) : app_type =
{ mode = NORMAL_MODE "" { mode = NORMAL_MODE ""
, buffer = buffer , buffer = buffer
, searchList = SearchList.empty
, searchString = ""
, windowWidth = windowWidth , windowWidth = windowWidth
, windowHeight = windowHeight , windowHeight = windowHeight
, startLine = 0 , startLine = 0

View File

@@ -7,6 +7,8 @@ struct
val val
{ startLine = _ { startLine = _
, buffer = _ , buffer = _
, searchList
, searchString
, mode , mode
, windowWidth , windowWidth
, windowHeight , windowHeight
@@ -15,6 +17,8 @@ struct
in in
{ startLine = startLine { startLine = startLine
, buffer = newBuffer , buffer = newBuffer
, searchList = searchList
, searchString = searchString
, mode = mode , mode = mode
, windowWidth = windowWidth , windowWidth = windowWidth
, windowHeight = windowHeight , windowHeight = windowHeight
@@ -29,6 +33,8 @@ struct
, buffer = _ , buffer = _
, windowWidth = _ , windowWidth = _
, windowHeight = _ , windowHeight = _
, searchList
, searchString
, startLine , startLine
, cursorIdx , cursorIdx
} = app } = app
@@ -37,6 +43,8 @@ struct
, buffer = newBuffer , buffer = newBuffer
, windowWidth = newWidth , windowWidth = newWidth
, windowHeight = newHeight , windowHeight = newHeight
, searchList = searchList
, searchString = searchString
, startLine = startLine , startLine = startLine
, cursorIdx = cursorIdx , cursorIdx = cursorIdx
} }
@@ -49,15 +57,19 @@ struct
{ mode = _ { mode = _
, buffer = _ , buffer = _
, cursorIdx = _ , cursorIdx = _
, startLine = _
, searchList
, searchString
, windowWidth , windowWidth
, windowHeight , windowHeight
, startLine = _
} = app } = app
in in
{ mode = newMode { mode = newMode
, buffer = newBuffer , buffer = newBuffer
, cursorIdx = newCursorIdx , cursorIdx = newCursorIdx
, startLine = newStartLine , startLine = newStartLine
, searchList = searchList
, searchString = searchString
, windowWidth = windowWidth , windowWidth = windowWidth
, windowHeight = windowHeight , windowHeight = windowHeight
} }
@@ -65,11 +77,21 @@ struct
fun mode (app: app_type, newMode) = fun mode (app: app_type, newMode) =
let let
val {mode = _, buffer, cursorIdx, windowWidth, windowHeight, startLine} = val
app { mode = _
, buffer
, searchList
, searchString
, cursorIdx
, windowWidth
, windowHeight
, startLine
} = app
in in
{ mode = newMode { mode = newMode
, buffer = buffer , buffer = buffer
, searchList = searchList
, searchString = searchString
, cursorIdx = cursorIdx , cursorIdx = cursorIdx
, windowWidth = windowWidth , windowWidth = windowWidth
, windowHeight = windowHeight , windowHeight = windowHeight

View File

@@ -7,7 +7,7 @@ sig
val mapFromNum: int * int * t -> t val mapFromNum: int * int * t -> t
end end
structure SearchList = structure SearchList :> SEARCH_LIST =
struct struct
type t = {left: int vector list, right: int vector list} type t = {left: int vector list, right: int vector list}

BIN
shf

Binary file not shown.

View File

@@ -9,11 +9,12 @@ message-types/input-msg.sml
message-types/draw-msg.sml message-types/draw-msg.sml
message-types/mailbox-type.sml message-types/mailbox-type.sml
fcore/bin-search.sml
fcore/search-list.sml
fcore/app-type.sml fcore/app-type.sml
fcore/app-with.sml fcore/app-with.sml
fcore/bin-search.sml
fcore/search-list.sml
fcore/text-constants.sml fcore/text-constants.sml
ann ann
"allowVectorExps true" "allowVectorExps true"