diff -r ed8cb108b27b -r dce55f623991 eric6/QScintilla/Editor.py --- a/eric6/QScintilla/Editor.py Fri Apr 16 18:03:43 2021 +0200 +++ b/eric6/QScintilla/Editor.py Fri Apr 16 18:08:45 2021 +0200 @@ -5501,6 +5501,11 @@ self.menuActs["Uncomment"].setEnabled(False) self.menuActs["StreamComment"].setEnabled(False) self.menuActs["BoxComment"].setEnabled(False) + + cline = self.getCursorPosition()[0] + line = self.text(cline) + self.menuActs["Docstring"].setEnabled( + self.getDocstringGenerator().isFunctionStart(line)) self.menuActs["TypingAidsEnabled"].setEnabled( self.completer is not None) @@ -5539,11 +5544,6 @@ self.menuActs["Tools"].setEnabled(not self.toolsMenu.isEmpty()) - cline = self.getCursorPosition()[0] - line = self.text(cline) - self.menuActs["Docstring"].setEnabled( - self.getDocstringGenerator().isFunctionStart(line)) - self.showMenu.emit("Main", self.menu, self) def __showContextMenuAutocompletion(self):