Enhance auto-insert for quotes and double quotes

Enhance auto-insert behaviour for quotes and double quotes inside of
parenthesis or bracket.
pull/1003/head
Don Ho 2015-10-13 12:16:04 +02:00
parent 963d7fc885
commit e81ac898c0
1 changed files with 8 additions and 2 deletions

View File

@ -575,7 +575,10 @@ void AutoCompletion::insertMatchedChars(int character, const MatchedPairConf & m
}
}
if (isCharPrevBlank && isCharNextBlank)
if ((isCharPrevBlank && isCharNextBlank) ||
(charPrev == '(' && charNext == ')') || (charPrev == '(' && isCharNextBlank) || (isCharPrevBlank && charNext == ')') ||
(charPrev == '[' && charNext == ']') || (charPrev == '[' && isCharNextBlank) || (isCharPrevBlank && charNext == ']') ||
(charPrev == '{' && charNext == '}') || (charPrev == '{' && isCharNextBlank) || (isCharPrevBlank && charNext == '}'))
{
matchedChars = "\"";
_insertedMatchedChars.add(MatchedCharInserted(char(character), caretPos - 1));
@ -596,7 +599,10 @@ void AutoCompletion::insertMatchedChars(int character, const MatchedPairConf & m
}
}
if (isCharPrevBlank && isCharNextBlank)
if ((isCharPrevBlank && isCharNextBlank) ||
(charPrev == '(' && charNext == ')') || (charPrev == '(' && isCharNextBlank) || (isCharPrevBlank && charNext == ')') ||
(charPrev == '[' && charNext == ']') || (charPrev == '[' && isCharNextBlank) || (isCharPrevBlank && charNext == ']') ||
(charPrev == '{' && charNext == '}') || (charPrev == '{' && isCharNextBlank) || (isCharPrevBlank && charNext == '}'))
{
matchedChars = "'";
_insertedMatchedChars.add(MatchedCharInserted(char(character), caretPos - 1));