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,14 +55,14 @@ Load APIs from one or more files
Loads a ``script`` file.
%End
bool isCursorInsideString() const;
bool isCursorInsideStringLiteralOrComment() const;
%Docstring
Check whether the current cursor position is inside a string or comment
.. versionadded:: 3.30
%End
QString characterBeforeCursor() const;
QString characterBeforeCursor( ) const;
%Docstring
Returns the character before the cursor, or an empty string if cursor is set at start

View File

@ -333,7 +333,7 @@ void QgsCodeEditorPython::keyPressEvent( QKeyEvent *event )
// Else, if not inside a string or comment and an opening 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
if ( !( ( eText == "\"" || eText == "'" ) && prevChar == eText ) )
@ -399,7 +399,7 @@ bool QgsCodeEditorPython::loadScript( const QString &script )
return true;
}
bool QgsCodeEditorPython::isCursorInsideString() const
bool QgsCodeEditorPython::isCursorInsideStringLiteralOrComment() const
{
int line, index;
getCursorPosition( &line, &index );