- enhancement: Auto skip ; and , when input.
This commit is contained in:
parent
ba218fb8b8
commit
aded956ca8
1
NEWS.md
1
NEWS.md
|
@ -4,6 +4,7 @@ Red Panda C++ Version 2.21
|
|||
- fix: Project makefile generated for C files is not correct.
|
||||
- fix: Horizontal scroll by touchpad is not working.
|
||||
- fix: Horizontal scroll by touchpad is inversed.
|
||||
- enhancement: Auto skip ; and , when input.
|
||||
|
||||
Red Panda C++ Version 2.20
|
||||
|
||||
|
|
|
@ -1005,6 +1005,8 @@ void Editor::keyPressEvent(QKeyEvent *event)
|
|||
case ']':
|
||||
case '<':
|
||||
case '*':
|
||||
case ';':
|
||||
case ',':
|
||||
handled = handleSymbolCompletion(ch);
|
||||
return;
|
||||
case '(': {
|
||||
|
@ -2561,6 +2563,20 @@ bool Editor::handleSymbolCompletion(QChar key)
|
|||
return handleGlobalIncludeSkip();
|
||||
}
|
||||
return false;
|
||||
case ';':
|
||||
if (selAvail())
|
||||
return false;
|
||||
if (pSettings->editor().overwriteSymbols()) {
|
||||
return handleSemiColonSkip();
|
||||
}
|
||||
return false;
|
||||
case ',':
|
||||
if (selAvail())
|
||||
return false;
|
||||
if (pSettings->editor().overwriteSymbols()) {
|
||||
return handlePeriodSkip();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -2758,6 +2774,29 @@ bool Editor::handleBraceSkip()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Editor::handleSemiColonSkip()
|
||||
{
|
||||
if (getCurrentChar() != ';')
|
||||
return false;
|
||||
bool oldInsertMode = insertMode();
|
||||
setInsertMode(false); //set mode to overwrite
|
||||
processCommand(QSynedit::EditCommand::Char,';');
|
||||
setInsertMode(oldInsertMode);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Editor::handlePeriodSkip()
|
||||
{
|
||||
if (getCurrentChar() != ',')
|
||||
return false;
|
||||
|
||||
bool oldInsertMode = insertMode();
|
||||
setInsertMode(false); //set mode to overwrite
|
||||
processCommand(QSynedit::EditCommand::Char,',');
|
||||
setInsertMode(oldInsertMode);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Editor::handleSingleQuoteCompletion()
|
||||
{
|
||||
QuoteStatus status = getQuoteStatus();
|
||||
|
|
|
@ -254,6 +254,8 @@ private:
|
|||
bool handleMultilineCommentCompletion();
|
||||
bool handleBraceCompletion();
|
||||
bool handleBraceSkip();
|
||||
bool handleSemiColonSkip();
|
||||
bool handlePeriodSkip();
|
||||
bool handleSingleQuoteCompletion();
|
||||
bool handleDoubleQuoteCompletion();
|
||||
bool handleGlobalIncludeCompletion();
|
||||
|
|
Loading…
Reference in New Issue