- fix: parenthesis skip doesn't work when editing non-c/c++ files
This commit is contained in:
parent
94a99e983e
commit
9254a13d84
3
NEWS.md
3
NEWS.md
|
@ -3,9 +3,10 @@ Red Panda C++ Version 1.0.4
|
|||
- enhancement: add help link for regular expression in search dialog
|
||||
- enhancement: remember current problem set's filename
|
||||
- enhancement: F1 shorcut opens offcial website
|
||||
- enhancement: don't auto complete '(', if the next non-space char is neither '(' nor ident char
|
||||
- enhancement: don't auto complete '(', if the next non-space char is '(' or ident char
|
||||
- enhancement: if a project's unit encoding is the same with project's encoding, don't save its encoding
|
||||
- fix: files will be saved to default encoding inspite of its original encoding
|
||||
- fix: parenthesis skip doesn't work when editing non-c/c++ files
|
||||
|
||||
Red Panda C++ Version 1.0.3
|
||||
- fix: when oj problem grabbed by competitive companion received,
|
||||
|
|
|
@ -2165,24 +2165,22 @@ bool Editor::handleParentheseSkip()
|
|||
if (status != QuoteStatus::NotQuote)
|
||||
return false;
|
||||
|
||||
if (!highlighter())
|
||||
return false;
|
||||
if (lines()->count()==0)
|
||||
return false;
|
||||
if (highlighter()) {
|
||||
SynRangeState lastLineState = lines()->ranges(lines()->count()-1);
|
||||
if (lastLineState.parenthesisLevel==0) {
|
||||
setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
BufferCoord pos = getMatchingBracket();
|
||||
if (pos.Line != 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;
|
||||
}
|
||||
|
||||
bool Editor::handleBracketCompletion()
|
||||
|
@ -2217,20 +2215,22 @@ bool Editor::handleBracketSkip()
|
|||
{
|
||||
if (getCurrentChar() != ']')
|
||||
return false;
|
||||
if (!highlighter())
|
||||
return false;
|
||||
|
||||
if (lines()->count()==0)
|
||||
return false;
|
||||
if (highlighter()) {
|
||||
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;
|
||||
// }
|
||||
} else {
|
||||
BufferCoord pos = getMatchingBracket();
|
||||
if (pos.Line != 0) {
|
||||
setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2301,10 +2301,10 @@ bool Editor::handleBraceSkip()
|
|||
{
|
||||
if (getCurrentChar() != '}')
|
||||
return false;
|
||||
if (!highlighter())
|
||||
return false;
|
||||
|
||||
if (lines()->count()==0)
|
||||
return false;
|
||||
if (highlighter()) {
|
||||
SynRangeState lastLineState = lines()->ranges(lines()->count()-1);
|
||||
if (lastLineState.braceLevel==0) {
|
||||
bool oldInsertMode = insertMode();
|
||||
|
@ -2313,15 +2313,16 @@ bool Editor::handleBraceSkip()
|
|||
setInsertMode(oldInsertMode);
|
||||
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;
|
||||
// }
|
||||
} else {
|
||||
BufferCoord pos = getMatchingBracket();
|
||||
if (pos.Line != 0) {
|
||||
bool oldInsertMode = insertMode();
|
||||
setInsertMode(false); //set mode to overwrite
|
||||
commandProcessor(SynEditorCommand::ecChar,'}');
|
||||
setInsertMode(oldInsertMode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue