diff --git a/fcore/normal-mode/normal-finish.sml b/fcore/normal-mode/normal-finish.sml index 95dd165..1dabf31 100644 --- a/fcore/normal-mode/normal-finish.sml +++ b/fcore/normal-mode/normal-finish.sml @@ -17,6 +17,7 @@ struct (* calculate scroll column *) val buffer = LineGap.goToIdx (cursorIdx, buffer) val visualScrollColumn = TextScroll.getScrollColumn (buffer, cursorIdx, windowWidth) + val () = print (Int.toString visualScrollColumn ^ "\n") (* move LineGap to first line displayed on screen *) val buffer = LineGap.goToLine (startLine, buffer) diff --git a/fcore/text-scroll.sml b/fcore/text-scroll.sml index be2842c..0fea775 100644 --- a/fcore/text-scroll.sml +++ b/fcore/text-scroll.sml @@ -16,7 +16,9 @@ struct if windowWidth >= TC.textLineWidth then TC.textLineCount else windowWidth div TC.xSpace in - columnDifference mod howManyColumnsCanWeFit + if columnDifference < howManyColumnsCanWeFit then 0 + else + columnDifference - howManyColumnsCanWeFit end end end