move msgs into AppType.app_type, and refactor AppUpdate.update function to have type (app_type -> app_type) instead of pervious case which was (app_type -> app_type * MailboxType.t list). Reason: no need to allocate/return tuple when can store messages in type directly; previous msg list will be reset after each app update. All tests after refactor are passing.
This commit is contained in:
@@ -13,6 +13,10 @@ sig
|
|||||||
, startLine: int
|
, startLine: int
|
||||||
(* absolute index of movable cursor *)
|
(* absolute index of movable cursor *)
|
||||||
, cursorIdx: int
|
, cursorIdx: int
|
||||||
|
(* msgs to send after an update.
|
||||||
|
* The list of messages is reset on each invocation of AppUpdate.update. *)
|
||||||
|
, msgs: MailboxType.t list
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val init: LineGap.t * int * int -> app_type
|
val init: LineGap.t * int * int -> app_type
|
||||||
@@ -33,6 +37,9 @@ struct
|
|||||||
, startLine: int
|
, startLine: int
|
||||||
(* absolute index of movable cursor *)
|
(* absolute index of movable cursor *)
|
||||||
, cursorIdx: int
|
, cursorIdx: int
|
||||||
|
(* msgs to send after an update.
|
||||||
|
* The list of messages is reset on each invocation of AppUpdate.update. *)
|
||||||
|
, msgs: MailboxType.t list
|
||||||
}
|
}
|
||||||
|
|
||||||
fun init (buffer, windowWidth, windowHeight) : app_type =
|
fun init (buffer, windowWidth, windowHeight) : app_type =
|
||||||
@@ -44,5 +51,6 @@ struct
|
|||||||
, windowHeight = windowHeight
|
, windowHeight = windowHeight
|
||||||
, startLine = 0
|
, startLine = 0
|
||||||
, cursorIdx = 0
|
, cursorIdx = 0
|
||||||
|
, msgs = []
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,12 +7,7 @@ struct
|
|||||||
open InputMsg
|
open InputMsg
|
||||||
|
|
||||||
fun clearMode app =
|
fun clearMode app =
|
||||||
let
|
AppWith.mode (app, NORMAL_MODE "", [])
|
||||||
val mode = NORMAL_MODE ""
|
|
||||||
val newApp = AppWith.mode (app, mode)
|
|
||||||
in
|
|
||||||
(newApp, [])
|
|
||||||
end
|
|
||||||
|
|
||||||
fun resizeText (app: app_type, newWidth, newHeight) =
|
fun resizeText (app: app_type, newWidth, newHeight) =
|
||||||
let
|
let
|
||||||
@@ -40,11 +35,9 @@ struct
|
|||||||
, searchList
|
, searchList
|
||||||
, searchString
|
, searchString
|
||||||
)
|
)
|
||||||
|
|
||||||
val newApp =
|
|
||||||
AppWith.bufferAndSize (app, newBuffer, newWidth, newHeight, searchList)
|
|
||||||
in
|
in
|
||||||
(newApp, drawMsg)
|
AppWith.bufferAndSize
|
||||||
|
(app, newBuffer, newWidth, newHeight, searchList, drawMsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun buildTextAndClear (app: app_type, buffer, cursorIdx, searchList) =
|
fun buildTextAndClear (app: app_type, buffer, cursorIdx, searchList) =
|
||||||
@@ -75,10 +68,9 @@ struct
|
|||||||
)
|
)
|
||||||
|
|
||||||
val mode = NORMAL_MODE ""
|
val mode = NORMAL_MODE ""
|
||||||
val newApp = AppWith.bufferAndCursorIdx
|
|
||||||
(app, buffer, cursorIdx, mode, startLine, searchList)
|
|
||||||
in
|
in
|
||||||
(newApp, drawMsg)
|
AppWith.bufferAndCursorIdx
|
||||||
|
(app, buffer, cursorIdx, mode, startLine, searchList, drawMsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
(* Difference between this and buildTextAndClear is that
|
(* Difference between this and buildTextAndClear is that
|
||||||
@@ -114,10 +106,9 @@ struct
|
|||||||
)
|
)
|
||||||
|
|
||||||
val mode = NORMAL_MODE ""
|
val mode = NORMAL_MODE ""
|
||||||
val newApp = AppWith.bufferAndCursorIdx
|
|
||||||
(app, buffer, cursorIdx, mode, startLine, searchList)
|
|
||||||
in
|
in
|
||||||
(newApp, drawMsg)
|
AppWith.bufferAndCursorIdx
|
||||||
|
(app, buffer, cursorIdx, mode, startLine, searchList, drawMsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun centreToCursor (app: app_type) =
|
fun centreToCursor (app: app_type) =
|
||||||
@@ -141,9 +132,6 @@ struct
|
|||||||
val lineIdx = TextBuilder.getLineAbsIdx (startLine, buffer)
|
val lineIdx = TextBuilder.getLineAbsIdx (startLine, buffer)
|
||||||
val searchList = SearchList.goToNum (lineIdx, searchList)
|
val searchList = SearchList.goToNum (lineIdx, searchList)
|
||||||
|
|
||||||
val newApp = AppWith.bufferAndCursorIdx
|
|
||||||
(app, buffer, cursorIdx, NORMAL_MODE "", startLine, searchList)
|
|
||||||
|
|
||||||
val drawMsg = TextBuilder.build
|
val drawMsg = TextBuilder.build
|
||||||
( startLine
|
( startLine
|
||||||
, cursorIdx
|
, cursorIdx
|
||||||
@@ -154,7 +142,8 @@ struct
|
|||||||
, searchString
|
, searchString
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
(newApp, drawMsg)
|
AppWith.bufferAndCursorIdx
|
||||||
|
(app, buffer, cursorIdx, NORMAL_MODE "", startLine, searchList, drawMsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
(* movement functions *)
|
(* movement functions *)
|
||||||
@@ -180,10 +169,9 @@ struct
|
|||||||
)
|
)
|
||||||
|
|
||||||
val mode = NORMAL_MODE ""
|
val mode = NORMAL_MODE ""
|
||||||
val newApp = AppWith.bufferAndCursorIdx
|
|
||||||
(app, buffer, cursorIdx, mode, startLine, searchList)
|
|
||||||
in
|
in
|
||||||
(newApp, drawMsg)
|
AppWith.bufferAndCursorIdx
|
||||||
|
(app, buffer, cursorIdx, mode, startLine, searchList, drawMsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun moveToEnd (app: app_type) =
|
fun moveToEnd (app: app_type) =
|
||||||
@@ -222,10 +210,9 @@ struct
|
|||||||
)
|
)
|
||||||
|
|
||||||
val mode = NORMAL_MODE ""
|
val mode = NORMAL_MODE ""
|
||||||
val newApp = AppWith.bufferAndCursorIdx
|
|
||||||
(app, buffer, bufferIdx, mode, bufferLine, searchList)
|
|
||||||
in
|
in
|
||||||
(newApp, drawMsg)
|
AppWith.bufferAndCursorIdx
|
||||||
|
(app, buffer, bufferIdx, mode, bufferLine, searchList, drawMsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun moveToLine (app: app_type, reqLine) =
|
fun moveToLine (app: app_type, reqLine) =
|
||||||
@@ -255,9 +242,6 @@ struct
|
|||||||
val lineIdx = TextBuilder.getLineAbsIdx (startLine, buffer)
|
val lineIdx = TextBuilder.getLineAbsIdx (startLine, buffer)
|
||||||
val searchList = SearchList.goToNum (lineIdx, searchList)
|
val searchList = SearchList.goToNum (lineIdx, searchList)
|
||||||
|
|
||||||
val newApp = AppWith.bufferAndCursorIdx
|
|
||||||
(app, buffer, cursorIdx, NORMAL_MODE "", startLine, searchList)
|
|
||||||
|
|
||||||
val drawMsg = TextBuilder.build
|
val drawMsg = TextBuilder.build
|
||||||
( startLine
|
( startLine
|
||||||
, cursorIdx
|
, cursorIdx
|
||||||
@@ -267,8 +251,11 @@ struct
|
|||||||
, searchList
|
, searchList
|
||||||
, searchString
|
, searchString
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val mode = NORMAL_MODE ""
|
||||||
in
|
in
|
||||||
(newApp, drawMsg)
|
AppWith.bufferAndCursorIdx
|
||||||
|
(app, buffer, cursorIdx, mode, startLine, searchList, drawMsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun helpMove (app: app_type, buffer, cursorIdx, count, fMove) =
|
fun helpMove (app: app_type, buffer, cursorIdx, count, fMove) =
|
||||||
@@ -324,9 +311,6 @@ struct
|
|||||||
then
|
then
|
||||||
(* if visible, just need to redraw; no need to get line *)
|
(* if visible, just need to redraw; no need to get line *)
|
||||||
let
|
let
|
||||||
val newApp = AppWith.bufferAndCursorIdx
|
|
||||||
(app, buffer, cursorIdx, NORMAL_MODE "", startLine, searchList)
|
|
||||||
|
|
||||||
val drawMsg = TextBuilder.build
|
val drawMsg = TextBuilder.build
|
||||||
( startLine
|
( startLine
|
||||||
, cursorIdx
|
, cursorIdx
|
||||||
@@ -337,7 +321,15 @@ struct
|
|||||||
, searchString
|
, searchString
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
(newApp, drawMsg)
|
AppWith.bufferAndCursorIdx
|
||||||
|
( app
|
||||||
|
, buffer
|
||||||
|
, cursorIdx
|
||||||
|
, NORMAL_MODE ""
|
||||||
|
, startLine
|
||||||
|
, searchList
|
||||||
|
, drawMsg
|
||||||
|
)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(* not visible, so need to get startLine where cursor is visible *)
|
(* not visible, so need to get startLine where cursor is visible *)
|
||||||
@@ -350,9 +342,6 @@ struct
|
|||||||
val lineIdx = TextBuilder.getLineAbsIdx (startLine, buffer)
|
val lineIdx = TextBuilder.getLineAbsIdx (startLine, buffer)
|
||||||
val searchList = SearchList.goToNum (lineIdx, searchList)
|
val searchList = SearchList.goToNum (lineIdx, searchList)
|
||||||
|
|
||||||
val newApp = AppWith.bufferAndCursorIdx
|
|
||||||
(app, buffer, cursorIdx, NORMAL_MODE "", startLine, searchList)
|
|
||||||
|
|
||||||
val drawMsg = TextBuilder.build
|
val drawMsg = TextBuilder.build
|
||||||
( startLine
|
( startLine
|
||||||
, cursorIdx
|
, cursorIdx
|
||||||
@@ -363,7 +352,15 @@ struct
|
|||||||
, searchString
|
, searchString
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
(newApp, drawMsg)
|
AppWith.bufferAndCursorIdx
|
||||||
|
( app
|
||||||
|
, buffer
|
||||||
|
, cursorIdx
|
||||||
|
, NORMAL_MODE ""
|
||||||
|
, startLine
|
||||||
|
, searchList
|
||||||
|
, drawMsg
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -735,10 +732,9 @@ struct
|
|||||||
)
|
)
|
||||||
|
|
||||||
val mode = NORMAL_MODE ""
|
val mode = NORMAL_MODE ""
|
||||||
val newApp = AppWith.bufferAndCursorIdx
|
|
||||||
(app, buffer, cursorIdx, mode, startLine, searchList)
|
|
||||||
in
|
in
|
||||||
(newApp, drawMsg)
|
AppWith.bufferAndCursorIdx
|
||||||
|
(app, buffer, cursorIdx, mode, startLine, searchList, drawMsg)
|
||||||
end
|
end
|
||||||
|
|
||||||
(* command-parsing functions *)
|
(* command-parsing functions *)
|
||||||
@@ -755,9 +751,8 @@ struct
|
|||||||
let
|
let
|
||||||
val str = str ^ Char.toString chr
|
val str = str ^ Char.toString chr
|
||||||
val mode = NORMAL_MODE str
|
val mode = NORMAL_MODE str
|
||||||
val newApp = AppWith.mode (app, mode)
|
|
||||||
in
|
in
|
||||||
(newApp, [])
|
AppWith.mode (app, mode, [])
|
||||||
end
|
end
|
||||||
|
|
||||||
fun handleChr (app: app_type, count, chr, str) =
|
fun handleChr (app: app_type, count, chr, str) =
|
||||||
@@ -791,9 +786,8 @@ struct
|
|||||||
val chr = Char.toString chr
|
val chr = Char.toString chr
|
||||||
val str = str ^ chr
|
val str = str ^ chr
|
||||||
val mode = NORMAL_MODE str
|
val mode = NORMAL_MODE str
|
||||||
val newApp = AppWith.mode (app, mode)
|
|
||||||
in
|
in
|
||||||
(newApp, [])
|
AppWith.mode (app, mode, [])
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
move (app, 1, Cursor.vi0)
|
move (app, 1, Cursor.vi0)
|
||||||
@@ -826,9 +820,8 @@ struct
|
|||||||
let
|
let
|
||||||
val str = if Char.isDigit chr then str ^ Char.toString chr else ""
|
val str = if Char.isDigit chr then str ^ Char.toString chr else ""
|
||||||
val mode = NORMAL_MODE str
|
val mode = NORMAL_MODE str
|
||||||
val newApp = AppWith.mode (app, mode)
|
|
||||||
in
|
in
|
||||||
(newApp, [])
|
AppWith.mode (app, mode, [])
|
||||||
end
|
end
|
||||||
|
|
||||||
fun parseDelete (strPos, str, count, app, newCmd) =
|
fun parseDelete (strPos, str, count, app, newCmd) =
|
||||||
|
|||||||
@@ -2,32 +2,8 @@ structure AppWith =
|
|||||||
struct
|
struct
|
||||||
open AppType
|
open AppType
|
||||||
|
|
||||||
fun startLine (app: app_type, startLine, newBuffer) =
|
|
||||||
let
|
|
||||||
val
|
|
||||||
{ startLine = _
|
|
||||||
, buffer = _
|
|
||||||
, searchList
|
|
||||||
, searchString
|
|
||||||
, mode
|
|
||||||
, windowWidth
|
|
||||||
, windowHeight
|
|
||||||
, cursorIdx
|
|
||||||
} = app
|
|
||||||
in
|
|
||||||
{ startLine = startLine
|
|
||||||
, buffer = newBuffer
|
|
||||||
, searchList = searchList
|
|
||||||
, searchString = searchString
|
|
||||||
, mode = mode
|
|
||||||
, windowWidth = windowWidth
|
|
||||||
, windowHeight = windowHeight
|
|
||||||
, cursorIdx = cursorIdx
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
fun bufferAndSize
|
fun bufferAndSize
|
||||||
(app: app_type, newBuffer, newWidth, newHeight, newSearchList) =
|
(app: app_type, newBuffer, newWidth, newHeight, newSearchList, newMsgs) =
|
||||||
let
|
let
|
||||||
val
|
val
|
||||||
{ mode
|
{ mode
|
||||||
@@ -35,6 +11,7 @@ struct
|
|||||||
, windowWidth = _
|
, windowWidth = _
|
||||||
, windowHeight = _
|
, windowHeight = _
|
||||||
, searchList = _
|
, searchList = _
|
||||||
|
, msgs = _
|
||||||
, searchString
|
, searchString
|
||||||
, startLine
|
, startLine
|
||||||
, cursorIdx
|
, cursorIdx
|
||||||
@@ -45,6 +22,7 @@ struct
|
|||||||
, windowWidth = newWidth
|
, windowWidth = newWidth
|
||||||
, windowHeight = newHeight
|
, windowHeight = newHeight
|
||||||
, searchList = newSearchList
|
, searchList = newSearchList
|
||||||
|
, msgs = newMsgs
|
||||||
, searchString = searchString
|
, searchString = searchString
|
||||||
, startLine = startLine
|
, startLine = startLine
|
||||||
, cursorIdx = cursorIdx
|
, cursorIdx = cursorIdx
|
||||||
@@ -58,6 +36,7 @@ struct
|
|||||||
, newMode
|
, newMode
|
||||||
, newStartLine
|
, newStartLine
|
||||||
, newSearchList
|
, newSearchList
|
||||||
|
, newMsgs
|
||||||
) =
|
) =
|
||||||
let
|
let
|
||||||
val
|
val
|
||||||
@@ -66,6 +45,7 @@ struct
|
|||||||
, cursorIdx = _
|
, cursorIdx = _
|
||||||
, startLine = _
|
, startLine = _
|
||||||
, searchList = _
|
, searchList = _
|
||||||
|
, msgs = _
|
||||||
, searchString
|
, searchString
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
@@ -76,16 +56,18 @@ struct
|
|||||||
, cursorIdx = newCursorIdx
|
, cursorIdx = newCursorIdx
|
||||||
, startLine = newStartLine
|
, startLine = newStartLine
|
||||||
, searchList = newSearchList
|
, searchList = newSearchList
|
||||||
|
, msgs = newMsgs
|
||||||
, searchString = searchString
|
, searchString = searchString
|
||||||
, windowWidth = windowWidth
|
, windowWidth = windowWidth
|
||||||
, windowHeight = windowHeight
|
, windowHeight = windowHeight
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
fun mode (app: app_type, newMode) =
|
fun mode (app: app_type, newMode, newMsgs) =
|
||||||
let
|
let
|
||||||
val
|
val
|
||||||
{ mode = _
|
{ mode = _
|
||||||
|
, msgs = _
|
||||||
, buffer
|
, buffer
|
||||||
, searchList
|
, searchList
|
||||||
, searchString
|
, searchString
|
||||||
@@ -96,6 +78,7 @@ struct
|
|||||||
} = app
|
} = app
|
||||||
in
|
in
|
||||||
{ mode = newMode
|
{ mode = newMode
|
||||||
|
, msgs = newMsgs
|
||||||
, buffer = buffer
|
, buffer = buffer
|
||||||
, searchList = searchList
|
, searchList = searchList
|
||||||
, searchString = searchString
|
, searchString = searchString
|
||||||
@@ -112,6 +95,7 @@ struct
|
|||||||
{ searchList = _
|
{ searchList = _
|
||||||
, buffer = _
|
, buffer = _
|
||||||
, searchString = _
|
, searchString = _
|
||||||
|
, msgs
|
||||||
, mode
|
, mode
|
||||||
, cursorIdx
|
, cursorIdx
|
||||||
, windowWidth
|
, windowWidth
|
||||||
@@ -122,6 +106,7 @@ struct
|
|||||||
{ searchList = newSearchList
|
{ searchList = newSearchList
|
||||||
, buffer = newBuffer
|
, buffer = newBuffer
|
||||||
, searchString = newSearchString
|
, searchString = newSearchString
|
||||||
|
, msgs = msgs
|
||||||
, mode = mode
|
, mode = mode
|
||||||
, cursorIdx = cursorIdx
|
, cursorIdx = cursorIdx
|
||||||
, windowWidth = windowWidth
|
, windowWidth = windowWidth
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ struct
|
|||||||
val buffer = LineGap.goToIdx (origIdx, buffer)
|
val buffer = LineGap.goToIdx (origIdx, buffer)
|
||||||
val searchList = SearchList.goToNum (origIdx, searchList)
|
val searchList = SearchList.goToNum (origIdx, searchList)
|
||||||
in
|
in
|
||||||
|
(* todo: probably change return type to (buffer * searchList) later *)
|
||||||
AppWith.searchList (app, searchList, buffer, searchString)
|
AppWith.searchList (app, searchList, buffer, searchString)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ struct
|
|||||||
fun loop (app: AppType.app_type, inputMailbox, drawMailbox) =
|
fun loop (app: AppType.app_type, inputMailbox, drawMailbox) =
|
||||||
let
|
let
|
||||||
val inputMsg = Mailbox.recv inputMailbox
|
val inputMsg = Mailbox.recv inputMailbox
|
||||||
val (app, msgList) = AppUpdate.update (app, inputMsg)
|
val app = AppUpdate.update (app, inputMsg)
|
||||||
val _ = sendMsgs (msgList, drawMailbox)
|
val () = sendMsgs (#msgs app, drawMailbox)
|
||||||
in
|
in
|
||||||
loop (app, inputMailbox, drawMailbox)
|
loop (app, inputMailbox, drawMailbox)
|
||||||
end
|
end
|
||||||
|
|||||||
265
test/test.sml
265
test/test.sml
@@ -53,6 +53,7 @@ fun withIdx (app: AppType.app_type, idx) =
|
|||||||
, mode
|
, mode
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
|
, msgs
|
||||||
, cursorIdx = _
|
, cursorIdx = _
|
||||||
} = app
|
} = app
|
||||||
in
|
in
|
||||||
@@ -63,6 +64,7 @@ fun withIdx (app: AppType.app_type, idx) =
|
|||||||
, mode = mode
|
, mode = mode
|
||||||
, windowWidth = windowWidth
|
, windowWidth = windowWidth
|
||||||
, windowHeight = windowHeight
|
, windowHeight = windowHeight
|
||||||
|
, msgs = msgs
|
||||||
, cursorIdx = idx
|
, cursorIdx = idx
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -85,7 +87,7 @@ val hMove = describe "move motion 'h'"
|
|||||||
val app = withIdx (app, 1)
|
val app = withIdx (app, 1)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"h")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"h")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 0)
|
Expect.isTrue (cursorIdx = 0)
|
||||||
@@ -98,7 +100,7 @@ val hMove = describe "move motion 'h'"
|
|||||||
val app = withIdx (app, 5)
|
val app = withIdx (app, 5)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"h")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"h")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 4)
|
Expect.isTrue (cursorIdx = 4)
|
||||||
@@ -111,7 +113,7 @@ val hMove = describe "move motion 'h'"
|
|||||||
val {cursorIdx = oldCursorIdx, ...} = app
|
val {cursorIdx = oldCursorIdx, ...} = app
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"h")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"h")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (oldCursorIdx = 0 andalso cursorIdx = 0)
|
Expect.isTrue (oldCursorIdx = 0 andalso cursorIdx = 0)
|
||||||
@@ -125,7 +127,7 @@ val hMove = describe "move motion 'h'"
|
|||||||
val app = withIdx (app, 6)
|
val app = withIdx (app, 6)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"h")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"h")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 4)
|
Expect.isTrue (cursorIdx = 4)
|
||||||
@@ -139,7 +141,7 @@ val hMove = describe "move motion 'h'"
|
|||||||
val app = withIdx (app, 6)
|
val app = withIdx (app, 6)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"h")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"h")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 4)
|
Expect.isTrue (cursorIdx = 4)
|
||||||
@@ -157,7 +159,7 @@ val lMove = describe "move motion 'l'"
|
|||||||
val {cursorIdx = oldCursorIdx, ...} = app
|
val {cursorIdx = oldCursorIdx, ...} = app
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"l")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"l")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (oldCursorIdx = 0 andalso cursorIdx = 1)
|
Expect.isTrue (oldCursorIdx = 0 andalso cursorIdx = 1)
|
||||||
@@ -171,7 +173,7 @@ val lMove = describe "move motion 'l'"
|
|||||||
val {cursorIdx = oldCursorIdx, ...} = app
|
val {cursorIdx = oldCursorIdx, ...} = app
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"l")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"l")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (oldCursorIdx = 0 andalso cursorIdx = 1)
|
Expect.isTrue (oldCursorIdx = 0 andalso cursorIdx = 1)
|
||||||
@@ -184,7 +186,7 @@ val lMove = describe "move motion 'l'"
|
|||||||
val app = withIdx (app, 10)
|
val app = withIdx (app, 10)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"l")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"l")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 10)
|
Expect.isTrue (cursorIdx = 10)
|
||||||
@@ -198,7 +200,7 @@ val lMove = describe "move motion 'l'"
|
|||||||
val app = withIdx (app, 4)
|
val app = withIdx (app, 4)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"l")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"l")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 6)
|
Expect.isTrue (cursorIdx = 6)
|
||||||
@@ -212,7 +214,7 @@ val lMove = describe "move motion 'l'"
|
|||||||
val app = withIdx (app, 4)
|
val app = withIdx (app, 4)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"l")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"l")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 6)
|
Expect.isTrue (cursorIdx = 6)
|
||||||
@@ -231,9 +233,9 @@ val jMove = describe "move motion 'j'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app1, _) = AppUpdate.update (app, CHAR_EVENT #"j")
|
val app1 = AppUpdate.update (app, CHAR_EVENT #"j")
|
||||||
val (app2, _) = AppUpdate.update (app1, CHAR_EVENT #"j")
|
val app2 = AppUpdate.update (app1, CHAR_EVENT #"j")
|
||||||
val (app3, _) = AppUpdate.update (app2, CHAR_EVENT #"j")
|
val app3 = AppUpdate.update (app2, CHAR_EVENT #"j")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val c1 = getChr app1 = #"w"
|
val c1 = getChr app1 = #"w"
|
||||||
@@ -249,9 +251,9 @@ val jMove = describe "move motion 'j'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app1, _) = AppUpdate.update (app, CHAR_EVENT #"j")
|
val app1 = AppUpdate.update (app, CHAR_EVENT #"j")
|
||||||
val (app2, _) = AppUpdate.update (app1, CHAR_EVENT #"j")
|
val app2 = AppUpdate.update (app1, CHAR_EVENT #"j")
|
||||||
val (app3, _) = AppUpdate.update (app2, CHAR_EVENT #"j")
|
val app3 = AppUpdate.update (app2, CHAR_EVENT #"j")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val c1 = getChr app1 = #"w"
|
val c1 = getChr app1 = #"w"
|
||||||
@@ -269,9 +271,9 @@ val jMove = describe "move motion 'j'"
|
|||||||
val app = withIdx (app, 1)
|
val app = withIdx (app, 1)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app1, _) = AppUpdate.update (app, CHAR_EVENT #"j")
|
val app1 = AppUpdate.update (app, CHAR_EVENT #"j")
|
||||||
val (app2, _) = AppUpdate.update (app1, CHAR_EVENT #"j")
|
val app2 = AppUpdate.update (app1, CHAR_EVENT #"j")
|
||||||
val (app3, _) = AppUpdate.update (app2, CHAR_EVENT #"j")
|
val app3 = AppUpdate.update (app2, CHAR_EVENT #"j")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val c1 = getChr app1 = #"o"
|
val c1 = getChr app1 = #"o"
|
||||||
@@ -288,9 +290,9 @@ val jMove = describe "move motion 'j'"
|
|||||||
val app = withIdx (app, 1)
|
val app = withIdx (app, 1)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app1, _) = AppUpdate.update (app, CHAR_EVENT #"j")
|
val app1 = AppUpdate.update (app, CHAR_EVENT #"j")
|
||||||
val (app2, _) = AppUpdate.update (app1, CHAR_EVENT #"j")
|
val app2 = AppUpdate.update (app1, CHAR_EVENT #"j")
|
||||||
val (app3, _) = AppUpdate.update (app2, CHAR_EVENT #"j")
|
val app3 = AppUpdate.update (app2, CHAR_EVENT #"j")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val c1 = getChr app1 = #"o"
|
val c1 = getChr app1 = #"o"
|
||||||
@@ -308,9 +310,9 @@ val jMove = describe "move motion 'j'"
|
|||||||
val app = withIdx (app, 2)
|
val app = withIdx (app, 2)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app1, _) = AppUpdate.update (app, CHAR_EVENT #"j")
|
val app1 = AppUpdate.update (app, CHAR_EVENT #"j")
|
||||||
val (app2, _) = AppUpdate.update (app1, CHAR_EVENT #"j")
|
val app2 = AppUpdate.update (app1, CHAR_EVENT #"j")
|
||||||
val (app3, _) = AppUpdate.update (app2, CHAR_EVENT #"j")
|
val app3 = AppUpdate.update (app2, CHAR_EVENT #"j")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val c1 = getChr app1 = #"r"
|
val c1 = getChr app1 = #"r"
|
||||||
@@ -327,9 +329,9 @@ val jMove = describe "move motion 'j'"
|
|||||||
val app = withIdx (app, 2)
|
val app = withIdx (app, 2)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app1, _) = AppUpdate.update (app, CHAR_EVENT #"j")
|
val app1 = AppUpdate.update (app, CHAR_EVENT #"j")
|
||||||
val (app2, _) = AppUpdate.update (app1, CHAR_EVENT #"j")
|
val app2 = AppUpdate.update (app1, CHAR_EVENT #"j")
|
||||||
val (app3, _) = AppUpdate.update (app2, CHAR_EVENT #"j")
|
val app3 = AppUpdate.update (app2, CHAR_EVENT #"j")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val c1 = getChr app1 = #"r"
|
val c1 = getChr app1 = #"r"
|
||||||
@@ -346,7 +348,7 @@ val jMove = describe "move motion 'j'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"j")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"j")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val isSkipped = cursorIdx = 6
|
val isSkipped = cursorIdx = 6
|
||||||
@@ -362,7 +364,7 @@ val jMove = describe "move motion 'j'"
|
|||||||
val app = withIdx (app, 15)
|
val app = withIdx (app, 15)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"j")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"j")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
(* String.size str - 1 is a valid char position
|
(* String.size str - 1 is a valid char position
|
||||||
@@ -383,7 +385,7 @@ val jMove = describe "move motion 'j'"
|
|||||||
val app = withIdx (app, len)
|
val app = withIdx (app, len)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"j")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"j")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
(* String.size str - 1 is a valid char position
|
(* String.size str - 1 is a valid char position
|
||||||
@@ -406,9 +408,9 @@ val kMove = describe "move motion 'k'"
|
|||||||
val app = withIdx (app, 14)
|
val app = withIdx (app, 14)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app1, _) = AppUpdate.update (app, CHAR_EVENT #"k")
|
val app1 = AppUpdate.update (app, CHAR_EVENT #"k")
|
||||||
val (app2, _) = AppUpdate.update (app1, CHAR_EVENT #"k")
|
val app2 = AppUpdate.update (app1, CHAR_EVENT #"k")
|
||||||
val (app3, _) = AppUpdate.update (app2, CHAR_EVENT #"k")
|
val app3 = AppUpdate.update (app2, CHAR_EVENT #"k")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val c1 = getChr app1 = #"9"
|
val c1 = getChr app1 = #"9"
|
||||||
@@ -425,9 +427,9 @@ val kMove = describe "move motion 'k'"
|
|||||||
val app = withIdx (app, 14)
|
val app = withIdx (app, 14)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app1, _) = AppUpdate.update (app, CHAR_EVENT #"k")
|
val app1 = AppUpdate.update (app, CHAR_EVENT #"k")
|
||||||
val (app2, _) = AppUpdate.update (app1, CHAR_EVENT #"k")
|
val app2 = AppUpdate.update (app1, CHAR_EVENT #"k")
|
||||||
val (app3, _) = AppUpdate.update (app2, CHAR_EVENT #"k")
|
val app3 = AppUpdate.update (app2, CHAR_EVENT #"k")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val c1 = getChr app1 = #"9"
|
val c1 = getChr app1 = #"9"
|
||||||
@@ -445,9 +447,9 @@ val kMove = describe "move motion 'k'"
|
|||||||
val app = withIdx (app, 15)
|
val app = withIdx (app, 15)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app1, _) = AppUpdate.update (app, CHAR_EVENT #"k")
|
val app1 = AppUpdate.update (app, CHAR_EVENT #"k")
|
||||||
val (app2, _) = AppUpdate.update (app1, CHAR_EVENT #"k")
|
val app2 = AppUpdate.update (app1, CHAR_EVENT #"k")
|
||||||
val (app3, _) = AppUpdate.update (app2, CHAR_EVENT #"k")
|
val app3 = AppUpdate.update (app2, CHAR_EVENT #"k")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val c1 = getChr app1 = #"1"
|
val c1 = getChr app1 = #"1"
|
||||||
@@ -464,9 +466,9 @@ val kMove = describe "move motion 'k'"
|
|||||||
val app = withIdx (app, 15)
|
val app = withIdx (app, 15)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app1, _) = AppUpdate.update (app, CHAR_EVENT #"k")
|
val app1 = AppUpdate.update (app, CHAR_EVENT #"k")
|
||||||
val (app2, _) = AppUpdate.update (app1, CHAR_EVENT #"k")
|
val app2 = AppUpdate.update (app1, CHAR_EVENT #"k")
|
||||||
val (app3, _) = AppUpdate.update (app2, CHAR_EVENT #"k")
|
val app3 = AppUpdate.update (app2, CHAR_EVENT #"k")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val c1 = getChr app1 = #"1"
|
val c1 = getChr app1 = #"1"
|
||||||
@@ -484,9 +486,9 @@ val kMove = describe "move motion 'k'"
|
|||||||
val app = withIdx (app, 15)
|
val app = withIdx (app, 15)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app1, _) = AppUpdate.update (app, CHAR_EVENT #"k")
|
val app1 = AppUpdate.update (app, CHAR_EVENT #"k")
|
||||||
val (app2, _) = AppUpdate.update (app1, CHAR_EVENT #"k")
|
val app2 = AppUpdate.update (app1, CHAR_EVENT #"k")
|
||||||
val (app3, _) = AppUpdate.update (app2, CHAR_EVENT #"k")
|
val app3 = AppUpdate.update (app2, CHAR_EVENT #"k")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val c1 = getChr app1 = #"1"
|
val c1 = getChr app1 = #"1"
|
||||||
@@ -503,9 +505,9 @@ val kMove = describe "move motion 'k'"
|
|||||||
val app = withIdx (app, 15)
|
val app = withIdx (app, 15)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app1, _) = AppUpdate.update (app, CHAR_EVENT #"k")
|
val app1 = AppUpdate.update (app, CHAR_EVENT #"k")
|
||||||
val (app2, _) = AppUpdate.update (app1, CHAR_EVENT #"k")
|
val app2 = AppUpdate.update (app1, CHAR_EVENT #"k")
|
||||||
val (app3, _) = AppUpdate.update (app2, CHAR_EVENT #"k")
|
val app3 = AppUpdate.update (app2, CHAR_EVENT #"k")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val c1 = getChr app1 = #"1"
|
val c1 = getChr app1 = #"1"
|
||||||
@@ -525,7 +527,7 @@ val kMove = describe "move motion 'k'"
|
|||||||
val app = withIdx (app, 6)
|
val app = withIdx (app, 6)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"k")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"k")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val isSkipped = cursorIdx = 0
|
val isSkipped = cursorIdx = 0
|
||||||
@@ -541,7 +543,7 @@ val kMove = describe "move motion 'k'"
|
|||||||
val app = withIdx (app, 5)
|
val app = withIdx (app, 5)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"k")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"k")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val isAtStart = cursorIdx = 0
|
val isAtStart = cursorIdx = 0
|
||||||
@@ -558,7 +560,7 @@ val kMove = describe "move motion 'k'"
|
|||||||
val app = withIdx (app, 0)
|
val app = withIdx (app, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"k")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"k")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
(* String.size str - 1 is a valid char position
|
(* String.size str - 1 is a valid char position
|
||||||
@@ -579,7 +581,7 @@ val wMove = describe "move motion 'w'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"w")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"w")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val chr = String.sub ("hello world", cursorIdx)
|
val chr = String.sub ("hello world", cursorIdx)
|
||||||
@@ -593,7 +595,7 @@ val wMove = describe "move motion 'w'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"w")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"w")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val chr = String.sub ("hello world", cursorIdx)
|
val chr = String.sub ("hello world", cursorIdx)
|
||||||
@@ -614,7 +616,7 @@ val wMove = describe "move motion 'w'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"w")
|
val app = AppUpdate.update (app, CHAR_EVENT #"w")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -636,7 +638,7 @@ val wMove = describe "move motion 'w'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"w")
|
val app = AppUpdate.update (app, CHAR_EVENT #"w")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -651,7 +653,7 @@ val wMove = describe "move motion 'w'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"w")
|
val app = AppUpdate.update (app, CHAR_EVENT #"w")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -666,7 +668,7 @@ val wMove = describe "move motion 'w'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"w")
|
val app = AppUpdate.update (app, CHAR_EVENT #"w")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -681,7 +683,7 @@ val wMove = describe "move motion 'w'"
|
|||||||
val app = withIdx (app, 4)
|
val app = withIdx (app, 4)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"w")
|
val app = AppUpdate.update (app, CHAR_EVENT #"w")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -695,7 +697,7 @@ val wMove = describe "move motion 'w'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app1, _) = AppUpdate.update (app, CHAR_EVENT #"w")
|
val app1 = AppUpdate.update (app, CHAR_EVENT #"w")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val startsAtExc = getChr app = #"!"
|
val startsAtExc = getChr app = #"!"
|
||||||
@@ -711,7 +713,7 @@ val wMove = describe "move motion 'w'"
|
|||||||
val app = withIdx (app, 6)
|
val app = withIdx (app, 6)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"w")
|
val app = AppUpdate.update (app, CHAR_EVENT #"w")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val chrIsEnd = getChr app = #"d"
|
val chrIsEnd = getChr app = #"d"
|
||||||
@@ -728,7 +730,7 @@ val WMove = describe "move motion 'W'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"W")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"W")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val chr = String.sub ("hello world", cursorIdx)
|
val chr = String.sub ("hello world", cursorIdx)
|
||||||
@@ -742,7 +744,7 @@ val WMove = describe "move motion 'W'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"W")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"W")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val chr = String.sub ("hello world", cursorIdx)
|
val chr = String.sub ("hello world", cursorIdx)
|
||||||
@@ -756,7 +758,7 @@ val WMove = describe "move motion 'W'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"W")
|
val app = AppUpdate.update (app, CHAR_EVENT #"W")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -772,7 +774,7 @@ val WMove = describe "move motion 'W'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"W")
|
val app = AppUpdate.update (app, CHAR_EVENT #"W")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -788,7 +790,7 @@ val WMove = describe "move motion 'W'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"W")
|
val app = AppUpdate.update (app, CHAR_EVENT #"W")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -803,7 +805,7 @@ val WMove = describe "move motion 'W'"
|
|||||||
val app = withIdx (app, 4)
|
val app = withIdx (app, 4)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"w")
|
val app = AppUpdate.update (app, CHAR_EVENT #"w")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -818,7 +820,7 @@ val WMove = describe "move motion 'W'"
|
|||||||
val app = withIdx (app, 6)
|
val app = withIdx (app, 6)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"w")
|
val app = AppUpdate.update (app, CHAR_EVENT #"w")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val chrIsEnd = getChr app = #"d"
|
val chrIsEnd = getChr app = #"d"
|
||||||
@@ -839,7 +841,7 @@ val eMove = describe "move motion 'e'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"e")
|
val app = AppUpdate.update (app, CHAR_EVENT #"e")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"o")
|
Expect.isTrue (getChr app = #"o")
|
||||||
@@ -855,7 +857,7 @@ val eMove = describe "move motion 'e'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"e")
|
val app = AppUpdate.update (app, CHAR_EVENT #"e")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"o")
|
Expect.isTrue (getChr app = #"o")
|
||||||
@@ -871,7 +873,7 @@ val eMove = describe "move motion 'e'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"e")
|
val app = AppUpdate.update (app, CHAR_EVENT #"e")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"^")
|
Expect.isTrue (getChr app = #"^")
|
||||||
@@ -887,7 +889,7 @@ val eMove = describe "move motion 'e'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"e")
|
val app = AppUpdate.update (app, CHAR_EVENT #"e")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"^")
|
Expect.isTrue (getChr app = #"^")
|
||||||
@@ -903,7 +905,7 @@ val eMove = describe "move motion 'e'"
|
|||||||
val app = withIdx (app, 4)
|
val app = withIdx (app, 4)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"e")
|
val app = AppUpdate.update (app, CHAR_EVENT #"e")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"d")
|
Expect.isTrue (getChr app = #"d")
|
||||||
@@ -916,7 +918,7 @@ val eMove = describe "move motion 'e'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"e")
|
val app = AppUpdate.update (app, CHAR_EVENT #"e")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -930,7 +932,7 @@ val eMove = describe "move motion 'e'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"e")
|
val app = AppUpdate.update (app, CHAR_EVENT #"e")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -945,7 +947,7 @@ val eMove = describe "move motion 'e'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"e")
|
val app = AppUpdate.update (app, CHAR_EVENT #"e")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -960,7 +962,7 @@ val eMove = describe "move motion 'e'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"e")
|
val app = AppUpdate.update (app, CHAR_EVENT #"e")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -975,7 +977,7 @@ val eMove = describe "move motion 'e'"
|
|||||||
val app = withIdx (app, 4)
|
val app = withIdx (app, 4)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"e")
|
val app = AppUpdate.update (app, CHAR_EVENT #"e")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -992,7 +994,7 @@ val eMove = describe "move motion 'e'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"e")
|
val app = AppUpdate.update (app, CHAR_EVENT #"e")
|
||||||
val newIdx = #cursorIdx app
|
val newIdx = #cursorIdx app
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
@@ -1006,7 +1008,7 @@ val eMove = describe "move motion 'e'"
|
|||||||
val app = withIdx (app, 7)
|
val app = withIdx (app, 7)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"e")
|
val app = AppUpdate.update (app, CHAR_EVENT #"e")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val chrIsEnd = getChr app = #"d"
|
val chrIsEnd = getChr app = #"d"
|
||||||
@@ -1023,7 +1025,7 @@ val EMove = describe "move motion 'E'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"E")
|
val app = AppUpdate.update (app, CHAR_EVENT #"E")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"o")
|
Expect.isTrue (getChr app = #"o")
|
||||||
@@ -1035,7 +1037,7 @@ val EMove = describe "move motion 'E'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"E")
|
val app = AppUpdate.update (app, CHAR_EVENT #"E")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"o")
|
Expect.isTrue (getChr app = #"o")
|
||||||
@@ -1051,7 +1053,7 @@ val EMove = describe "move motion 'E'"
|
|||||||
val app = withIdx (app, 4)
|
val app = withIdx (app, 4)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"E")
|
val app = AppUpdate.update (app, CHAR_EVENT #"E")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"$")
|
Expect.isTrue (getChr app = #"$")
|
||||||
@@ -1064,7 +1066,7 @@ val EMove = describe "move motion 'E'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"E")
|
val app = AppUpdate.update (app, CHAR_EVENT #"E")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -1079,7 +1081,7 @@ val EMove = describe "move motion 'E'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"E")
|
val app = AppUpdate.update (app, CHAR_EVENT #"E")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -1094,7 +1096,7 @@ val EMove = describe "move motion 'E'"
|
|||||||
val app = withIdx (app, 4)
|
val app = withIdx (app, 4)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"E")
|
val app = AppUpdate.update (app, CHAR_EVENT #"E")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val cursorChr = getChr app
|
val cursorChr = getChr app
|
||||||
@@ -1109,7 +1111,7 @@ val EMove = describe "move motion 'E'"
|
|||||||
val app = withIdx (app, 7)
|
val app = withIdx (app, 7)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"E")
|
val app = AppUpdate.update (app, CHAR_EVENT #"E")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"!")
|
Expect.isTrue (getChr app = #"!")
|
||||||
@@ -1124,7 +1126,7 @@ val bMove = describe "move motion 'b'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"b")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"b")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 0)
|
Expect.isTrue (cursorIdx = 0)
|
||||||
@@ -1138,7 +1140,7 @@ val bMove = describe "move motion 'b'"
|
|||||||
val app = withIdx (app, 3)
|
val app = withIdx (app, 3)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"b")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"b")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 0)
|
Expect.isTrue (cursorIdx = 0)
|
||||||
@@ -1154,7 +1156,7 @@ val bMove = describe "move motion 'b'"
|
|||||||
val app = withIdx (app, 7)
|
val app = withIdx (app, 7)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"b")
|
val app = AppUpdate.update (app, CHAR_EVENT #"b")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"h")
|
Expect.isTrue (getChr app = #"h")
|
||||||
@@ -1170,7 +1172,7 @@ val bMove = describe "move motion 'b'"
|
|||||||
val app = withIdx (app, 7)
|
val app = withIdx (app, 7)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"b")
|
val app = AppUpdate.update (app, CHAR_EVENT #"b")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"h")
|
Expect.isTrue (getChr app = #"h")
|
||||||
@@ -1186,7 +1188,7 @@ val bMove = describe "move motion 'b'"
|
|||||||
val app = withIdx (app, 7)
|
val app = withIdx (app, 7)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"b")
|
val app = AppUpdate.update (app, CHAR_EVENT #"b")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"!")
|
Expect.isTrue (getChr app = #"!")
|
||||||
@@ -1202,7 +1204,7 @@ val bMove = describe "move motion 'b'"
|
|||||||
val app = withIdx (app, 7)
|
val app = withIdx (app, 7)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"b")
|
val app = AppUpdate.update (app, CHAR_EVENT #"b")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"!")
|
Expect.isTrue (getChr app = #"!")
|
||||||
@@ -1217,7 +1219,7 @@ val BMove = describe "move motion 'B'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"B")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"B")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 0)
|
Expect.isTrue (cursorIdx = 0)
|
||||||
@@ -1231,7 +1233,7 @@ val BMove = describe "move motion 'B'"
|
|||||||
val app = withIdx (app, 3)
|
val app = withIdx (app, 3)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"B")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"B")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 0)
|
Expect.isTrue (cursorIdx = 0)
|
||||||
@@ -1247,7 +1249,7 @@ val BMove = describe "move motion 'B'"
|
|||||||
val app = withIdx (app, 7)
|
val app = withIdx (app, 7)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"B")
|
val app = AppUpdate.update (app, CHAR_EVENT #"B")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"h")
|
Expect.isTrue (getChr app = #"h")
|
||||||
@@ -1263,7 +1265,7 @@ val BMove = describe "move motion 'B'"
|
|||||||
val app = withIdx (app, 3)
|
val app = withIdx (app, 3)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"B")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"B")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 0)
|
Expect.isTrue (cursorIdx = 0)
|
||||||
@@ -1279,7 +1281,7 @@ val BMove = describe "move motion 'B'"
|
|||||||
val app = withIdx (app, 7)
|
val app = withIdx (app, 7)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"B")
|
val app = AppUpdate.update (app, CHAR_EVENT #"B")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"!")
|
Expect.isTrue (getChr app = #"!")
|
||||||
@@ -1292,7 +1294,7 @@ val BMove = describe "move motion 'B'"
|
|||||||
val app = withIdx (app, 17)
|
val app = withIdx (app, 17)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"B")
|
val app = AppUpdate.update (app, CHAR_EVENT #"B")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"!")
|
Expect.isTrue (getChr app = #"!")
|
||||||
@@ -1308,7 +1310,7 @@ val BMove = describe "move motion 'B'"
|
|||||||
val app = withIdx (app, 11)
|
val app = withIdx (app, 11)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"B")
|
val app = AppUpdate.update (app, CHAR_EVENT #"B")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"a")
|
Expect.isTrue (getChr app = #"a")
|
||||||
@@ -1325,7 +1327,7 @@ val zeroMove = describe "move motion '0'"
|
|||||||
val app = withIdx (app, 7)
|
val app = withIdx (app, 7)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"0")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"0")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 0)
|
Expect.isTrue (cursorIdx = 0)
|
||||||
@@ -1338,7 +1340,7 @@ val zeroMove = describe "move motion '0'"
|
|||||||
val app = withIdx (app, 7)
|
val app = withIdx (app, 7)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"0")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"0")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 0)
|
Expect.isTrue (cursorIdx = 0)
|
||||||
@@ -1350,7 +1352,7 @@ val zeroMove = describe "move motion '0'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"0")
|
val {cursorIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"0")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (cursorIdx = 0)
|
Expect.isTrue (cursorIdx = 0)
|
||||||
@@ -1365,8 +1367,7 @@ val zeroMove = describe "move motion '0'"
|
|||||||
val {cursorIdx = oldIdx, ...} = app
|
val {cursorIdx = oldIdx, ...} = app
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val ({cursorIdx = newIdx, ...}, _) =
|
val {cursorIdx = newIdx, ...} = AppUpdate.update (app, CHAR_EVENT #"0")
|
||||||
AppUpdate.update (app, CHAR_EVENT #"0")
|
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (oldIdx = newIdx)
|
Expect.isTrue (oldIdx = newIdx)
|
||||||
@@ -1382,7 +1383,7 @@ val zeroMove = describe "move motion '0'"
|
|||||||
val app = withIdx (app, 21)
|
val app = withIdx (app, 21)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"0")
|
val app = AppUpdate.update (app, CHAR_EVENT #"0")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val chr = getChr app
|
val chr = getChr app
|
||||||
@@ -1403,7 +1404,7 @@ val zeroMove = describe "move motion '0'"
|
|||||||
val app = withIdx (app, 21)
|
val app = withIdx (app, 21)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"0")
|
val app = AppUpdate.update (app, CHAR_EVENT #"0")
|
||||||
|
|
||||||
(* assert *)
|
(* assert *)
|
||||||
val chr = getChr app
|
val chr = getChr app
|
||||||
@@ -1421,7 +1422,7 @@ val dlrMove = describe "move motion '$'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"$")
|
val app = AppUpdate.update (app, CHAR_EVENT #"$")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"9")
|
Expect.isTrue (getChr app = #"9")
|
||||||
@@ -1433,7 +1434,7 @@ val dlrMove = describe "move motion '$'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"$")
|
val app = AppUpdate.update (app, CHAR_EVENT #"$")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"9")
|
Expect.isTrue (getChr app = #"9")
|
||||||
@@ -1450,7 +1451,7 @@ val dlrMove = describe "move motion '$'"
|
|||||||
val oldIdx = #cursorIdx app
|
val oldIdx = #cursorIdx app
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"$")
|
val app = AppUpdate.update (app, CHAR_EVENT #"$")
|
||||||
val newIdx = #cursorIdx app
|
val newIdx = #cursorIdx app
|
||||||
|
|
||||||
val nchr = getChr app
|
val nchr = getChr app
|
||||||
@@ -1471,7 +1472,7 @@ val dlrMove = describe "move motion '$'"
|
|||||||
val oldIdx = #cursorIdx app
|
val oldIdx = #cursorIdx app
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"$")
|
val app = AppUpdate.update (app, CHAR_EVENT #"$")
|
||||||
val newIdx = #cursorIdx app
|
val newIdx = #cursorIdx app
|
||||||
|
|
||||||
val nchr = getChr app
|
val nchr = getChr app
|
||||||
@@ -1494,7 +1495,7 @@ val caretMove = describe "move motion '^'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"^")
|
val app = AppUpdate.update (app, CHAR_EVENT #"^")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"3")
|
Expect.isTrue (getChr app = #"3")
|
||||||
@@ -1511,7 +1512,7 @@ val caretMove = describe "move motion '^'"
|
|||||||
val app = withIdx (app, 7)
|
val app = withIdx (app, 7)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"^")
|
val app = AppUpdate.update (app, CHAR_EVENT #"^")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"3")
|
Expect.isTrue (getChr app = #"3")
|
||||||
@@ -1528,7 +1529,7 @@ val caretMove = describe "move motion '^'"
|
|||||||
val app = withIdx (app, 7)
|
val app = withIdx (app, 7)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"^")
|
val app = AppUpdate.update (app, CHAR_EVENT #"^")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"w")
|
Expect.isTrue (getChr app = #"w")
|
||||||
@@ -1545,7 +1546,7 @@ val caretMove = describe "move motion '^'"
|
|||||||
val app = withIdx (app, 11)
|
val app = withIdx (app, 11)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"^")
|
val app = AppUpdate.update (app, CHAR_EVENT #"^")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"w")
|
Expect.isTrue (getChr app = #"w")
|
||||||
@@ -1559,7 +1560,7 @@ val caretMove = describe "move motion '^'"
|
|||||||
val oldIdx = #cursorIdx app
|
val oldIdx = #cursorIdx app
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"^")
|
val app = AppUpdate.update (app, CHAR_EVENT #"^")
|
||||||
val newIdx = #cursorIdx app
|
val newIdx = #cursorIdx app
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
@@ -1580,7 +1581,7 @@ val GMove = describe "move motion 'G'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"G")
|
val app = AppUpdate.update (app, CHAR_EVENT #"G")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"9")
|
Expect.isTrue (getChr app = #"9")
|
||||||
@@ -1594,7 +1595,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #")")
|
Expect.isTrue (getChr app = #")")
|
||||||
@@ -1607,7 +1608,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = withIdx (app, 6)
|
val app = withIdx (app, 6)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"(")
|
Expect.isTrue (getChr app = #"(")
|
||||||
@@ -1620,7 +1621,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
val newIdx = #cursorIdx app
|
val newIdx = #cursorIdx app
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
@@ -1634,7 +1635,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = withIdx (app, 10)
|
val app = withIdx (app, 10)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
val newIdx = #cursorIdx app
|
val newIdx = #cursorIdx app
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
@@ -1648,7 +1649,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = withIdx (app, 1)
|
val app = withIdx (app, 1)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
val newIdx = #cursorIdx app
|
val newIdx = #cursorIdx app
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
@@ -1662,7 +1663,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = withIdx (app, 9)
|
val app = withIdx (app, 9)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
val newIdx = #cursorIdx app
|
val newIdx = #cursorIdx app
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
@@ -1676,7 +1677,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = withIdx (app, 2)
|
val app = withIdx (app, 2)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
val newIdx = #cursorIdx app
|
val newIdx = #cursorIdx app
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
@@ -1690,7 +1691,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = withIdx (app, 8)
|
val app = withIdx (app, 8)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
val newIdx = #cursorIdx app
|
val newIdx = #cursorIdx app
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
@@ -1704,7 +1705,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"]")
|
Expect.isTrue (getChr app = #"]")
|
||||||
@@ -1717,7 +1718,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = withIdx (app, 6)
|
val app = withIdx (app, 6)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"[")
|
Expect.isTrue (getChr app = #"[")
|
||||||
@@ -1729,7 +1730,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"}")
|
Expect.isTrue (getChr app = #"}")
|
||||||
@@ -1742,7 +1743,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = withIdx (app, 6)
|
val app = withIdx (app, 6)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"{")
|
Expect.isTrue (getChr app = #"{")
|
||||||
@@ -1754,7 +1755,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = AppType.init (buffer, 0, 0)
|
val app = AppType.init (buffer, 0, 0)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #">")
|
Expect.isTrue (getChr app = #">")
|
||||||
@@ -1767,7 +1768,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val app = withIdx (app, 6)
|
val app = withIdx (app, 6)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
Expect.isTrue (getChr app = #"<")
|
Expect.isTrue (getChr app = #"<")
|
||||||
@@ -1782,7 +1783,7 @@ val percentMove = describe "move motion '%'"
|
|||||||
val oldIdx = #cursorIdx app
|
val oldIdx = #cursorIdx app
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val (app, _) = AppUpdate.update (app, CHAR_EVENT #"%")
|
val app = AppUpdate.update (app, CHAR_EVENT #"%")
|
||||||
val newIdx = #cursorIdx app
|
val newIdx = #cursorIdx app
|
||||||
in
|
in
|
||||||
(* assert *)
|
(* assert *)
|
||||||
|
|||||||
Reference in New Issue
Block a user