diff --git a/src/vedit.cpp b/src/vedit.cpp index 0594b4bd..3269e89d 100644 --- a/src/vedit.cpp +++ b/src/vedit.cpp @@ -908,15 +908,44 @@ void VEdit::lineNumberAreaPaintEvent(QPaintEvent *p_event) const int curBlockNumber = textCursor().block().blockNumber(); const bool relative = vconfig.getEditorLineNumber() == 2; const QString &fg = vconfig.getEditorLineNumberFg(); + painter.setPen(fg); while (block.isValid() && top <= eventBtm) { if (block.isVisible() && bottom >= eventTop) { - QString number = QString::number(relative ? blockNumber - curBlockNumber - : blockNumber + 1); - painter.setPen(fg); - painter.drawText(0, top + 2, + bool currentLine = false; + int number = blockNumber + 1; + if (relative) { + number = blockNumber - curBlockNumber; + if (number == 0) { + currentLine = true; + number = blockNumber + 1; + } else if (number < 0) { + number = -number; + } + } else if (blockNumber == curBlockNumber) { + currentLine = true; + } + + QString numberStr = QString::number(number); + + if (currentLine) { + QFont font = painter.font(); + font.setBold(true); + painter.setFont(font); + } + + painter.drawText(0, + top + 2, m_lineNumberArea->width(), - digitHeight, Qt::AlignRight, number); + digitHeight, + Qt::AlignRight, + numberStr); + + if (currentLine) { + QFont font = painter.font(); + font.setBold(false); + painter.setFont(font); + } } block = block.next(); @@ -999,7 +1028,7 @@ int LineNumberArea::calculateWidth() const ++digits; } - int width = 2 + m_digitWidth * digits; + int width = m_digitWidth * digits; const_cast(this)->m_width = width; return m_width; diff --git a/src/vedit.h b/src/vedit.h index 460d41ab..b74365ab 100644 --- a/src/vedit.h +++ b/src/vedit.h @@ -231,7 +231,7 @@ public: m_document(p_editor->document()), m_width(0), m_blockCount(-1) { - m_digitWidth = m_editor->fontMetrics().width(QLatin1Char('9')); + m_digitWidth = m_editor->fontMetrics().width(QLatin1Char('1')); m_digitHeight = m_editor->fontMetrics().height(); } diff --git a/src/vnotebookselector.cpp b/src/vnotebookselector.cpp index 849e08c6..b81420e0 100644 --- a/src/vnotebookselector.cpp +++ b/src/vnotebookselector.cpp @@ -163,7 +163,7 @@ void VNotebookSelector::update() bool VNotebookSelector::newNotebook() { QString info(tr("Please type the name of the notebook and " - "choose an existing folder as Root Folder of the notebook.")); + "choose a folder as the Root Folder of the notebook.")); info += "\n"; info += tr("The root folder should be used EXCLUSIVELY by VNote and " "it is recommended to be EMPTY.");