Commit 7c77f7cc authored by Victor Yacovlev's avatar Victor Yacovlev

Extra layout correction triggers

parent 7701d345
Pipeline #355 passed with stages
in 28 minutes and 10 seconds
...@@ -135,7 +135,7 @@ void EditorPlane::contextMenuEvent(QContextMenuEvent *e) ...@@ -135,7 +135,7 @@ void EditorPlane::contextMenuEvent(QContextMenuEvent *e)
void EditorPlane::mousePressEvent(QMouseEvent *e) void EditorPlane::mousePressEvent(QMouseEvent *e)
{ {
escPressFlag_ = false; escPressFlag_ = false;
typeTextFlag_ = false;
emit message(QString()); emit message(QString());
// Ensure auto scrolling by timer is stopped // Ensure auto scrolling by timer is stopped
emit requestAutoScroll(0); emit requestAutoScroll(0);
...@@ -266,7 +266,10 @@ void EditorPlane::mousePressEvent(QMouseEvent *e) ...@@ -266,7 +266,10 @@ void EditorPlane::mousePressEvent(QMouseEvent *e)
textX += 1; textX += 1;
const uint textY = realY / lineHeight(); const uint textY = realY / lineHeight();
if (typeTextFlag_) {
tryCorrectKeyboardLayoutForLastLexem();
typeTextFlag_ = false;
}
// Move text cursor into clicked position // Move text cursor into clicked position
editor_->cursor()->moveTo(textY, textX); editor_->cursor()->moveTo(textY, textX);
...@@ -306,6 +309,7 @@ void EditorPlane::mousePressEvent(QMouseEvent *e) ...@@ -306,6 +309,7 @@ void EditorPlane::mousePressEvent(QMouseEvent *e)
// Set repaint flag due to something may be changed and accept event // Set repaint flag due to something may be changed and accept event
update(); update();
e->accept(); e->accept();
typeTextFlag_ = false;
} }
/** Handles mouse button release event /** Handles mouse button release event
...@@ -1389,6 +1393,8 @@ void EditorPlane::keyPressEvent(QKeyEvent *e) ...@@ -1389,6 +1393,8 @@ void EditorPlane::keyPressEvent(QKeyEvent *e)
emit message(QString()); emit message(QString());
if (MoveToNextChar) { if (MoveToNextChar) {
if (typeTextFlag_)
tryCorrectKeyboardLayoutForLastLexem();
editor_->cursor()->evaluateCommand(KeyCommand::MoveToNextChar); editor_->cursor()->evaluateCommand(KeyCommand::MoveToNextChar);
} }
else if (SelectNextChar) { else if (SelectNextChar) {
...@@ -1404,6 +1410,8 @@ void EditorPlane::keyPressEvent(QKeyEvent *e) ...@@ -1404,6 +1410,8 @@ void EditorPlane::keyPressEvent(QKeyEvent *e)
editor_->cursor()->evaluateCommand(KeyCommand::SelectNextColumn); editor_->cursor()->evaluateCommand(KeyCommand::SelectNextColumn);
} }
else if (MoveToPreviousChar) { else if (MoveToPreviousChar) {
if (typeTextFlag_)
tryCorrectKeyboardLayoutForLastLexem();
editor_->cursor()->evaluateCommand(KeyCommand::MoveToPreviousChar); editor_->cursor()->evaluateCommand(KeyCommand::MoveToPreviousChar);
} }
else if (SelectPreviousChar) { else if (SelectPreviousChar) {
...@@ -3097,7 +3105,7 @@ void EditorPlane::tryCorrectKeyboardLayoutForLastLexem() ...@@ -3097,7 +3105,7 @@ void EditorPlane::tryCorrectKeyboardLayoutForLastLexem()
QString replacement = tryCorrectKeyboardLayout(lexem); QString replacement = tryCorrectKeyboardLayout(lexem);
if (lexem!=replacement) { if (lexem!=replacement) {
for (int i=0; i<lexem.length(); ++i) { for (int i=0; i<lexem.length(); ++i) {
editor_->cursor_->evaluateCommand(KeyCommand::Backspace); editor_->cursor_->evaluateCommand(KeyCommand::SelectPreviousChar);
} }
editor_->cursor_->evaluateCommand(replacement); editor_->cursor_->evaluateCommand(replacement);
break; break;
......
...@@ -1546,6 +1546,8 @@ bool Lexer::isLanguageReservedName(const QString &lexem) const ...@@ -1546,6 +1546,8 @@ bool Lexer::isLanguageReservedName(const QString &lexem) const
{ {
if (_RxKeyWords.exactMatch(lexem) || _KeyWords.contains(lexem)) if (_RxKeyWords.exactMatch(lexem) || _KeyWords.contains(lexem))
return true; return true;
if (lexem==QString::fromUtf8("знач") || lexem==QString::fromUtf8("таб"))
return true;
if (_RxTypes.exactMatch(lexem)) if (_RxTypes.exactMatch(lexem))
return true; return true;
if (_RxConst.exactMatch(lexem)) if (_RxConst.exactMatch(lexem))
......
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