formating

This commit is contained in:
2025-08-20 12:51:31 +01:00
parent c21d1b8205
commit c4f3e921a3
5 changed files with 127 additions and 26 deletions

View File

@@ -3,8 +3,14 @@ struct
open AppType
fun bufferAndSize
(app: app_type, newBuffer, newWidth, newHeight, newSearchList, newMsgs,
newBufferModifyTime) =
( app: app_type
, newBuffer
, newWidth
, newHeight
, newSearchList
, newMsgs
, newBufferModifyTime
) =
let
val
{ mode
@@ -97,7 +103,13 @@ struct
}
end
fun searchList (app: app_type, newSearchList, newBuffer, newSearchString, newBufferModifyTime) =
fun searchList
( app: app_type
, newSearchList
, newBuffer
, newSearchString
, newBufferModifyTime
) =
let
val
{ searchList = _

View File

@@ -9,8 +9,8 @@ struct
fun clearMode app =
AppWith.mode (app, NORMAL_MODE "", [])
fun buildTextAndClear (app: app_type, buffer, cursorIdx, searchList, msgs,
bufferModifyTime) =
fun buildTextAndClear
(app: app_type, buffer, cursorIdx, searchList, msgs, bufferModifyTime) =
let
val {windowWidth, windowHeight, startLine, searchString, ...} = app
@@ -38,15 +38,25 @@ struct
val mode = NORMAL_MODE ""
in
AppWith.bufferAndCursorIdx
(app, buffer, cursorIdx, mode, startLine, searchList, msgs, bufferModifyTime)
( app
, buffer
, cursorIdx
, mode
, startLine
, searchList
, msgs
, bufferModifyTime
)
end
fun withSearchList (app: app_type, searchList) =
let
val {buffer, searchString, cursorIdx, bufferModifyTime, ...} = app
val app = AppWith.searchList (app, searchList, buffer, searchString, bufferModifyTime)
val app = AppWith.searchList
(app, searchList, buffer, searchString, bufferModifyTime)
in
buildTextAndClear (app, buffer, cursorIdx, searchList, [], bufferModifyTime)
buildTextAndClear
(app, buffer, cursorIdx, searchList, [], bufferModifyTime)
end
fun resizeText (app: app_type, newWidth, newHeight) =
@@ -78,7 +88,14 @@ struct
)
in
AppWith.bufferAndSize
(app, newBuffer, newWidth, newHeight, searchList, drawMsg, bufferModifyTime)
( app
, newBuffer
, newWidth
, newHeight
, searchList
, drawMsg
, bufferModifyTime
)
end
(* Difference between this and buildTextAndClear is that
@@ -116,7 +133,15 @@ struct
val mode = NORMAL_MODE ""
in
AppWith.bufferAndCursorIdx
(app, buffer, cursorIdx, mode, startLine, searchList, drawMsg, bufferModifyTime)
( app
, buffer
, cursorIdx
, mode
, startLine
, searchList
, drawMsg
, bufferModifyTime
)
end
fun centreToCursor (app: app_type) =
@@ -152,6 +177,14 @@ struct
)
in
AppWith.bufferAndCursorIdx
(app, buffer, cursorIdx, NORMAL_MODE "", startLine, searchList, drawMsg, bufferModifyTime)
( app
, buffer
, cursorIdx
, NORMAL_MODE ""
, startLine
, searchList
, drawMsg
, bufferModifyTime
)
end
end

View File

@@ -15,8 +15,8 @@ struct
let
val {searchList, bufferModifyTime, ...} = app
in
Finish.buildTextAndClear (app, buffer, cursorIdx, searchList, [],
bufferModifyTime)
Finish.buildTextAndClear
(app, buffer, cursorIdx, searchList, [], bufferModifyTime)
end
else
(* move LineGap to cursorIdx, which is necessary for finding newCursorIdx *)
@@ -67,7 +67,8 @@ struct
val buffer = LineGap.goToIdx (cursorIdx, buffer)
val cursorIdx = Fn.fMove (buffer, cursorIdx, count)
in
Finish.buildTextAndClear (app, buffer, cursorIdx, searchList, [], bufferModifyTime)
Finish.buildTextAndClear
(app, buffer, cursorIdx, searchList, [], bufferModifyTime)
end
end

