mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
Made prompt_toolkit's mouse_support optional
Introducing a new environment variable MOUSE_SUPPORT for this, which can either be True or False. Default is False.
This commit is contained in:
parent
781f1b5f97
commit
3961310418
3 changed files with 16 additions and 6 deletions
|
@ -146,6 +146,13 @@ applicable.
|
|||
* - XONSH_INTERACTIVE
|
||||
-
|
||||
- ``True`` if xonsh is running interactively, and ``False`` otherwise.
|
||||
* - MOUSE_SUPPORT
|
||||
- ``False``
|
||||
- Enable mouse support in the prompt_toolkit shell. This allows clicking
|
||||
for positioning the cursor or selecting a completion. In some terminals
|
||||
however, this disables the ability to scroll back through the history
|
||||
of the terminal.
|
||||
(Only usable with SHELL_TYPE=prompt_toolkit)
|
||||
* - XONSH_SHOW_TRACEBACK
|
||||
- ``False`` but not set
|
||||
- Controls if a traceback is shown exceptions occur in the shell. Set ``True``
|
||||
|
|
|
@ -62,6 +62,7 @@ DEFAULT_ENSURERS = {
|
|||
'CASE_SENSITIVE_COMPLETIONS': (is_bool, to_bool, bool_to_str),
|
||||
'BASH_COMPLETIONS': (is_env_path, str_to_env_path, env_path_to_str),
|
||||
'TEEPTY_PIPE_DELAY': (is_float, float, str),
|
||||
'MOUSE_SUPPORT': (is_bool, to_bool, bool_to_str),
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -581,6 +582,7 @@ BASE_ENV = {
|
|||
'LC_MONETARY': locale.setlocale(locale.LC_MONETARY),
|
||||
'LC_NUMERIC': locale.setlocale(locale.LC_NUMERIC),
|
||||
'XONSH_VERSION': XONSH_VERSION,
|
||||
'MOUSE_SUPPORT': False,
|
||||
}
|
||||
|
||||
try:
|
||||
|
|
|
@ -59,11 +59,12 @@ class PromptToolkitShell(BaseShell):
|
|||
"""Enters a loop that reads and execute input from user."""
|
||||
if intro:
|
||||
print(intro)
|
||||
mouse_support = builtins.__xonsh_env__.get('MOUSE_SUPPORT')
|
||||
while not builtins.__xonsh_exit__:
|
||||
try:
|
||||
token_func, style_cls = self._get_prompt_tokens_and_style()
|
||||
line = get_input(
|
||||
mouse_support=True,
|
||||
mouse_support=mouse_support,
|
||||
auto_suggest=AutoSuggestFromHistory(),
|
||||
get_prompt_tokens=token_func,
|
||||
style=style_cls,
|
||||
|
|
Loading…
Add table
Reference in a new issue