Merge pull request #1615 from jasleenkaur/Line_Number
shrink margin on demand
This commit is contained in:
commit
7f4a6b1d25
1 changed files with 22 additions and 2 deletions
|
|
@ -181,7 +181,17 @@ void ScintillaEditor::applySettings()
|
|||
|
||||
qsci->setBraceMatching(s->get(Settings::Settings::enableBraceMatching).toBool() ? QsciScintilla::SloppyBraceMatch : QsciScintilla::NoBraceMatch);
|
||||
qsci->setCaretLineVisible(s->get(Settings::Settings::highlightCurrentLine).toBool());
|
||||
qsci->setMarginLineNumbers(1,s->get(Settings::Settings::enableLineNumbers).toBool());
|
||||
bool value = s->get(Settings::Settings::enableLineNumbers).toBool();
|
||||
qsci->setMarginLineNumbers(1,value);
|
||||
|
||||
if(!value)
|
||||
{
|
||||
qsci->setMarginWidth(1,20);
|
||||
}
|
||||
else
|
||||
{
|
||||
qsci->setMarginWidth(1,QString(trunc(log10(qsci->lines())+4), '0'));
|
||||
}
|
||||
}
|
||||
|
||||
void ScintillaEditor::setPlainText(const QString &text)
|
||||
|
|
@ -488,8 +498,18 @@ void ScintillaEditor::initMargin()
|
|||
|
||||
void ScintillaEditor::onTextChanged()
|
||||
{
|
||||
Settings::Settings *s = Settings::Settings::inst();
|
||||
QFontMetrics fontmetrics(this->currentFont);
|
||||
qsci->setMarginWidth(1, QString(trunc(log10(qsci->lines())+2), '0'));
|
||||
bool value = s->get(Settings::Settings::enableLineNumbers).toBool();
|
||||
|
||||
if(!value)
|
||||
{
|
||||
qsci->setMarginWidth(1,20);
|
||||
}
|
||||
else
|
||||
{
|
||||
qsci->setMarginWidth(1,QString(trunc(log10(qsci->lines())+4), '0'));
|
||||
}
|
||||
}
|
||||
|
||||
bool ScintillaEditor::find(const QString &expr, bool findNext, bool findBackwards)
|
||||
|
|
|
|||
Loading…
Reference in a new issue