diff --git a/fcore/text-builder/text-builder-with-cursor.sml b/fcore/text-builder/text-builder-with-cursor.sml index efdd5bb..c4cd4ce 100644 --- a/fcore/text-builder/text-builder-with-cursor.sml +++ b/fcore/text-builder/text-builder-with-cursor.sml @@ -15,13 +15,12 @@ struct val posY = posY + TC.ySpace val lineNumber = lineNumber + 1 in - build + skipToFirstVisibleColumn ( strPos , shd , stl , lhd , ltl - , #startX env , posY , 0 , lineNumber @@ -78,13 +77,12 @@ struct val posY = posY + TC.ySpace val lineNumber = lineNumber + 1 in - build + skipToFirstVisibleColumn ( newStrPos , str , stl , line , ltl - , #startX env , posY , 0 , lineNumber @@ -150,19 +148,23 @@ struct case String.sub (str, pos) of #"\n" => let - (* increment line lineNumber and posY, and then call build function *) + (* increment line lineNumber and posY, + * and then call skipToFirstVisibleColumn recursively. + * The recursive call check this condition: + * Is the new column 0 the same as the column the scroll starts at? + * If it is, then we call build, or else we continue skipping + * until we reach the start column. *) val posY = posY + TC.ySpace val lineNumber = lineNumber + 1 in - build + skipToFirstVisibleColumn ( pos + 1 , str , stl , line , ltl - , #startX env , posY - , #scrollColumnStart env + , 0 , lineNumber , absIdx + 1 , cursorIdx diff --git a/temp.txt b/temp.txt index 82ce789..e9e1990 100644 --- a/temp.txt +++ b/temp.txt @@ -1,11 +1,3 @@ -signature TEXT_BUILDER = aaron baron carrot durian - (* Prerequisite: LineGap is moved to requested line first. *) - val build: int * int * LineGap.t * int * int - -> MailboxType.t list -end - - - structure TextBuilder :> TEXT_BUILDER = struct val xSpace = 13