mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
Fix white over grey at invalid JSON in current line
The default style for invalid JSON or unclosed strings uses red background and white foreground, but the current line has precedence, so it is by default white over grey. We change the default to something more readable for the current line at invalid JSON. See issue #1173.
This commit is contained in:
@@ -124,7 +124,24 @@ void JsonTextEdit::reloadSettings()
|
||||
setupSyntaxHighlightingFormat("table", QsciLexerJSON::Number);
|
||||
setupSyntaxHighlightingFormat("identifier", QsciLexerJSON::Property);
|
||||
jsonLexer->setHighlightComments(true);
|
||||
|
||||
|
||||
// The default style for invalid JSON or unclosed strings uses red
|
||||
// background and white foreground, but the current line has
|
||||
// precedence, so it is by default white over gray. We change the
|
||||
// default to something more readable for the current line at
|
||||
// invalid JSON.
|
||||
QColor stringColor = QColor(Settings::getValue("syntaxhighlighter", "string_colour").toString());
|
||||
jsonLexer->setColor(stringColor, QsciLexerJSON::Error);
|
||||
jsonLexer->setColor(stringColor, QsciLexerJSON::UnclosedString);
|
||||
QFont errorFont(Settings::getValue("editor", "font").toString());
|
||||
errorFont.setPointSize(Settings::getValue("editor", "fontsize").toInt());
|
||||
errorFont.setItalic(true);
|
||||
errorFont.setUnderline(true);
|
||||
jsonLexer->setFont(errorFont, QsciLexerJSON::Error);
|
||||
jsonLexer->setFont(errorFont, QsciLexerJSON::UnclosedString);
|
||||
jsonLexer->setPaper(jsonLexer->defaultPaper(QsciLexerJSON::String), QsciLexerJSON::Error);
|
||||
jsonLexer->setPaper(jsonLexer->defaultPaper(QsciLexerJSON::String), QsciLexerJSON::UnclosedString);
|
||||
|
||||
// Set font
|
||||
QFont font(Settings::getValue("editor", "font").toString());
|
||||
font.setStyleHint(QFont::TypeWriter);
|
||||
|
||||
Reference in New Issue
Block a user