eric6/QScintilla/TypingCompleters/CompleterRuby.py

changeset 8222
5994b80b8760
parent 8218
7c09585bd960
equal deleted inserted replaced
8221:0572a215bd2f 8222:5994b80b8760
86 86
87 # closing parenthesis 87 # closing parenthesis
88 # skip matching closing parenthesis 88 # skip matching closing parenthesis
89 elif char in [')', '}', ']']: 89 elif char in [')', '}', ']']:
90 txt = self.editor.text(line) 90 txt = self.editor.text(line)
91 if col < len(txt) and char == txt[col]: 91 if col < len(txt) and char == txt[col] and self.__skipBrace:
92 if self.__skipBrace: 92 self.editor.setSelection(line, col, line, col + 1)
93 self.editor.setSelection(line, col, line, col + 1) 93 self.editor.removeSelectedText()
94 self.editor.removeSelectedText()
95 94
96 # space 95 # space
97 # complete inline documentation 96 # complete inline documentation
98 elif char == ' ': 97 elif char == ' ':
99 txt = self.editor.text(line)[:col] 98 txt = self.editor.text(line)[:col]
100 if self.__insertInlineDoc and self.__beginRX.fullmatch(txt): 99 if self.__insertInlineDoc and self.__beginRX.fullmatch(txt):
101 self.editor.insert('=end') 100 self.editor.insert('=end')
102 101
103 # comma 102 # comma
104 # insert blank 103 # insert blank
105 elif char == ',': 104 elif char == ',' and self.__insertBlank:
106 if self.__insertBlank: 105 self.editor.insert(' ')
107 self.editor.insert(' ') 106 self.editor.setCursorPosition(line, col + 1)
108 self.editor.setCursorPosition(line, col + 1)
109 107
110 # open curly brace 108 # open curly brace
111 # insert closing brace 109 # insert closing brace
112 elif char == '{': 110 elif char == '{' and self.__insertClosingBrace:
113 if self.__insertClosingBrace: 111 self.editor.insert('}')
114 self.editor.insert('}')
115 112
116 # open bracket 113 # open bracket
117 # insert closing bracket 114 # insert closing bracket
118 elif char == '[': 115 elif char == '[' and self.__insertClosingBrace:
119 if self.__insertClosingBrace: 116 self.editor.insert(']')
120 self.editor.insert(']')
121 117
122 # double quote 118 # double quote
123 # insert double quote 119 # insert double quote
124 elif char == '"': 120 elif char == '"' and self.__insertQuote:
125 if self.__insertQuote: 121 self.editor.insert('"')
126 self.editor.insert('"')
127 122
128 # quote 123 # quote
129 # insert quote 124 # insert quote
130 elif char == '\'': 125 elif char == '\'' and self.__insertQuote:
131 if self.__insertQuote: 126 self.editor.insert('\'')
132 self.editor.insert('\'')
133 127
134 # new line 128 # new line
135 # indent to opening brace, complete inline documentation 129 # indent to opening brace, complete inline documentation
136 elif char == '\n': 130 elif char == '\n':
137 txt = self.editor.text(line - 1) 131 txt = self.editor.text(line - 1)

eric ide

mercurial