prompt-toolkit / prompt-toolkit/python-prompt-toolkit

Dialogs lack a good way of disabling mouse support

Open
#868 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

While prompts provide a simple way of disabling mouse support (e.g. prompt('What is your name: ', mouse_support=True)), there is no similar way of doing this for dialogs with the default wrapper functions (e.g. yes_no_dialog(title='foo', text='bar', mouse_support=False).

Instead, it seems to be necessary to create a Dialog object manually, construct an Application object, and then pass the flag on that.

def _create_prompt_app(dialog, style):
    # Key bindings.
    bindings = KeyBindings()
    bindings.add('tab')(focus_next)
    bindings.add('s-tab')(focus_previous)

    return Application(
        layout=Layout(dialog),
        key_bindings=merge_key_bindings([
            load_key_bindings(),
            bindings,
        ]),
        mouse_support=False,
        style=style,
        full_screen=True)

If mouse support is enabled, selection / copy & paste breaks in MacOS with Terminal and iTerm

The appropriate fix would be to be able to specify mouse_support=False for the wrapper methods shipped with python-prompt-toolkit.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the default dialog wrapper functions, such as yes_no_dialog, to the Dialog and Application construction shown in the issue. Add a mouse_support option to those wrappers and verify that passing False reaches the Application; done means callers can disable mouse support without constructing Dialog and Application objects manually.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.