aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-06-14 15:01:20 -0400
committerKen Moore <ken@ixsystems.com>2017-06-14 15:01:20 -0400
commita9036a594d4985764d2c4813b18caf0e12e6a35a (patch)
tree40e939098daa41ece75050d2e7993ab5fd2bc1f6 /src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
parentMerge branch 'master' of http://github.com/trueos/lumina (diff)
downloadlumina-a9036a594d4985764d2c4813b18caf0e12e6a35a.tar.gz
lumina-a9036a594d4985764d2c4813b18caf0e12e6a35a.tar.bz2
lumina-a9036a594d4985764d2c4813b18caf0e12e6a35a.zip
Fix the sync of the line wrap with the current tab/file.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
index 865798e2..57bc35a6 100644
--- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
@@ -134,13 +134,16 @@ int PlainTextEditor::LNWWidth(){
int lines = this->blockCount();
if(lines<1){ lines = 1; }
int chars = 1;
- qDebug() << "point 1" << this->document()->defaultFont();
+ //qDebug() << "point 1" << this->document()->defaultFont();
while(lines>=10){ chars++; lines/=10; }
QFontMetrics metrics(this->document()->defaultFont());
return (metrics.width("9")*chars); //make sure to add a tiny bit of padding
}
void PlainTextEditor::paintLNW(QPaintEvent *ev){
+ //qDebug() << "Paint LNW Event:" << ev->rect() << LNW->geometry();
+ //if(ev->rect().height() < (QFontMetrics(this->document()->defaultFont()).height() *1.5) ){ return; }
+ //qDebug() << " -- paint line numbers";
QPainter P(LNW);
//First set the background color
P.fillRect(ev->rect(), QColor("lightgrey"));
@@ -153,15 +156,15 @@ void PlainTextEditor::paintLNW(QPaintEvent *ev){
P.setFont(this->document()->defaultFont());
//Now loop over the blocks (lines) and write in the numbers
QFontMetrics metrics(this->document()->defaultFont());
- qDebug() << "point 2" << this->document()->defaultFont();
+ //qDebug() << "point 2" << this->document()->defaultFont();
P.setPen(Qt::black); //setup the font color
while(block.isValid() && bTop<=ev->rect().bottom()){ //ensure block below top of viewport
bBottom = bTop+blockBoundingRect(block).height();
if(block.isVisible() && bBottom >= ev->rect().top()){ //ensure block above bottom of viewport
P.drawText(0,bTop, LNW->width(), metrics.height(), Qt::AlignRight, QString::number(block.blockNumber()+1) );
- qDebug() << "bTop" << bTop;
- qDebug() << "LNW->width()" << LNW->width();
- qDebug() << "metrics.height()" << metrics.height();
+ //qDebug() << "bTop" << bTop;
+ //qDebug() << "LNW->width()" << LNW->width();
+ //qDebug() << "metrics.height()" << metrics.height();
}
//Go to the next block
block = block.next();
bgstack15