fixed shift+(home/end)

This commit is contained in:
fourtf 2019-08-26 11:11:02 +02:00
parent 77aec1d3eb
commit 748920e8fd

View file

@ -255,7 +255,11 @@ void SplitInput::installKeyPressedEvent()
else if (event->key() == Qt::Key_Home) else if (event->key() == Qt::Key_Home)
{ {
QTextCursor cursor = this->ui_.textEdit->textCursor(); QTextCursor cursor = this->ui_.textEdit->textCursor();
cursor.movePosition(QTextCursor::Start); cursor.movePosition(
QTextCursor::Start,
event->modifiers() & Qt::KeyboardModifier::ShiftModifier
? QTextCursor::MoveMode::KeepAnchor
: QTextCursor::MoveMode::MoveAnchor);
this->ui_.textEdit->setTextCursor(cursor); this->ui_.textEdit->setTextCursor(cursor);
event->accept(); event->accept();
@ -263,7 +267,11 @@ void SplitInput::installKeyPressedEvent()
else if (event->key() == Qt::Key_End) else if (event->key() == Qt::Key_End)
{ {
QTextCursor cursor = this->ui_.textEdit->textCursor(); QTextCursor cursor = this->ui_.textEdit->textCursor();
cursor.movePosition(QTextCursor::End); cursor.movePosition(
QTextCursor::End,
event->modifiers() & Qt::KeyboardModifier::ShiftModifier
? QTextCursor::MoveMode::KeepAnchor
: QTextCursor::MoveMode::MoveAnchor);
this->ui_.textEdit->setTextCursor(cursor); this->ui_.textEdit->setTextCursor(cursor);
event->accept(); event->accept();