- enhancement: better processing of symbol completion

This commit is contained in:
Roy Qu 2022-03-02 15:45:43 +08:00
parent d93a41e496
commit 6a6f1a68e0
4 changed files with 53 additions and 8 deletions

View File

@ -10,6 +10,7 @@ Red Panda C++ Version 0.14.5
- fix: can't rename project files that not openned in editor
- enhancement: group undo will stop at spaces
- fix: menu font size is wrong when dpi changed
- enhancement: better processing of symbol completion
Red Panda C++ Version 0.14.4
- enhancement: git - log

View File

@ -2077,14 +2077,25 @@ bool Editor::handleParentheseSkip()
}
if (status != QuoteStatus::NotQuote)
return false;
BufferCoord pos = getMatchingBracket();
if (pos.Line != 0) {
if (!highlighter())
return false;
if (lines()->count()==0)
return false;
SynRangeState lastLineState = lines()->ranges(lines()->count()-1);
if (lastLineState.parenthesisLevel==0) {
setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over
return true;
}
return false;
// BufferCoord pos = getMatchingBracket();
// if (pos.Line != 0) {
// setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over
// return true;
// }
// if FunctionTipAllowed then
// fFunctionTip.Activated := false;
return false;
// return false;
}
bool Editor::handleBracketCompletion()
@ -2105,11 +2116,20 @@ bool Editor::handleBracketSkip()
{
if (getCurrentChar() != ']')
return false;
BufferCoord pos = getMatchingBracket();
if (pos.Line != 0) {
if (!highlighter())
return false;
if (lines()->count()==0)
return false;
SynRangeState lastLineState = lines()->ranges(lines()->count()-1);
if (lastLineState.bracketLevel==0) {
setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over
return true;
}
// BufferCoord pos = getMatchingBracket();
// if (pos.Line != 0) {
// setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over
// return true;
// }
return false;
}
@ -2161,15 +2181,27 @@ bool Editor::handleBraceSkip()
{
if (getCurrentChar() != '}')
return false;
BufferCoord pos = getMatchingBracket();
if (pos.Line != 0) {
if (!highlighter())
return false;
if (lines()->count()==0)
return false;
SynRangeState lastLineState = lines()->ranges(lines()->count()-1);
if (lastLineState.braceLevel==0) {
bool oldInsertMode = insertMode();
setInsertMode(false); //set mode to overwrite
commandProcessor(SynEditorCommand::ecChar,'}');
setInsertMode(oldInsertMode);
// setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over
return true;
}
// BufferCoord pos = getMatchingBracket();
// if (pos.Line != 0) {
// bool oldInsertMode = insertMode();
// setInsertMode(false); //set mode to overwrite
// commandProcessor(SynEditorCommand::ecChar,'}');
// setInsertMode(oldInsertMode);
//// setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over
// return true;
// }
return false;
}

View File

@ -374,6 +374,8 @@ void SynEditCppHighlighter::braceCloseProc()
}
mRange.braceLevel -= 1;
if (mRange.braceLevel<0)
mRange.braceLevel = 0;
if (mRange.leftBraces>0) {
mRange.leftBraces--;
} else {
@ -909,6 +911,8 @@ void SynEditCppHighlighter::roundCloseProc()
mTokenId = TokenKind::Symbol;
mExtTokenId = ExtTokenKind::RoundClose;
mRange.parenthesisLevel--;
if (mRange.parenthesisLevel<0)
mRange.parenthesisLevel=0;
popIndents(sitParenthesis);
}
@ -983,6 +987,8 @@ void SynEditCppHighlighter::squareCloseProc()
mTokenId = TokenKind::Symbol;
mExtTokenId = ExtTokenKind::SquareClose;
mRange.bracketLevel--;
if (mRange.bracketLevel<0)
mRange.bracketLevel=0;
popIndents(sitBracket);
}

View File

@ -316,6 +316,8 @@ void SynEditGLSLHighlighter::braceCloseProc()
}
mRange.braceLevel -= 1;
if (mRange.braceLevel<0)
mRange.braceLevel = 0;
if (mRange.leftBraces>0) {
mRange.leftBraces--;
} else {
@ -851,6 +853,8 @@ void SynEditGLSLHighlighter::roundCloseProc()
mTokenId = TokenKind::Symbol;
mExtTokenId = ExtTokenKind::RoundClose;
mRange.parenthesisLevel--;
if (mRange.parenthesisLevel<0)
mRange.parenthesisLevel=0;
popIndents(sitParenthesis);
}
@ -925,6 +929,8 @@ void SynEditGLSLHighlighter::squareCloseProc()
mTokenId = TokenKind::Symbol;
mExtTokenId = ExtTokenKind::SquareClose;
mRange.bracketLevel--;
if (mRange.bracketLevel<0)
mRange.bracketLevel=0;
popIndents(sitBracket);
}