From 941adaa4a8a3e5e0afac3662bcec5f1445e424a4 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Sun, 16 Oct 2022 14:25:54 +1000 Subject: [PATCH] Some more code to base class --- python/console/console_sci.py | 12 ------------ src/gui/codeeditors/qgscodeeditor.cpp | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/python/console/console_sci.py b/python/console/console_sci.py index 2c421304780..3e0c5611b74 100644 --- a/python/console/console_sci.py +++ b/python/console/console_sci.py @@ -172,18 +172,6 @@ class ShellScintilla(QgsCodeEditorPython): self.sessionHistoryCleared.connect(self.on_session_history_cleared) self.persistentHistoryCleared.connect(self.on_persistent_history_cleared) - def initializeLexer(self): - super().initializeLexer() - self.setCaretLineVisible(False) - self.setLineNumbersVisible(False) # NO linenumbers for the input line - self.setFoldingVisible(False) - # Margin 1 is used for the '>>>' prompt (console input) - self.setMarginLineNumbers(1, True) - self.setMarginWidth(1, "00000") - self.setMarginType(1, 5) # TextMarginRightJustified=5 - self.setMarginsBackgroundColor(self.color(QgsCodeEditorColorScheme.ColorRole.Background)) - self.setEdgeMode(QsciScintilla.EdgeNone) - def _setMinimumHeight(self): font = self.lexer().defaultFont(0) fm = QFontMetrics(font) diff --git a/src/gui/codeeditors/qgscodeeditor.cpp b/src/gui/codeeditors/qgscodeeditor.cpp index 3b07823a56a..a12fe0db616 100644 --- a/src/gui/codeeditors/qgscodeeditor.cpp +++ b/src/gui/codeeditors/qgscodeeditor.cpp @@ -313,6 +313,18 @@ void QgsCodeEditor::runPostLexerConfigurationTasks() SendScintilla( SCI_MARKERSETBACK, SC_MARKNUM_FOLDER, lexerColor( QgsCodeEditorColorScheme::ColorRole::FoldIconForeground ) ); SendScintilla( SCI_STYLESETFORE, STYLE_INDENTGUIDE, lexerColor( QgsCodeEditorColorScheme::ColorRole::IndentationGuide ) ); SendScintilla( SCI_STYLESETBACK, STYLE_INDENTGUIDE, lexerColor( QgsCodeEditorColorScheme::ColorRole::IndentationGuide ) ); + + if ( mMode == QgsCodeEditor::Mode::CommandInput ) + { + setCaretLineVisible( false ); + setLineNumbersVisible( false ); // NO linenumbers for the input line + // Margin 1 is used for the '>' prompt (console input) + setMarginLineNumbers( 1, true ); + setMarginWidth( 1, "00000" ); + setMarginType( 1, QsciScintilla::MarginType::TextMarginRightJustified ); + setMarginsBackgroundColor( color( QgsCodeEditorColorScheme::ColorRole::Background ) ); + setEdgeMode( QsciScintilla::EdgeNone ); + } } void QgsCodeEditor::setSciWidget()