From 213b02322676ac3923dd305dbce536759853ae35 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Fri, 12 Sep 2025 12:22:28 +0100 Subject: [PATCH] fix compiler errors in functions for building search string --- fcore/text-builder.sml | 130 +++++++++++------------------------------ shf.mlb | 5 ++ 2 files changed, 40 insertions(+), 95 deletions(-) diff --git a/fcore/text-builder.sml b/fcore/text-builder.sml index 53fb18b..592caac 100644 --- a/fcore/text-builder.sml +++ b/fcore/text-builder.sml @@ -16,8 +16,23 @@ struct val r: Real32.real = 0.67 val g: Real32.real = 0.51 val b: Real32.real = 0.83 - val chr = makeChr - (chr, posX, posY, floatWindowWidth, floatWindowHeight, r, g, b) + val fPosX = Real32.fromInt posX + val fPosY = Real32.fromInt posY + val z: Real32.real = 0.1 + + val chr = CozetteAscii.make + ( chr + , fPosX + , fPosY + , z + , TC.scale + , floatWindowWidth + , floatWindowHeight + , r + , g + , b + ) + val acc = chr :: acc val nextPosX = posX + TC.xSpace in @@ -42,8 +57,23 @@ struct val r: Real32.real = 0.67 val g: Real32.real = 0.51 val b: Real32.real = 0.83 - val acc = makeChr - (#"/", startX, startY, floatWindowWidth, floatWindowHeight, r, g, b) + val fPosX = Real32.fromInt startX + val fPosY = Real32.fromInt startY + val z: Real32.real = 0.1 + + val chr = CozetteAscii.make + ( #"/" + , fPosX + , fPosY + , z + , TC.scale + , floatWindowWidth + , floatWindowHeight + , r + , g + , b + ) + val posX = startX + TC.xSpace in loop @@ -52,100 +82,10 @@ struct , posX , startY , endX - , [acc] + , [chr] , floatWindowWidth , floatWindowHeight ) end 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 *) - fun buildWithExisting - ( startLine - , cursorPos - , lineGap: LineGap.t - , windowWidth - , windowHeight - , floatWindowWidth - , floatWindowHeight - , searchList: SearchList.t - , searchString - , msgs - , textAcc - , bgAcc - ) = - let - val {rightStrings, rightLines, line = curLine, idx = curIdx, ...} = - lineGap - in - case (rightStrings, rightLines) of - (rStrHd :: rStrTl, rLnHd :: _) => - let - (* get relative index of line to start building from *) - val startIdx = helpGetLineStartIdx (startLine, curLine, rLnHd) - (* get absolute idx of line *) - val absIdx = curIdx + startIdx - - val env = initEnv - ( windowWidth - , windowHeight - , floatWindowWidth - , floatWindowHeight - , msgs - , searchList - , String.size searchString - ) - val {startX, startY, ...} = env - - val cursorAcc = Vector.fromList [] - val searchPos = BinSearch.equalOrMore (absIdx, searchList) - in - buildTextStringSearch - ( startIdx - , rStrHd - , textAcc - , startX - , startY - , rStrTl - , absIdx - , cursorPos - , cursorAcc - , bgAcc - , env - , searchPos - ) - end - | (_, _) => - (* requested line goes beyond the buffer, - * so just return empty list as there is nothig - * else we can do. *) - [] - end - - fun build - ( startLine - , cursorPos - , lineGap: LineGap.t - , windowWidth - , windowHeight - , searchList: SearchList.t - , searchString - , msgs - ) = - buildWithExisting - ( startLine - , cursorPos - , lineGap : LineGap.t - , windowWidth - , windowHeight - , Real32.fromInt windowWidth - , Real32.fromInt windowHeight - , searchList : SearchList.t - , searchString - , msgs - , [] - , [] - ) end diff --git a/shf.mlb b/shf.mlb index 305766c..3452c68 100644 --- a/shf.mlb +++ b/shf.mlb @@ -30,6 +30,10 @@ fcore/text-constants.sml ann "allowVectorExps true" in + fcore/cursor-dfa/make-dfa-loop.sml + fcore/cursor-dfa/vi-word-dfa.sml + fcore/cursor-dfa/vi-caps-word-dfa.sml + fcore/cursor-dfa/vi-dlr-dfa.sml fcore/rect.sml fcore/pipe-cursor.sml end @@ -37,6 +41,7 @@ fcore/text-builder/text-builder-utils.sml fcore/text-builder/text-builder-with-cursor.sml fcore/text-builder/text-builder-with-highlight.sml fcore/text-builder/normal-mode-text-builder.sml + fcore/text-builder.sml fcore/cursor.sml fcore/text-window.sml