a few bug fixes to NORMAL_SEARCH_MODE: the main one is that we were passing the general searchString to the resize function before, and we were drawing the wrong string because of that; another bug fix is that, on resizing, we have to update the mode to contain the recalculated searchScrollColumn
This commit is contained in:
@@ -82,23 +82,30 @@ struct
|
||||
( app: app_type
|
||||
, newWindowWidth
|
||||
, newWindowHeight
|
||||
, searchString
|
||||
, searchCursorIdx
|
||||
, tempSearchList
|
||||
, searchScrollColumn
|
||||
) =
|
||||
let
|
||||
val
|
||||
{ buffer
|
||||
, cursorIdx
|
||||
, startLine = prevLineNumber
|
||||
, searchString
|
||||
, visualScrollColumn
|
||||
, ...
|
||||
} = app
|
||||
{buffer, cursorIdx, startLine = prevLineNumber, visualScrollColumn, ...} =
|
||||
app
|
||||
|
||||
val floatWindowWidth = Real32.fromInt newWindowWidth
|
||||
val floatWindowHeight = Real32.fromInt newWindowHeight
|
||||
|
||||
val searchScrollColumn =
|
||||
TextScroll.getScrollColumnFromString
|
||||
(searchCursorIdx, newWindowWidth, searchScrollColumn)
|
||||
|
||||
val mode = NORMAL_SEARCH_MODE
|
||||
{ searchString = searchString
|
||||
, tempSearchList = tempSearchList
|
||||
, searchCursorIdx = searchCursorIdx
|
||||
, searchScrollColumn = searchScrollColumn
|
||||
}
|
||||
|
||||
val searchStringPosY = newWindowHeight - TextConstants.ySpace - 5
|
||||
|
||||
val initialTextAcc = SearchBar.build
|
||||
@@ -112,28 +119,6 @@ struct
|
||||
, searchScrollColumn
|
||||
)
|
||||
|
||||
val cursor =
|
||||
let
|
||||
val xpos = TextConstants.xSpace * (searchCursorIdx + 1) + 5
|
||||
val x = Real32.fromInt xpos
|
||||
val y = Real32.fromInt searchStringPosY
|
||||
val r: Real32.real = 0.67
|
||||
val g: Real32.real = 0.51
|
||||
val b: Real32.real = 0.83
|
||||
in
|
||||
PipeCursor.lerp
|
||||
( x
|
||||
, y
|
||||
, 0.01
|
||||
, TextConstants.scale
|
||||
, floatWindowWidth
|
||||
, floatWindowHeight
|
||||
, r
|
||||
, g
|
||||
, b
|
||||
)
|
||||
end
|
||||
|
||||
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||
val cursorLine = LineGap.getLineNumberOfIdx (cursorIdx, buffer)
|
||||
val startLine =
|
||||
@@ -153,13 +138,13 @@ struct
|
||||
, tempSearchList
|
||||
, searchString
|
||||
, visualScrollColumn
|
||||
, cursor :: initialTextAcc
|
||||
, initialTextAcc
|
||||
)
|
||||
val drawMsg = Vector.concat drawMsg
|
||||
val drawMsg = DrawMsg.DRAW_TEXT drawMsg
|
||||
val msgs = [MailboxType.DRAW drawMsg]
|
||||
in
|
||||
NormalSearchModeWith.bufferAndSize
|
||||
(app, buffer, newWindowWidth, newWindowHeight, msgs)
|
||||
(app, mode, buffer, newWindowWidth, newWindowHeight, msgs)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -102,10 +102,16 @@ struct
|
||||
end
|
||||
|
||||
fun bufferAndSize
|
||||
(app: app_type, newBuffer, newWindowWidth, newWindowHeight, newMsgs) =
|
||||
( app: app_type
|
||||
, newMode
|
||||
, newBuffer
|
||||
, newWindowWidth
|
||||
, newWindowHeight
|
||||
, newMsgs
|
||||
) =
|
||||
let
|
||||
val
|
||||
{ mode
|
||||
{ mode = _
|
||||
, windowWidth = _
|
||||
, windowHeight = _
|
||||
, msgs = _
|
||||
@@ -118,7 +124,7 @@ struct
|
||||
, visualScrollColumn
|
||||
} = app
|
||||
in
|
||||
{ mode = mode
|
||||
{ mode = newMode
|
||||
, buffer = newBuffer
|
||||
, windowWidth = newWindowWidth
|
||||
, windowHeight = newWindowHeight
|
||||
|
||||
@@ -213,6 +213,7 @@ struct
|
||||
( app
|
||||
, width
|
||||
, height
|
||||
, searchString
|
||||
, searchCursorIdx
|
||||
, tempSearchList
|
||||
, searchScrollColumn
|
||||
|
||||
Reference in New Issue
Block a user