Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird behavior when arbitrary text selection is combined with Input - text is selected in 2 places #5622

Open
mzebrak opened this issue Mar 7, 2025 · 1 comment

Comments

@mzebrak
Copy link

mzebrak commented Mar 7, 2025

It's weird that text can be selected in 2 places at the same time. When input is focused, it's impossible to copy selected text from another place - ctrl+c tries to copy from Input instead of the mouse-selected text.

MRE1:

  1. Launch this app
  2. Select the text above the input with your mouse

Image

  1. (Optionally) press ctrl+c, then ctrl+v -
from __future__ import annotations

from textual.app import App, ComposeResult
from textual.widgets import Input, Static


class ExampleApp(App):
    def compose(self) -> ComposeResult:
        yield Static("Some text that can be selected")
        yield Input("Something")


if __name__ == "__main__":
    ExampleApp().run()

MRE2:

  1. Launch this app
  2. Select the text above the input with your mouse

Image

  1. Press Ctrl+c
  2. Press on Input
  3. Press Ctrl+v

result: text is not copied and pasted, because there is noting to copy from in the Input, and it takes precedence

from __future__ import annotations

from textual.app import App, ComposeResult
from textual.widgets import Input, Static


class ExampleApp(App):
    def compose(self) -> ComposeResult:
        yield Static("Some text that can be selected")
        yield Input()


if __name__ == "__main__":
    ExampleApp().run()
Copy link

github-actions bot commented Mar 7, 2025

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant