mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
let Shift+Enter to insert two spaces and a new line
This commit is contained in:
parent
58bc995924
commit
de4e5fef8e
@ -741,6 +741,17 @@ bool VMdEditOperations::handleKeyReturn(QKeyEvent *p_event)
|
||||
if (p_event->modifiers() & Qt::ControlModifier) {
|
||||
m_autoIndentPos = -1;
|
||||
return false;
|
||||
} else if (p_event->modifiers() & Qt::ShiftModifier) {
|
||||
// Insert two spaces and a new line.
|
||||
m_autoIndentPos = -1;
|
||||
|
||||
QTextCursor cursor = m_editor->textCursor();
|
||||
cursor.beginEditBlock();
|
||||
cursor.removeSelectedText();
|
||||
cursor.insertText(" ");
|
||||
cursor.endEditBlock();
|
||||
|
||||
// Let remaining logics handle inserting the new block.
|
||||
}
|
||||
|
||||
// See if we need to cancel auto indent.
|
||||
@ -783,6 +794,7 @@ bool VMdEditOperations::handleKeyReturn(QKeyEvent *p_event)
|
||||
m_autoIndentPos = m_editor->textCursor().position();
|
||||
}
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user