create text builder function to call for normal mode
This commit is contained in:
@@ -59,88 +59,6 @@ struct
|
||||
end
|
||||
end
|
||||
|
||||
(* gets line start idx, relative to right hd *)
|
||||
fun helpGetLineStartIdx (startLine, curLine, rLnHd) =
|
||||
if startLine > curLine then
|
||||
let val lnPos = startLine - curLine - 1
|
||||
in Vector.sub (rLnHd, lnPos) + 1
|
||||
end
|
||||
else
|
||||
0
|
||||
|
||||
(* gets line start idx, absolute *)
|
||||
fun helpGetLineAbsIdx (curIdx, startLine, curLine, rLnHd) =
|
||||
let
|
||||
val startIdx =
|
||||
if startLine > curLine then
|
||||
let val lnPos = startLine - curLine - 1
|
||||
in Vector.sub (rLnHd, lnPos) + 1
|
||||
end
|
||||
else
|
||||
0
|
||||
in
|
||||
curIdx + startIdx
|
||||
end
|
||||
|
||||
fun getLineAbsIdx (startLine, lineGap: LineGap.t) =
|
||||
let
|
||||
val {rightLines, line = curLine, idx = curIdx, ...} = lineGap
|
||||
in
|
||||
case rightLines of
|
||||
rLnHd :: _ => helpGetLineAbsIdx (curIdx, startLine, curLine, rLnHd)
|
||||
| [] => (* should never happen *) 0
|
||||
end
|
||||
|
||||
fun initEnv
|
||||
( windowWidth
|
||||
, windowHeight
|
||||
, floatWindowWidth
|
||||
, floatWindowHeight
|
||||
, searchList
|
||||
, searchLen
|
||||
) =
|
||||
if TC.textLineWidth > windowWidth then
|
||||
{ w = windowWidth
|
||||
, h = windowHeight
|
||||
, startX = 5
|
||||
, startY = 5
|
||||
, z = 0.01
|
||||
, fw = floatWindowWidth
|
||||
, fh = floatWindowHeight
|
||||
, r = 0.67
|
||||
, g = 0.51
|
||||
, b = 0.83
|
||||
, hr = 0.211
|
||||
, hg = 0.219
|
||||
, hb = 0.25
|
||||
, msgs = msgs
|
||||
, searchList = searchList
|
||||
, searchLen = searchLen
|
||||
}
|
||||
else
|
||||
let
|
||||
val startX = (windowWidth - TC.textLineWidth) div 2
|
||||
val finishWidth = startX + TC.textLineWidth
|
||||
in
|
||||
{ w = finishWidth
|
||||
, h = windowHeight
|
||||
, startX = startX
|
||||
, startY = 5
|
||||
, z = 0.01
|
||||
, fw = floatWindowWidth
|
||||
, fh = floatWindowHeight
|
||||
, r = 0.67
|
||||
, g = 0.51
|
||||
, b = 0.83
|
||||
, hr = 0.211
|
||||
, hg = 0.219
|
||||
, hb = 0.25
|
||||
, msgs = msgs
|
||||
, searchList = searchList
|
||||
, searchLen = searchLen
|
||||
}
|
||||
end
|
||||
|
||||
(* todo: add startX and startY parameters,
|
||||
* so we can control where on the * screen the text starts from.
|
||||
* Not worth doing until we have/in preparation of tiling functionality *)
|
||||
|
||||
Reference in New Issue
Block a user