Skip to content

Commit 7580bb7

Browse files
committed
remove auto placed close bracket when removing opening (backspace only)
1 parent ae293f8 commit 7580bb7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/qcodeedit/lib/qeditor.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -4976,6 +4976,23 @@ void QEditor::processEditOperation(QDocumentCursor& c, const QKeyEvent* e, EditO
49764976
switch ( op )
49774977
{
49784978
case DeleteLeft :
4979+
// special treatment: remove auto completed parenthes as well if it it right next
4980+
if(flag(AutoCloseChars)){
4981+
for(int i=0;i<placeHolderCount();++i){
4982+
PlaceHolder ph=getPlaceHolder(i);
4983+
int startLine,startCol;
4984+
ph.cursor.beginBoundary(startLine,startCol);
4985+
if(!ph.autoRemoveIfLeft || startCol!=c.columnNumber() || startLine!=c.lineNumber()){
4986+
continue;
4987+
}
4988+
QChar ch=c.previousChar();
4989+
QString closingPar=languageDefinition()->getClosingParenthesis(ch);
4990+
if(closingPar.length()==1 && c.nextChar()==closingPar){
4991+
c.deleteChar();
4992+
}
4993+
break;
4994+
}
4995+
}
49794996
if(!hasSelection) c.deletePreviousChar();
49804997
cutBuffer.clear();
49814998
break;

0 commit comments

Comments
 (0)