aboutsummaryrefslogtreecommitdiff
path: root/desktop-utilities/lumina-terminal/TerminalWidget.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-03-11 15:04:24 -0500
committerKen Moore <moorekou@gmail.com>2016-03-11 15:04:24 -0500
commit2053dc33e0d76b51d477f3c4c50278c0258b7f00 (patch)
tree3cb4308b85cd302280b7e04dbb506fbcea2cee08 /desktop-utilities/lumina-terminal/TerminalWidget.cpp
parentFix up the detection of sloppy URL's (www.<something>) - treat them as http U... (diff)
downloadlumina-2053dc33e0d76b51d477f3c4c50278c0258b7f00.tar.gz
lumina-2053dc33e0d76b51d477f3c4c50278c0258b7f00.tar.bz2
lumina-2053dc33e0d76b51d477f3c4c50278c0258b7f00.zip
Get the terminal resizing routine working, and also get the up/down arrows functional (mostly).
Diffstat (limited to 'desktop-utilities/lumina-terminal/TerminalWidget.cpp')
-rw-r--r--desktop-utilities/lumina-terminal/TerminalWidget.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/desktop-utilities/lumina-terminal/TerminalWidget.cpp b/desktop-utilities/lumina-terminal/TerminalWidget.cpp
index 96b86bda..1756d0b1 100644
--- a/desktop-utilities/lumina-terminal/TerminalWidget.cpp
+++ b/desktop-utilities/lumina-terminal/TerminalWidget.cpp
@@ -49,6 +49,11 @@ void TerminalWidget::UpdateText(){
QByteArray buffer = PROC->readTTY();
QString text = QString(buffer);
text.replace("\r\n","\n");
+ //Special Cursor handling
+ while(text.startsWith("\b")){
+ this->textCursor().deletePreviousChar();
+ text = text.remove(0,1);
+ }
this->insertPlainText(text);
//adjust the scrollbar as needed
this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum());
@@ -85,3 +90,14 @@ void TerminalWidget::mouseDoubleClickEvent(QMouseEvent *ev){
void TerminalWidget::contextMenuEvent(QContextMenuEvent *ev){
Q_UNUSED(ev);
}
+
+void TerminalWidget::resizeEvent(QResizeEvent *ev){
+ if(!PROC->isOpen()){ return; }
+ QSize pix = ev->size(); //pixels
+ QSize chars;
+ chars.setWidth( pix.width()/this->fontMetrics().width("W") );
+ chars.setHeight( pix.height()/this->fontMetrics().lineSpacing() );
+
+ PROC->setTerminalSize(chars,pix);
+ QTextEdit::resizeEvent(ev);
+}
bgstack15