Skip to content

Bug with initial terminal cursor position in Input #6082

@TomJGooding

Description

@TomJGooding

While investigating #6064, I discovered a bug on main with the initial terminal cursor position in the Input widget.

Try running the example app below which shows the terminal cursor. I don't have any IME or emoji software installed on my machine, but presumably the pop-up would initially appear in completely the wrong position.

A quick bisect points to 3b27d5a.

from textual.app import App, ComposeResult
from textual.containers import CenterMiddle
from textual.widgets import Input


class ExampleApp(App):
    CSS = """
    Input { width: 70%; }
    """

    def compose(self) -> ComposeResult:
        with CenterMiddle():
            yield Input(
                "Terminal cursor should be here ->",
                select_on_focus=False,
            )

    def on_mount(self) -> None:
        # Show the terminal cursor
        self._driver.write("\x1b[?25h")


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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions