aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-04-27 11:32:24 -0400
committerKen Moore <moorekou@gmail.com>2016-04-27 11:32:24 -0400
commit05cb60323513205962d14164c84633fd609b94cb (patch)
treeb4213e8795979c424d0360b577dcf8de85559b8a
parentMerge branch 'master' of https://github.com/pcbsd/lumina (diff)
downloadlumina-05cb60323513205962d14164c84633fd609b94cb.tar.gz
lumina-05cb60323513205962d14164c84633fd609b94cb.tar.bz2
lumina-05cb60323513205962d14164c84633fd609b94cb.zip
Get colors working with the new terminal. Of course this breaks the font weight....
-rw-r--r--src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp
index f596e9fe..9d0162a6 100644
--- a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp
+++ b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp
@@ -18,7 +18,7 @@
TerminalWidget::TerminalWidget(QWidget *parent, QString dir) : QTextEdit(parent){
//Setup the text widget
- this->setStyleSheet("background: black; color: white;");
+ this->setStyleSheet("background: black;");
this->setLineWrapMode(QTextEdit::WidgetWidth);
this->setAcceptRichText(false);
this->setOverwriteMode(true);
@@ -27,7 +27,8 @@ TerminalWidget::TerminalWidget(QWidget *parent, QString dir) : QTextEdit(parent)
this->setWordWrapMode(QTextOption::NoWrap);
this->setContextMenuPolicy(Qt::CustomContextMenu);
DEFFMT = this->textCursor().charFormat(); //save the default structure for later
- CFMT = this->textCursor().charFormat(); //current format
+ DEFFMT.setForeground(Qt::white);
+ CFMT = DEFFMT; //current format
selCursor = this->textCursor(); //used for keeping track of selections
lastCursor = this->textCursor();
startrow = endrow = -1;
@@ -67,10 +68,18 @@ void TerminalWidget::aboutToClose(){
void TerminalWidget::InsertText(QString txt){
if(txt.isEmpty()){ return; }
//qDebug() << "Insert Text:" << txt << "Cursor Pos:" << this->textCursor().position() << "Column:" << this->textCursor().columnNumber();
- QTextCursor cur = this->textCursor();
+ QTextCursor cur = this->textCursor();
+ this->insertPlainText(txt);
+ cur.setPosition( this->textCursor().position(), QTextCursor::KeepAnchor);
cur.setCharFormat(CFMT);
- cur.insertText( txt, CFMT);
- this->setTextCursor(cur);
+ //Now make sure the new characters are the right color
+ QList<QTextEdit::ExtraSelection> sels = this->extraSelections();
+ QTextEdit::ExtraSelection sel;
+ sel.format = CFMT;
+ sel.cursor = cur;
+ sels << sel;
+ this->setExtraSelections(sels);
+ qDebug() << "New Text. Format:" << CFMT.foreground() << CFMT.font();
}
void TerminalWidget::applyData(QByteArray data){
bgstack15