- 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: Project makefile generated for C files is not correct.
|
||||||
- fix: Horizontal scroll by touchpad is not working.
|
- fix: Horizontal scroll by touchpad is not working.
|
||||||
- fix: Horizontal scroll by touchpad is inversed.
|
- fix: Horizontal scroll by touchpad is inversed.
|
||||||
|
- enhancement: Auto skip ; and , when input.
|
||||||
|
|
||||||
Red Panda C++ Version 2.20
|
Red Panda C++ Version 2.20
|
||||||
|
|
||||||
|
|
|
@ -1005,6 +1005,8 @@ void Editor::keyPressEvent(QKeyEvent *event)
|
||||||
case ']':
|
case ']':
|
||||||
case '<':
|
case '<':
|
||||||
case '*':
|
case '*':
|
||||||
|
case ';':
|
||||||
|
case ',':
|
||||||
handled = handleSymbolCompletion(ch);
|
handled = handleSymbolCompletion(ch);
|
||||||
return;
|
return;
|
||||||
case '(': {
|
case '(': {
|
||||||
|
@ -2561,6 +2563,20 @@ bool Editor::handleSymbolCompletion(QChar key)
|
||||||
return handleGlobalIncludeSkip();
|
return handleGlobalIncludeSkip();
|
||||||
}
|
}
|
||||||
return false;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2758,6 +2774,29 @@ bool Editor::handleBraceSkip()
|
||||||
return false;
|
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()
|
bool Editor::handleSingleQuoteCompletion()
|
||||||
{
|
{
|
||||||
QuoteStatus status = getQuoteStatus();
|
QuoteStatus status = getQuoteStatus();
|
||||||
|
|
|
@ -254,6 +254,8 @@ private:
|
||||||
bool handleMultilineCommentCompletion();
|
bool handleMultilineCommentCompletion();
|
||||||
bool handleBraceCompletion();
|
bool handleBraceCompletion();
|
||||||
bool handleBraceSkip();
|
bool handleBraceSkip();
|
||||||
|
bool handleSemiColonSkip();
|
||||||
|
bool handlePeriodSkip();
|
||||||
bool handleSingleQuoteCompletion();
|
bool handleSingleQuoteCompletion();
|
||||||
bool handleDoubleQuoteCompletion();
|
bool handleDoubleQuoteCompletion();
|
||||||
bool handleGlobalIncludeCompletion();
|
bool handleGlobalIncludeCompletion();
|
||||||
|
|
Loading…
Reference in New Issue