# Date 1736890686 18000
# Tue Jan 14 16:38:06 2025 -0500
# Branch stable
# Node ID 92fd6dc326551c4757df18c699324bf2d1011f82
# Parent 2b06d75337948f524590ec3b43ea3acdea553612
# EXP-Topic issue-6003
qt5: apply the recent lexer fix to all other users
With the lexer font issue seemingly fixed with a known reproducible problem in
the previous commit, apply that same change (set font before setting a lexer,
but after clearing a lexer) to all of the other places with a similar pattern.
This is basically a backout of 95ab09489701, and reapplying it more carefully.
There were a few other changes in that commit that are unaffected, because they
were near an unconditional setting of a lexer.
diff --git a/tortoisehg/hgqt/filedialogs.py b/tortoisehg/hgqt/filedialogs.py
--- a/tortoisehg/hgqt/filedialogs.py
+++ b/tortoisehg/hgqt/filedialogs.py
@@ -523,8 +523,10 @@
sci.setMarginLineNumbers(1, True)
sci.SendScintilla(sci.SCI_SETSELEOLFILLED, True)
- sci.setFont(qtlib.getfont('fontdiff').font())
+ font = qtlib.getfont('fontdiff').font()
+ sci.setFont(font)
sci.setLexer(lexer)
+ sci.setFont(font)
sci.setReadOnly(True)
sci.setUtf8(True)
diff --git a/tortoisehg/hgqt/messageentry.py b/tortoisehg/hgqt/messageentry.py
--- a/tortoisehg/hgqt/messageentry.py
+++ b/tortoisehg/hgqt/messageentry.py
@@ -76,13 +76,14 @@
def applylexer(self):
font = qtlib.getfont('fontcomment').font()
self.fontHeight = QFontMetrics(font).height()
- self.setFont(font)
if qtlib.readBool(QSettings(), 'msgentry/lexer', True):
+ self.setFont(font)
self.setLexer(QsciLexerMakefile(self))
self.lexer().setColor(QColor(Qt.GlobalColor.red), QsciLexerMakefile.Error)
self.lexer().setFont(font)
else:
self.setLexer(None)
+ self.setFont(font)
@pyqtSlot(QPoint)
def menuRequested(self, point):
diff --git a/tortoisehg/hgqt/rejects.py b/tortoisehg/hgqt/rejects.py
--- a/tortoisehg/hgqt/rejects.py
+++ b/tortoisehg/hgqt/rejects.py
@@ -126,8 +126,12 @@
return
earlybytes = hglib.fromunicode(editor.text(), 'replace')[:4096]
lexer = lexers.getlexer(ui, hglib.tounicode(path), earlybytes, self)
- editor.setFont(qtlib.getfont('fontlog').font())
+
+ font = qtlib.getfont('fontlog').font()
+ editor.setFont(font)
editor.setLexer(lexer)
+ editor.setFont(font)
+
editor.setMarginLineNumbers(1, True)
editor.setMarginWidth(1, str(editor.lines())+'X')