diff options
author | Ken Moore <moorekou@gmail.com> | 2016-04-13 15:52:26 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-04-13 15:52:26 -0400 |
commit | 7f78a894e72db03740068420edb31b20b4bc159d (patch) | |
tree | 88f7ee15e4602cfc42dd9bdb8f27ead66727bff7 /desktop-utilities | |
parent | Get some more of the terminal cleaned up. (diff) | |
download | lumina-7f78a894e72db03740068420edb31b20b4bc159d.tar.gz lumina-7f78a894e72db03740068420edb31b20b4bc159d.tar.bz2 lumina-7f78a894e72db03740068420edb31b20b4bc159d.zip |
Fix up some selection/cursor handling so the user cannot change the current cursor position in the widget.
Diffstat (limited to 'desktop-utilities')
-rw-r--r-- | desktop-utilities/lumina-terminal/TerminalWidget.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/desktop-utilities/lumina-terminal/TerminalWidget.cpp b/desktop-utilities/lumina-terminal/TerminalWidget.cpp index 5b6e03cd..0faa45ff 100644 --- a/desktop-utilities/lumina-terminal/TerminalWidget.cpp +++ b/desktop-utilities/lumina-terminal/TerminalWidget.cpp @@ -430,32 +430,32 @@ void TerminalWidget::mousePressEvent(QMouseEvent *ev){ }else if(ev->button()==Qt::MiddleButton){ pasteSelection(); }else if(ev->button()==Qt::LeftButton){ - lastCursor = this->textCursor(); + if(this->textCursor()!=selCursor){ lastCursor = this->textCursor(); } selCursor = this->cursorForPosition(ev->pos()); - }else{ - Q_UNUSED(ev); } + Q_UNUSED(ev); } void TerminalWidget::mouseMoveEvent(QMouseEvent *ev){ if(ev->button()==Qt::LeftButton){ selCursor.setPosition(this->cursorForPosition(ev->pos()).position(), QTextCursor::KeepAnchor); - this->setTextCursor(selCursor); + if(selCursor.hasSelection()){ this->setTextCursor(selCursor); } }else{ QTextEdit::mouseMoveEvent(ev); } } + void TerminalWidget::mouseReleaseEvent(QMouseEvent *ev){ if(ev->button()==Qt::LeftButton){ selCursor.setPosition(this->cursorForPosition(ev->pos()).position(), QTextCursor::KeepAnchor); - this->setTextCursor(selCursor); + if(selCursor.hasSelection()){ this->setTextCursor(selCursor); } + else{ this->setTextCursor(lastCursor); } }else if(ev->button()==Qt::RightButton){ copyA->setEnabled( selCursor.hasSelection() ); pasteA->setEnabled( !QApplication::clipboard()->text().isEmpty() ); contextMenu->popup( this->mapToGlobal(ev->pos()) ); - }else{ - Q_UNUSED(ev); } + Q_UNUSED(ev); } void TerminalWidget::mouseDoubleClickEvent(QMouseEvent *ev){ |