From d82aba7b0ca40470b9cdeef624aa35bdf6376b42 Mon Sep 17 00:00:00 2001 From: Don HO Date: Mon, 14 Sep 2020 14:33:51 +0200 Subject: [PATCH] Improve the computing of number of digit in line number margin display --- .../src/ScitillaComponent/ScintillaEditView.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index d457e7bf4..569f7ae6b 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -32,7 +32,6 @@ #include "ScintillaEditView.h" #include "Parameters.h" #include "Sorters.h" -#include "tchar.h" #include "verifySignedfile.h" using namespace std; @@ -2724,10 +2723,9 @@ void ScintillaEditView::updateLineNumberWidth() auto lastVisibleLineVis = linesVisible + firstVisibleLineVis + 1; auto lastVisibleLineDoc = execute(SCI_DOCLINEFROMVISIBLE, lastVisibleLineVis); - int nbDigits = 0; - if (lastVisibleLineDoc < 10) nbDigits = 1; - else if (lastVisibleLineDoc < 100) nbDigits = 2; - else if (lastVisibleLineDoc < 1000) nbDigits = 3; + + int nbDigits = 3; // minimum number of digit should be 3 + if (lastVisibleLineDoc < 1000) {} //nbDigits = 3; else if (lastVisibleLineDoc < 10000) nbDigits = 4; else if (lastVisibleLineDoc < 100000) nbDigits = 5; else if (lastVisibleLineDoc < 1000000) nbDigits = 6; @@ -2742,8 +2740,6 @@ void ScintillaEditView::updateLineNumberWidth() ++nbDigits; } } - - nbDigits = max(nbDigits, 3); auto pixelWidth = 8 + nbDigits * execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast("8")); execute(SCI_SETMARGINWIDTHN, _SC_MARGE_LINENUMBER, pixelWidth); }