add horizontal scrolling functionality to SearchBar
This commit is contained in:
@@ -46,6 +46,7 @@ struct
|
|||||||
, floatWindowWidth
|
, floatWindowWidth
|
||||||
, floatWindowHeight
|
, floatWindowHeight
|
||||||
, searchCursorIdx
|
, searchCursorIdx
|
||||||
|
, searchScrollColumn
|
||||||
)
|
)
|
||||||
|
|
||||||
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||||
@@ -83,6 +84,7 @@ struct
|
|||||||
, newWindowHeight
|
, newWindowHeight
|
||||||
, searchCursorIdx
|
, searchCursorIdx
|
||||||
, tempSearchList
|
, tempSearchList
|
||||||
|
, searchScrollColumn
|
||||||
) =
|
) =
|
||||||
let
|
let
|
||||||
val
|
val
|
||||||
@@ -107,6 +109,7 @@ struct
|
|||||||
, floatWindowWidth
|
, floatWindowWidth
|
||||||
, floatWindowHeight
|
, floatWindowHeight
|
||||||
, searchCursorIdx
|
, searchCursorIdx
|
||||||
|
, searchScrollColumn
|
||||||
)
|
)
|
||||||
|
|
||||||
val cursor =
|
val cursor =
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ struct
|
|||||||
app
|
app
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
val searchCursorIdx = searchCursorIdx - 1
|
val searchCursorIdx = Int.max (0, searchCursorIdx - 1)
|
||||||
in
|
in
|
||||||
NormalSearchFinish.onSearchChanged
|
NormalSearchFinish.onSearchChanged
|
||||||
( app
|
( app
|
||||||
@@ -158,7 +158,8 @@ struct
|
|||||||
app
|
app
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
val searchCursorIdx = searchCursorIdx + 1
|
val searchCursorIdx =
|
||||||
|
Int.min (searchCursorIdx + 1, String.size searchString)
|
||||||
in
|
in
|
||||||
NormalSearchFinish.onSearchChanged
|
NormalSearchFinish.onSearchChanged
|
||||||
( app
|
( app
|
||||||
@@ -209,7 +210,13 @@ struct
|
|||||||
NormalFinish.withSearchList (app, searchList, time)
|
NormalFinish.withSearchList (app, searchList, time)
|
||||||
| RESIZE_EVENT (width, height) =>
|
| RESIZE_EVENT (width, height) =>
|
||||||
NormalSearchFinish.resize
|
NormalSearchFinish.resize
|
||||||
(app, width, height, searchCursorIdx, tempSearchList)
|
( app
|
||||||
|
, width
|
||||||
|
, height
|
||||||
|
, searchCursorIdx
|
||||||
|
, tempSearchList
|
||||||
|
, searchScrollColumn
|
||||||
|
)
|
||||||
|
|
||||||
(* In Vim's search mode, the up and down arrows can be used
|
(* In Vim's search mode, the up and down arrows can be used
|
||||||
* to scroll through the search history.
|
* to scroll through the search history.
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ struct
|
|||||||
, floatWindowWidth
|
, floatWindowWidth
|
||||||
, floatWindowHeight
|
, floatWindowHeight
|
||||||
, searchCursorIdx
|
, searchCursorIdx
|
||||||
|
, searchScrollColumn
|
||||||
) =
|
) =
|
||||||
let
|
let
|
||||||
val r: Real32.real = 0.67
|
val r: Real32.real = 0.67
|
||||||
@@ -95,7 +96,8 @@ struct
|
|||||||
|
|
||||||
val cursor =
|
val cursor =
|
||||||
let
|
let
|
||||||
val xpos = TextConstants.xSpace * (searchCursorIdx + 1) + startX
|
val xpos = (searchCursorIdx + 1) - searchScrollColumn
|
||||||
|
val xpos = TextConstants.xSpace * xpos + startX
|
||||||
val xpos = Int.min (endX, xpos)
|
val xpos = Int.min (endX, xpos)
|
||||||
val x = Real32.fromInt xpos
|
val x = Real32.fromInt xpos
|
||||||
in
|
in
|
||||||
@@ -115,7 +117,7 @@ struct
|
|||||||
val posX = startX + TC.xSpace
|
val posX = startX + TC.xSpace
|
||||||
in
|
in
|
||||||
loop
|
loop
|
||||||
( 0
|
( searchScrollColumn
|
||||||
, str
|
, str
|
||||||
, posX
|
, posX
|
||||||
, startY
|
, startY
|
||||||
|
|||||||
Reference in New Issue
Block a user