Commit 84bacc80 authored by mae's avatar mae
Browse files

Use proper standard keysequences for MoveTo/Select

StartOfLine/StartOfBlock. Eventually we want to switch all that to
actions, so we can have unix-style input also on the mac and vice versa
by setting different keybinding schemes.
parent b14de18b
......@@ -898,6 +898,27 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e)
e->accept();
setTextCursor(cursor);
return;
} else if (!ro
&& (e == QKeySequence::MoveToStartOfBlock
|| e == QKeySequence::SelectStartOfBlock)){
if ((e->modifiers() & (Qt::AltModifier | Qt::ShiftModifier)) == (Qt::AltModifier | Qt::ShiftModifier))
d->m_lastEventWasBlockSelectionEvent = true;
handleHomeKey(e == QKeySequence::SelectStartOfBlock);
e->accept();
return;
} else if (!ro
&& (e == QKeySequence::MoveToStartOfLine
|| e == QKeySequence::SelectStartOfLine)){
if ((e->modifiers() & (Qt::AltModifier | Qt::ShiftModifier)) == (Qt::AltModifier | Qt::ShiftModifier))
d->m_lastEventWasBlockSelectionEvent = true;
QTextCursor cursor = textCursor();
if (QTextLayout *layout = cursor.block().layout()) {
if (layout->lineForTextPosition(cursor.position() - cursor.block().position()).lineNumber() == 0) {
handleHomeKey(e == QKeySequence::SelectStartOfLine);
e->accept();
return;
}
}
} else switch (e->key()) {
......@@ -948,15 +969,6 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e)
return;
}
break;
case Qt::Key_Home:
if (!(e == QKeySequence::MoveToStartOfDocument) && !(e == QKeySequence::SelectStartOfDocument)) {
if ((e->modifiers() & (Qt::AltModifier | Qt::ShiftModifier)) == (Qt::AltModifier | Qt::ShiftModifier))
d->m_lastEventWasBlockSelectionEvent = true;
handleHomeKey(e->modifiers() & Qt::ShiftModifier);
e->accept();
return;
}
break;
case Qt::Key_Up:
case Qt::Key_Down:
if (e->modifiers() & Qt::ControlModifier) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment