From 513a3f6799b76859d43d23b596115b664df75cd2 Mon Sep 17 00:00:00 2001 From: Paul Kulchenko Date: Wed, 11 May 2016 17:12:52 -0700 Subject: [PATCH] Fixed line calculations for markup styling to properly style comments after folded fragments. --- src/editor/editor.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/editor/editor.lua b/src/editor/editor.lua index 30774f7d1f..dc0a99714e 100644 --- a/src/editor/editor.lua +++ b/src/editor/editor.lua @@ -1200,13 +1200,10 @@ function CreateEditor(bare) local ok, res = pcall(IndicateAll, editor, minupdated) if not ok then DisplayOutputLn("Internal error: ",res,minupdated) end end - local firstvisible = editor:DocLineFromVisible(editor:GetFirstVisibleLine()) - local lastline = math.min(editor:GetLineCount(), - firstvisible + editor:LinesOnScreen()) - -- lastline - editor:LinesOnScreen() can get negative; fix it - local firstline = math.min(math.max(0, lastline - editor:LinesOnScreen()), - firstvisible) - MarkupStyle(editor,minupdated or firstline,lastline) + local firstline = editor:DocLineFromVisible(editor:GetFirstVisibleLine()) + local lastline = editor:DocLineFromVisible(firstline + editor:LinesOnScreen()) + -- cap last line at the number of lines in the document + MarkupStyle(editor, minupdated or firstline, math.min(editor:GetLineCount(),lastline)) editor.ev = {} end)