View File

@@ -4,9 +4,15 @@ struct
fun moveToStart (app: app_type) =
let
val {buffer, windowWidth, windowHeight, searchList, searchString,
bufferModifyTime, ...} =
app
val
{ buffer
, windowWidth
, windowHeight
, searchList
, searchString
, bufferModifyTime
, ...
} = app
val cursorIdx = 0
val startLine = 0
@@ -26,14 +32,28 @@ struct
val mode = NORMAL_MODE ""
in
AppWith.bufferAndCursorIdx
(app, buffer, cursorIdx, mode, startLine, searchList, drawMsg, bufferModifyTime)
( app
, buffer
, cursorIdx
, mode
, startLine
, searchList
, drawMsg
, bufferModifyTime
)
end
fun moveToEnd (app: app_type) =
let
val {buffer, windowWidth, windowHeight, searchList, searchString,
bufferModifyTime, ...} =
app
val
{ buffer
, windowWidth
, windowHeight
, searchList
, searchString
, bufferModifyTime
, ...
} = app
val buffer = LineGap.goToEnd buffer
val {line = bufferLine, idx = bufferIdx, ...} = buffer
@@ -68,7 +88,15 @@ struct
val mode = NORMAL_MODE ""
in
AppWith.bufferAndCursorIdx
(app, buffer, bufferIdx, mode, bufferLine, searchList, drawMsg, bufferModifyTime)
( app
, buffer
, bufferIdx
, mode
, bufferLine
, searchList
, drawMsg
, bufferModifyTime
)
end
fun moveToLine (app: app_type, reqLine) =
@@ -112,7 +140,15 @@ struct
val mode = NORMAL_MODE ""
in
AppWith.bufferAndCursorIdx
(app, buffer, cursorIdx, mode, startLine, searchList, drawMsg, bufferModifyTime)
( app
, buffer
, cursorIdx
, mode
, startLine
, searchList
, drawMsg
, bufferModifyTime
)
end
fun moveToMatchingPair (app: app_type) =
@@ -200,8 +236,16 @@ struct
fun firstNonSpaceChr (app: app_type) =
let
val {buffer, cursorIdx, windowWidth, windowHeight, startLine, searchList,
bufferModifyTime, ...} = app
val
{ buffer
, cursorIdx
, windowWidth
, windowHeight
, startLine
, searchList
, bufferModifyTime
, ...
} = app
(* move LineGap and buffer to start of line *)
val buffer = LineGap.goToIdx (cursorIdx, buffer)
@@ -211,7 +255,8 @@ struct
val buffer = LineGap.goToIdx (cursorIdx, buffer)
val cursorIdx = Cursor.firstNonSpaceChr (buffer, cursorIdx)
in
Finish.buildTextAndClear (app, buffer, cursorIdx, searchList, [], bufferModifyTime)
Finish.buildTextAndClear
(app, buffer, cursorIdx, searchList, [], bufferModifyTime)
end
fun helpMoveToChr (app: app_type, buffer, cursorIdx, count, fMove, chr) =

View File

@@ -17,6 +17,16 @@ fcore/app-type.sml
fcore/app-with.sml
fcore/text-constants.sml
ann
"allowVectorExps true"
in
fcore/rect.sml
fcore/text-builder.sml
fcore/cursor-dfa/make-dfa-loop.sml
fcore/cursor-dfa/vi-WORD-dfa.sml
fcore/cursor-dfa/vi-word-dfa.sml
fcore/cursor-dfa/vi-dlr-dfa.sml
end
fcore/cursor.sml
fcore/text-window.sml