microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.51k stars 8.31k forks source link

Marks on scrollbar: smarter navigation (center the mark vertically) #13449

Open jkuebart opened 2 years ago

jkuebart commented 2 years ago

Description of the new feature/enhancement

Since #12948 we have the long-awaited marks on the scrollbar, along with the possibility to navigate between them.

Unfortunately, the navigation isn't very smart yet. When jumping to the previous/next mark, the window area merely scrolls such that the marked line becomes visible.

It would be much nicer if

Proposed technical implementation details (optional)

The »jump to mark« command should scroll the window area such that the target line ends up near the middle of the screen whenever possible. A temporary highlight effect should be used to visually guide the user to the target line.

zadjii-msft commented 2 years ago

These are great ideas to include as a part of #11000. I'm gonna split this into two issues to help better track these requests. Let's use this thread for "the target line ends up near the middle of the screen", and I'll fork off the other request.

Jaykul commented 2 years ago

Are we sure we want the target near the middle of the screen? If we're auto-marking prompts, the most common marks are going to be at the start (or end, depending on how you think of it) of a command.

With that turned on (the way I have it right now) I want to see the mark at or near the top of the screen, so I can see as much of the output as possible.

Incidentally, it would be nice if the mark functionality followed the behavior of (and even key-bindings for) search, regardless -- so if we had a way to make it appear near the center of the screen, it should be optional, and should would work for both.

zadjii-msft commented 2 years ago

Don't worry, that's how I already interpreted this request - as a request for an optional setting here:

  • [ ] #13449 - center or some other setting that controls how the mark is scrolled in.
    • Maybe top (current) / center (as proposed) /nearestEdge (when scrolling down, put the mark at the bottom line of viewport , up -> top line)?

Frankly, I'm a huge fan of the "scroll s.t. the mark appears at the top of the viewport" style, for the same reason you've mentioned above. But if folks want to optionally scroll the prompt to the middle of the viewport, that doesn't seem terribly difficult to implement or maintain.

jkuebart commented 2 years ago

Are we sure we want the target near the middle of the screen? If we're auto-marking prompts, the most common marks are going to be at the start (or end, depending on how you think of it) of a command.

With that turned on (the way I have it right now) I want to see the mark at or near the top of the screen, so I can see as much of the output as possible.

While this sounds convincing, I have thought about it and this is how I can describe the use case: The marked prompts are indeed between the interesting content which is the command output. In my experience, very frequently I need the end of the output of some historical command just before the next prompt. For example, this is the case for error messages at the end of a compilation run whose complete output doesn't fit on a screen.

With the current behaviour, finding this requires skipping one prompt further up and then back down again to reveal the end of the command output, which is inconvenient.

Hope I could provide some explanation for this feature request ;-)