diff options
author | Ken Moore <moorekou@gmail.com> | 2016-03-14 11:00:00 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-03-14 11:00:00 -0400 |
commit | aea2fc86a49a83ed8a9c23c92d8ebe174a36cdca (patch) | |
tree | 5076691281dc2a6937f169c5a79c251712bbf53b /desktop-utilities/lumina-terminal/TerminalWidget.cpp | |
parent | Get the left/right arrow keys working properly. (diff) | |
download | lumina-aea2fc86a49a83ed8a9c23c92d8ebe174a36cdca.tar.gz lumina-aea2fc86a49a83ed8a9c23c92d8ebe174a36cdca.tar.bz2 lumina-aea2fc86a49a83ed8a9c23c92d8ebe174a36cdca.zip |
Finish getting the special keys handled in lumina-terminal. Now the terminal is completely functional - I just have other special ANSI codes (colors for particular text) to implement still (but this is just for appearance-sake).
Diffstat (limited to 'desktop-utilities/lumina-terminal/TerminalWidget.cpp')
-rw-r--r-- | desktop-utilities/lumina-terminal/TerminalWidget.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/desktop-utilities/lumina-terminal/TerminalWidget.cpp b/desktop-utilities/lumina-terminal/TerminalWidget.cpp index a8947f75..3d247d5f 100644 --- a/desktop-utilities/lumina-terminal/TerminalWidget.cpp +++ b/desktop-utilities/lumina-terminal/TerminalWidget.cpp @@ -128,13 +128,22 @@ void TerminalWidget::applyANSI(QByteArray code){ qDebug() << "Erase Number" << num; //Now determine what should be cleared based on code if(num==1){ - + //Clear from current cursor to beginning of line + for(int i=this->textCursor().position(); i>=0; i--){ + if(this->document()->characterAt(this->textCursor().position())=='\n'){ break; } + this->textCursor().deleteChar(); + } }else if(num==2){ - + //Clear the entire line + // rewind the starting point to the beginning of the line + int start = this->document()->find("\n", this->textCursor().position(), QTextDocument::FindBackward).position(); + for(int i=start+1; i<this->document()->characterCount()+1; i++){ + if(this->document()->characterAt(this->textCursor().position())=='\n'){ break; } + this->textCursor().deleteChar(); + } }else{ //Clear from current cursor to end of line for(int i=this->textCursor().position(); i<this->document()->characterCount()+1; i++){ - //while(this->document()->characterAt(this->textCursor().position())!=QChar('\n') && this->textCursor().position() < this->document()->characterCount()){ if(this->document()->characterAt(this->textCursor().position())=='\n'){ break; } this->textCursor().deleteChar(); } |