##// END OF EJS Templates
Strip prefix in `attr_matches` result (#13943)...
Strip prefix in `attr_matches` result (#13943) Fixes #13935 Reasoning behind implementation chosen: - `a.b.c` prefix in `a.b.c.<tab>` needs to be preserved as otherwise the completer will replace it with completion rather than appending (so we cannot just use `.suffix`, we need to use `a.b.c.suffix` here) - as in the issue we cannot use `a b.suffix` but need to use `b.suffix` or `.suffix` - `d['a b']` prefix cannot be split using space splitting so we need to tokenize - however, we can do either `a[0].suffix` or `.suffix`

File last commit:

r26736:c54a223b
r28118:9663a9ad merge
Show More
gtk4.py
27 lines | 557 B | text/x-python | PythonLexer
"""
prompt_toolkit input hook for GTK 4.
"""
from gi.repository import GLib
class _InputHook:
def __init__(self, context):
self._quit = False
GLib.io_add_watch(
context.fileno(), GLib.PRIORITY_DEFAULT, GLib.IO_IN, self.quit
)
def quit(self, *args, **kwargs):
self._quit = True
return False
def run(self):
context = GLib.MainContext.default()
while not self._quit:
context.iteration(True)
def inputhook(context):
hook = _InputHook(context)
hook.run()