aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2016-12-08 12:49:09 -0500
committerKen Moore <ken@ixsystems.com>2016-12-08 12:49:09 -0500
commit2fa1f4e1a16e74177b22bcb63d40acabfb8daa75 (patch)
tree3c67a056f7e1f45b7034f1b42e0c55e3d1f8b6a1 /src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp
parentFix up the auto-hide functionality within the terminal when the term window l... (diff)
downloadlumina-2fa1f4e1a16e74177b22bcb63d40acabfb8daa75.tar.gz
lumina-2fa1f4e1a16e74177b22bcb63d40acabfb8daa75.tar.bz2
lumina-2fa1f4e1a16e74177b22bcb63d40acabfb8daa75.zip
Commit some more fixes for the terminal. Now the arrow keys work properly with the terminal again.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp
index 6342be59..6893915b 100644
--- a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp
+++ b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp
@@ -93,10 +93,15 @@ void TerminalWidget::applyData(QByteArray data){
//qDebug() << "Data:" << data;
for(int i=0; i<data.size(); i++){
if( data.at(i)=='\b' ){
- //Flush current text buffer to widget
- //Simple cursor backward 1 (NOT backspace in this context!! - this widget should be in "insert" mode instead)
- InsertText(chars); chars.clear();
- this->moveCursor(QTextCursor::Left, QTextCursor::MoveAnchor);
+ //Backspace
+ if(!chars.isEmpty()){ chars.chop(1); }
+ else{
+ QTextCursor cur = this->textCursor();
+ cur.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor, 1);
+ cur.removeSelectedText();
+ this->setTextCursor(cur);
+ }
+
//}else if( data.at(i)=='\t' ){
//chars.append(" ");
}else if( data.at(i)=='\x1B' ){
@@ -116,9 +121,9 @@ void TerminalWidget::applyData(QByteArray data){
}else if( data.at(i) != '\r' ){
//Special Check: if inserting text within a line, clear the rest of this line first
- if(i==0 && this->textCursor().position() < this->document()->characterCount()-1){
+ /*if(i==0 && this->textCursor().position() < this->document()->characterCount()-1){
applyANSI("[K");
- }
+ }*/
chars.append(data.at(i));
//Plaintext character - just add it here
//qDebug() << "Insert Text:" << data.at(i) << CFMT.foreground().color() << CFMT.background().color();
@@ -462,7 +467,7 @@ void TerminalWidget::keyPressEvent(QKeyEvent *ev){
sendKeyPress(Qt::Key_End); //just in case the cursor is not at the end (TTY will split lines and such - ugly)
}
QByteArray ba; ba.append(ev->text()); //avoid any byte conversions
- //qDebug() << "Forward Input:" << ba;
+ qDebug() << "Forward Input:" << ba;
PROC->writeTTY(ba);
}
bgstack15