Files
sml-projects/.temp.txt.swp

23 lines
16 KiB
Plaintext
Raw Normal View History

b0VIM 9.1ӗ<>h<EFBFBD><68>:G<>humzahumza-macmini~humza/Downloads/sml/shf/temp.txt 3210#"! U
<00>
<00>
<00>
<00>
{
t
h
`
_
0
<00> <00> <00> w D  <00><00><00>~`?<00><00><00><00>o_)<00><00>^:-<00><00><00>T<00><00><00><00>E<00><00><00>d<00><00><00><00>`O (* same as \n, except we also check if we are in a \r\n pair, | #"\r" => accToDrawMsg (acc, cursorAcc) (* return if there is no more vertical space after line break *) else ) , r, g, b, tl, cursorAcc , windowWidth, windowHeight, fWindowWidth, fWindowHeight ( pos + 1, str, acc, startX, posY + ySpace, startX buildTextStringAfterCursor if posY + ySpace < windowHeight then * If we have exceeded the window's height, just return acc. *) * assuming we have not exceeded the window's height. (* if \n, move down vertically, and move to start horizontally | #"\n" => ) , r, g, b, tl, cursorAcc , windowWidth, windowHeight, fWindowWidth, fWindowHeight ( pos + 1, str, acc, posX + xSpace3, posY, startX buildTextStringAfterCursor * and jump visually forwards three chars *) (* if tab, proceed forward one char, | #"\t" => ) , r, g, b, tl, cursorAcc , windowWidth, windowHeight, fWindowWidth, fWindowHeight ( pos + 1, str, acc, posX + xSpace, posY, startX buildTextStringAfterCursor * without adding to acc *) (* if space, then proceed forward one char #" " => case String.sub (str, pos) of if pos < String.size str then ) = , r, g, b, tl, cursorAcc , windowWidth, windowHeight, fWindowWidth, fWindowHeight ( pos, str, acc, posX, posY, startX fun buildTextStringAfterCursor * on an indented line *) * - Possibly add visual horizontal indentation when char-wrap occurs * Todo: * * range selection where multiple characters are selected, etc. * cursor over an individual character, * functions for each selection and cursor type: * Will likely want multiple versions of these two mutually recursive * * but it breaks on character in the middle of a word. * char-wrap is a similar concept to word-wrap, (* builds text from a string with char-wrap. end [vec] in ] , right, top, r, g, b , right, bottom, r, g, b , left, bottom, r, g, b , left, bottom, r, g, b , right, top, r, g, b #[ left, top, r, g, b val vec = val right = (right - halfWidth) / halfWidth val left = (left - halfWidth) / halfWidth val halfWidth = fWindowWidth / 2.0 val bottom = (~(bottom - halfHeight)) / halfHeight val top = (~(top - halfHeight)) / halfHeight val halfHeight = fWindowHeight / 2.0 val bottom = top + fontSize + 2.0 val top = Real32.fromInt posY val right = left + 12.0 val left = Real32.fromInt left val left = posX + 9 let fun buildCursor (posX, posY, fWindowWidth, fWindowHeight, r, g, b) = end [DRAW textMsg, DRAW cursorMsg] in val cursorMsg = REDRAW_CURSOR cursorAcc val textMsg = REDRAW_TEXT textAcc val cursorAcc = Vector.concat cursorAcc val textAcc = Vector.concat textAcc open DrawMsg open MailboxType let fun accToDrawMsg (textAcc, cursorAcc) = val fontSize = 30.0 val ySpace = 25 val xSpace3 = xSpace * 3 val xSpace = 13structstructure TextBuilder :> TEXT_BUILDER =end -> MailboxType.t list val build: int * int * LineGap.t * int * int (* Prerequisite: LineGap is moved to requested line first. *)aaron baron carrot duriansignature TEXT_BUILDER =ad<00><00>I<00><00>zoP,<00><00>wTSG<00> <00> <00> g ` 7 <00> <00> <00>  k 5 <00> <00> <00> <00> Z  <00>
<00>
<00>
<00>
w
d
R
Q
$
#

<00> <00> <00> Z @  <00><00>wR@/<00><00><00>j <00><00><00><00><00>zF <00><00><00><00><00>end end [] * else we can do. *) * so just return empty list as there is nothig (* requested line goes beyond the buffer, | (_, _) => end ) , 0.211, 0.219, 0.25 , rStrTl, absIdx, cursorPos , 0.67, 0.51, 0.83 , Real32.fromInt windowWidth, Real32.fromInt windowHeight , windowWidth, windowHeight , 5, 5, 5 ( startIdx, rStrHd, [] buildTextStringBeforeCursor (* if cursor is after string *) else ) , 0.211, 0.219, 0.25 , rStrTl, absIdx, cursorPos, [] , 0.67, 0.51, 0.83 , Real32.fromInt windowWidth, Real32.fromInt windowHeight , windowWidth, windowHeight , 5, 5, 5 ( startIdx, rStrHd, [] buildTextStringWithinCursor (* if cursor is within string *) if cursorPos < curIdx + String.size rStrHd then in val absIdx = curIdx + startIdx 0 else end else startIdx + 1 startIdx + 2 (* handle \r\n pair *) then andalso String.sub (rStrHd, startIdx + 1) = #"\n" andalso startIdx < String.size rStrHd - 1 String.sub (rStrHd, startIdx) = #"\r" if in val startIdx = Vector.sub (rLnHd, lnPos) val lnPos = startLine - curLine - 1 let if startLine > curLine then val startIdx = (* get index of line to start building from *) let (rStrHd :: rStrTl, rLnHd :: _) => case (rightStrings, rightLines) of in val {rightStrings, rightLines, line = curLine, idx = curIdx, ...} = lineGap val lineGap = LineGap.goToLine (startLine, lineGap) let (startLine, cursorPos, lineGap: LineGap.t, windowWidth, windowHeight) = fun build | [] => accToDrawMsg (acc, []) ) , r, g, b, tl, absIdx, cursorPos, [], hr, hg, hb , windowWidth, windowHeight, fWindowWidth, fWindowHeight ( 0, hd, acc, posX, posY, startX buildTextStringWithinCursor (* if within cursor *) else ) , r, g, b, tl, absIdx, cursorPos, hr, hg, hb , windowWidth, windowHeight, fWindowWidth, fWindowHeight