This commit is contained in:
Yoann Quenach de Quivillic 2023-01-10 00:41:59 +01:00 committed by Nyall Dawson
parent f1843ef2ab
commit 59332e0984
2 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ Load APIs from one or more files
Loads a ``script`` file. Loads a ``script`` file.
%End %End
bool isCursorInsideString() const; bool isCursorInsideStringLiteralOrComment() const;
%Docstring %Docstring
Check whether the current cursor position is inside a string or comment Check whether the current cursor position is inside a string or comment

View File

@ -333,7 +333,7 @@ void QgsCodeEditorPython::keyPressEvent( QKeyEvent *event )
// Else, if not inside a string or comment and an opening character // Else, if not inside a string or comment and an opening character
// is entered, also insert the closing character // is entered, also insert the closing character
else if ( !isCursorInsideString() && PAIRS.contains( eText ) ) else if ( !isCursorInsideStringLiteralOrComment() && PAIRS.contains( eText ) )
{ {
// Check if user is not entering triple quotes // Check if user is not entering triple quotes
if ( !( ( eText == "\"" || eText == "'" ) && prevChar == eText ) ) if ( !( ( eText == "\"" || eText == "'" ) && prevChar == eText ) )
@ -399,7 +399,7 @@ bool QgsCodeEditorPython::loadScript( const QString &script )
return true; return true;
} }
bool QgsCodeEditorPython::isCursorInsideString() const bool QgsCodeEditorPython::isCursorInsideStringLiteralOrComment() const
{ {
int line, index; int line, index;
getCursorPosition( &line, &index ); getCursorPosition( &line, &index );