Skip to content

Completions pager should redraw if the subbed completion wraps/unwraps the line #8405

Closed

Description

@mqudsi

If the user has a command typed out that is approaching the width of the terminal and attempts to page through completions for an argument, an argument may be subbed in that causes the line to wrap (e.g. the prompt now takes n+1 lines), while tabbing away to a different suggested completion may cause the line to then unwrap (prompt goes back to n lines). Neither the prompt nor the pager are redrawn when this wrapping/unwrapping happens, so what's displayed in the tty emulator (apart from the selected completion's line which is redrawn) does not match the actual contents (off-by-one error). This causes corruption of the prompt regardless of whether a completion is ultimately chosen or which completion was chosen, leaving the terminal in a corrupted state (the prompt is broken up, incorrect, and scrolled out of view).

This doesn't happen under asciinema because the emulated TERM doesn't support our rich completions pager but here's a video capture:

2021-11-05-122427.mp4

You can see when the prompt first breaks (when the first too-long completion is selected) and if you look closely you can observe the oddities in the appearance of the selected item as I tab to and from the long completion. After the pager is closed (completion abandoned), I scroll up and you can see the detritus of the wrapping and unwrapping.

Activity

  1. floam commented on Nov 5, 2021

    @floam
    Member

    Ew, command line guts!

  2. krobelus commented on Nov 6, 2021

    @krobelus
    Contributor

    I'm struggling to reproduce this.
    Looks like something that should have been fixed by ada03d3 (Correct pager size when command line soft-wraps, 2020-07-05).
    There are other issues like #7296 where we redraw wrongly when we occupy all lines on the screen.

  3. krobelus commented on Dec 2, 2021

    @krobelus
    Contributor

    This might be fixed by 0cd3ed4 but I didn't verify that (I wasn't sure if github would interpret "Possibly closes " like that).
    Also, I forgot the changelog again, maybe it should be left out since it's not so actionable for users (who didn't notice the bug)?

  4. added
    bug
    on Dec 2, 2021
  5. added this to the fish 3.4.0 milestone on Dec 2, 2021
  6. added a commit that references this issue on Dec 12, 2021
  7. locked as resolved and limited conversation to collaborators on Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions