diff --git a/msvc/Reclass.vcxproj b/msvc/Reclass.vcxproj index 9edf950..3c78416 100644 --- a/msvc/Reclass.vcxproj +++ b/msvc/Reclass.vcxproj @@ -66,6 +66,7 @@ ..\third_party\fadec\;..\third_party\raw_pdb\src\;..\third_party\qscintilla\src\;..\src\ + NOMINMAX;%(PreprocessorDefinitions) dwmapi.lib;dbghelp.lib;%(AdditionalDependencies) @@ -80,6 +81,7 @@ ..\third_party\fadec\;..\third_party\raw_pdb\src\;..\third_party\qscintilla\src\;..\src\ + NOMINMAX;%(PreprocessorDefinitions) $(QtToolsPath)/windeployqt $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName).exe diff --git a/src/main.cpp b/src/main.cpp index 3260885..14092e0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2263,6 +2263,21 @@ void MainWindow::updateRenderedView(TabState& tab, SplitPane& pane) { // Set text pane.rendered->setText(text); + // Set horizontal scroll width to match the longest line (ignoring trailing spaces) + { + int maxLen = 0; + const QStringList lines = text.split(QChar('\n')); + for (const auto& line : lines) { + int len = (int)line.size(); + while (len > 0 && line[len - 1] == QChar(' ')) --len; + maxLen = std::max(maxLen, len); + } + QFontMetrics fm(pane.rendered->font()); + int pixelWidth = fm.horizontalAdvance(QString(maxLen, QChar('0'))); + pane.rendered->SendScintilla(QsciScintillaBase::SCI_SETSCROLLWIDTH, + (unsigned long)qMax(1, pixelWidth)); + } + // Update margin width for line count int lineCount = pane.rendered->lines(); QString marginStr = QString(QString::number(lineCount).size() + 2, '0');