|
|
@@ -665,8 +665,9 @@ void VMdEditor::clearUnusedImages()
|
|
|
|
|
|
void VMdEditor::keyPressEvent(QKeyEvent *p_event)
|
|
|
{
|
|
|
+ int key = p_event->key();
|
|
|
int modifiers = p_event->modifiers();
|
|
|
- switch (p_event->key()) {
|
|
|
+ switch (key) {
|
|
|
case Qt::Key_Minus:
|
|
|
case Qt::Key_Underscore:
|
|
|
// Zoom out.
|
|
|
@@ -709,6 +710,12 @@ void VMdEditor::keyPressEvent(QKeyEvent *p_event)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ // Esc to exit edit mode when Vim is disabled.
|
|
|
+ if (key == Qt::Key_Escape) {
|
|
|
+ emit m_object->discardAndRead();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
VTextEdit::keyPressEvent(p_event);
|
|
|
}
|
|
|
|