--- a/eric6/QScintilla/TypingCompleters/CompleterRuby.py Sat Oct 10 16:03:53 2020 +0200 +++ b/eric6/QScintilla/TypingCompleters/CompleterRuby.py Sun Oct 11 17:54:52 2020 +0200 @@ -7,10 +7,8 @@ Module implementing a typing completer for Ruby. """ - import re -from PyQt5.QtCore import QRegExp from PyQt5.Qsci import QsciLexerRuby, QsciScintilla from .CompleterBase import CompleterBase @@ -31,9 +29,9 @@ """ super(CompleterRuby, self).__init__(editor, parent) - self.__beginRX = QRegExp(r"""^=begin """) - self.__beginNlRX = QRegExp(r"""^=begin\r?\n""") - self.__hereRX = QRegExp(r"""<<-?['"]?(\w*)['"]?\r?\n""") + self.__beginRX = re.compile(r"""^=begin """) + self.__beginNlRX = re.compile(r"""^=begin\r?\n""") + self.__hereRX = re.compile(r"""<<-?['"]?(\w*)['"]?\r?\n""") self.readSettings() @@ -99,7 +97,7 @@ # complete inline documentation elif char == ' ': txt = self.editor.text(line)[:col] - if self.__insertInlineDoc and self.__beginRX.exactMatch(txt): + if self.__insertInlineDoc and self.__beginRX.fullmatch(txt): self.editor.insert('=end') # comma @@ -137,10 +135,10 @@ # indent to opening brace, complete inline documentation elif char == '\n': txt = self.editor.text(line - 1) - if self.__insertInlineDoc and self.__beginNlRX.exactMatch(txt): + if self.__insertInlineDoc and self.__beginNlRX.fullmatch(txt): self.editor.insert('=end') - elif self.__insertHereDoc and self.__hereRX.exactMatch(txt): - self.editor.insert(self.__hereRX.cap(1)) + elif self.__insertHereDoc and self.__hereRX.fullmatch(txt): + self.editor.insert(self.__hereRX.fullmatch(txt).group(1)) elif self.__indentBrace and re.search(":\r?\n", txt) is None: stxt = txt.strip() if stxt and stxt[-1] in ("(", "[", "{"):