[BUG_FIXED] (Author: Neomi) Fix text flickering due to line number pane size adaptation.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1162 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
bbe9bff592
commit
3fc26bbcf8
|
@ -2112,6 +2112,47 @@ void ScintillaEditView::setLineIndent(int line, int indent) const {
|
||||||
execute(SCI_SETSEL, crange.cpMin, crange.cpMax);
|
execute(SCI_SETSEL, crange.cpMin, crange.cpMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScintillaEditView::updateLineNumberWidth()
|
||||||
|
{
|
||||||
|
if (_lineNumbersShown)
|
||||||
|
{
|
||||||
|
int linesVisible = (int) execute(SCI_LINESONSCREEN);
|
||||||
|
if (linesVisible)
|
||||||
|
{
|
||||||
|
int firstVisibleLineVis = (int) execute(SCI_GETFIRSTVISIBLELINE);
|
||||||
|
int lastVisibleLineVis = linesVisible + firstVisibleLineVis + 1;
|
||||||
|
|
||||||
|
if (execute(SCI_GETWRAPMODE) != SC_WRAP_NONE)
|
||||||
|
{
|
||||||
|
int numLinesDoc = (int) execute(SCI_GETLINECOUNT);
|
||||||
|
int prevLineDoc = (int) execute(SCI_DOCLINEFROMVISIBLE, firstVisibleLineVis);
|
||||||
|
for (int i = firstVisibleLineVis + 1; i <= lastVisibleLineVis; ++i)
|
||||||
|
{
|
||||||
|
int lineDoc = (int) execute(SCI_DOCLINEFROMVISIBLE, i);
|
||||||
|
if (lineDoc == numLinesDoc)
|
||||||
|
break;
|
||||||
|
if (lineDoc == prevLineDoc)
|
||||||
|
lastVisibleLineVis++;
|
||||||
|
prevLineDoc = lineDoc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int lastVisibleLineDoc = (int) execute(SCI_DOCLINEFROMVISIBLE, lastVisibleLineVis);
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while (lastVisibleLineDoc)
|
||||||
|
{
|
||||||
|
lastVisibleLineDoc /= 10;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
i = max(i, 3);
|
||||||
|
int pixelWidth = int(8 + i * execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, (LPARAM)"8"));
|
||||||
|
execute(SCI_SETMARGINWIDTHN, _SC_MARGE_LINENUMBER, pixelWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const char * ScintillaEditView::getCompleteKeywordList(std::basic_string<char> & kwl, LangType langType, int keywordIndex)
|
const char * ScintillaEditView::getCompleteKeywordList(std::basic_string<char> & kwl, LangType langType, int keywordIndex)
|
||||||
{
|
{
|
||||||
kwl += " ";
|
kwl += " ";
|
||||||
|
|
|
@ -516,29 +516,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateLineNumberWidth() {
|
void updateLineNumberWidth();
|
||||||
if (_lineNumbersShown)
|
|
||||||
{
|
|
||||||
int linesVisible = (int) execute(SCI_LINESONSCREEN);
|
|
||||||
if (linesVisible)
|
|
||||||
{
|
|
||||||
int firstVisibleLineVis = (int) execute(SCI_GETFIRSTVISIBLELINE);
|
|
||||||
int lastVisibleLineVis = linesVisible + firstVisibleLineVis + 1;
|
|
||||||
int lastVisibleLineDoc = (int) execute(SCI_DOCLINEFROMVISIBLE, lastVisibleLineVis);
|
|
||||||
int i = 0;
|
|
||||||
while (lastVisibleLineDoc)
|
|
||||||
{
|
|
||||||
lastVisibleLineDoc /= 10;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
i = max(i, 3);
|
|
||||||
{
|
|
||||||
int pixelWidth = int(8 + i * execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, (LPARAM)"8"));
|
|
||||||
execute(SCI_SETMARGINWIDTHN, _SC_MARGE_LINENUMBER, pixelWidth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void setCurrentLineHiLiting(bool isHiliting, COLORREF bgColor) const {
|
void setCurrentLineHiLiting(bool isHiliting, COLORREF bgColor) const {
|
||||||
execute(SCI_SETCARETLINEVISIBLE, isHiliting);
|
execute(SCI_SETCARETLINEVISIBLE, isHiliting);
|
||||||
|
|
Loading…
Reference in New Issue