xmyshell 0.2.6__tar.gz → 0.2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xmyshell-0.2.6/xmyshell.egg-info → xmyshell-0.2.7}/PKG-INFO +1 -1
- {xmyshell-0.2.6 → xmyshell-0.2.7}/pyproject.toml +1 -1
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/completer.py +45 -1
- {xmyshell-0.2.6 → xmyshell-0.2.7/xmyshell.egg-info}/PKG-INFO +1 -1
- {xmyshell-0.2.6 → xmyshell-0.2.7}/LICENSE +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/README.md +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/setup.cfg +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/__init__.py +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/__main__.py +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/data/commands.json +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/environment.py +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/init.py +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/kernel.py +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/keybindings.py +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/lexer.py +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/main.py +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/meta.py +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/themes.py +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/update.py +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell/utils.py +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell.egg-info/SOURCES.txt +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell.egg-info/dependency_links.txt +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell.egg-info/entry_points.txt +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell.egg-info/requires.txt +0 -0
- {xmyshell-0.2.6 → xmyshell-0.2.7}/xmyshell.egg-info/top_level.txt +0 -0
|
@@ -172,6 +172,44 @@ class ShellCompleter(Completer):
|
|
|
172
172
|
)
|
|
173
173
|
|
|
174
174
|
def _python_completion(self, text: str):
|
|
175
|
+
|
|
176
|
+
def _in_string(text: str) -> str | None:
|
|
177
|
+
i, n = 0, len(text)
|
|
178
|
+
quote = ''
|
|
179
|
+
content_start = 0
|
|
180
|
+
|
|
181
|
+
while i < n:
|
|
182
|
+
c = text[i]
|
|
183
|
+
if not quote:
|
|
184
|
+
if c in ('"', "'"):
|
|
185
|
+
if text[i:i+3] in ('"""', "'''"):
|
|
186
|
+
quote = text[i:i+3]
|
|
187
|
+
i += 3
|
|
188
|
+
else:
|
|
189
|
+
quote = c
|
|
190
|
+
i += 1
|
|
191
|
+
content_start = i
|
|
192
|
+
continue
|
|
193
|
+
i += 1
|
|
194
|
+
else:
|
|
195
|
+
if c == '\\':
|
|
196
|
+
i += 2
|
|
197
|
+
continue
|
|
198
|
+
if text.startswith(quote, i):
|
|
199
|
+
i += len(quote)
|
|
200
|
+
quote = ''
|
|
201
|
+
continue
|
|
202
|
+
i += 1
|
|
203
|
+
|
|
204
|
+
if not quote:
|
|
205
|
+
return None
|
|
206
|
+
return text[content_start:]
|
|
207
|
+
|
|
208
|
+
string = _in_string(text)
|
|
209
|
+
if string:
|
|
210
|
+
yield from self._path_completions(string)
|
|
211
|
+
return
|
|
212
|
+
|
|
175
213
|
if text and text[-1].isspace():
|
|
176
214
|
return
|
|
177
215
|
last_token = text.split()[-1] if text.split() else ''
|
|
@@ -425,7 +463,13 @@ class ShellCompleter(Completer):
|
|
|
425
463
|
# filter (which hides completions identical to the replaced text) and
|
|
426
464
|
# doubles as the shell argument separator. Invisible characters would
|
|
427
465
|
# also bypass the filter, but would corrupt command parsing.
|
|
428
|
-
|
|
466
|
+
completion = completions[0]
|
|
467
|
+
text_before_cursor = document.text_before_cursor
|
|
468
|
+
replaced_text = text_before_cursor[
|
|
469
|
+
len(text_before_cursor) + completion.start_position :
|
|
470
|
+
]
|
|
471
|
+
if replaced_text == completion.text:
|
|
472
|
+
completion.text = completion.text + " "
|
|
429
473
|
return completions
|
|
430
474
|
|
|
431
475
|
def completer_init() -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|