--- a/eric6/QScintilla/EditorButtonsWidget.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/QScintilla/EditorButtonsWidget.py Thu Apr 15 18:11:24 2021 +0200 @@ -8,6 +8,8 @@ editor actions. """ +import contextlib + from PyQt5.QtCore import pyqtSlot, Qt from PyQt5.QtWidgets import ( QWidget, QVBoxLayout, QToolButton, QFrame, QMenu, QSizePolicy, QScrollArea @@ -305,11 +307,9 @@ elif formatName == "strikethrough": self.__provider.strikethrough(self.__editor) elif formatName.startswith("header"): - try: + with contextlib.suppress(ValueError): level = int(formatName[-1]) self.__provider.header(self.__editor, level) - except ValueError: - pass elif formatName == "code": self.__provider.code(self.__editor) elif formatName == "codeBlock":