Closed zufuliu closed 1 year ago
This patch changes several portions of code and some of the change seems unrelated and result in different interpretations of input. The hunk for case SCE_SH_IDENTIFIER
changes the styling for this expression involving zsh arithmetic extensions,
(( #var+10 ))
{7}(({0} {8}#var{7}+{3}10{0} {7})){0}
Changes to
{7}(({0} {8}#var+10{0} {7})){0}
bash-line-continuation-0813.patch
Reverted removing of (cmdState == CmdState::Arithmetic && !setWordStart.Contains(sc.ch))
, that cause the failure.
Fixed zsh print $(( ##\M-\C-x+0 ))
regression.
bash-line-continuation-0816.patch
The case of $(( ##\M-\C-x+0 ))
wasn't really a regression as it fails both before and after. Key definitions seem rare enough to not be worth implementing.
bash-comment-line-continuation.patch Patch to remove line continuation from comment line:
diff --git a/lexers/LexBash.cxx b/lexers/LexBash.cxx
index d9506690..a183cb8a 100644
--- a/lexers/LexBash.cxx
+++ b/lexers/LexBash.cxx
@@ -173,7 +173,7 @@ bool IsCommentLine(Sci_Position line, LexAccessor &styler) {
}
constexpr bool StyleForceBacktrack(int state) noexcept {
- return AnyOf(state, SCE_SH_CHARACTER, SCE_SH_STRING, SCE_SH_BACKTICKS, SCE_SH_HERE_Q, SCE_SH_PARAM, SCE_SH_COMMENTLINE);
+ return AnyOf(state, SCE_SH_CHARACTER, SCE_SH_STRING, SCE_SH_BACKTICKS, SCE_SH_HERE_Q, SCE_SH_PARAM);
}
struct OptionsBash {
@@ -770,7 +770,7 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int
sc.SetState(SCE_SH_DEFAULT | insideCommand);
break;
case SCE_SH_COMMENTLINE:
- if (sc.MatchLineEnd() && sc.chPrev != '\\') {
+ if (sc.MatchLineEnd()) {
sc.SetState(SCE_SH_DEFAULT | insideCommand);
}
break;
following code should check whether previous line ends with odd number of backslashes (where last one colored as
SCE_SH_OPERATOR
): https://github.com/ScintillaOrg/lexilla/blob/9b45aaf0c4938b2a44fd22a256cdea574a1628cb/lexers/LexBash.cxx#L603-L610test case:
C shell equivalent for above
if
block:bash-line-continuation.patch
The patch can be committed before #194 to avoid overlapped changes. also it doesn't change comment line handing (https://sourceforge.net/p/scintilla/bugs/2226/).