From 2053dc33e0d76b51d477f3c4c50278c0258b7f00 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 11 Mar 2016 15:04:24 -0500 Subject: Get the terminal resizing routine working, and also get the up/down arrows functional (mostly). --- desktop-utilities/lumina-terminal/TerminalWidget.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'desktop-utilities/lumina-terminal/TerminalWidget.cpp') 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); +} -- cgit