Skip to content

mark mode: begin selection at viewport when scrolled up#19549

Merged
carlos-zamora merged 1 commit intomainfrom
dev/cazamor/mark-mode/scrolled
Nov 11, 2025
Merged

mark mode: begin selection at viewport when scrolled up#19549
carlos-zamora merged 1 commit intomainfrom
dev/cazamor/mark-mode/scrolled

Conversation

@carlos-zamora
Copy link
Member

Summary of the Pull Request

Updates mark mode so that it starts at the viewport's origin (top-left) if we're not scrolled to the bottom. This is based on the discussion in #19488.

Validation Steps Performed

✅ scrolled at bottom --> mark mode starts at cursor
✅ scrolled up --> mark mode starts at cursor

Closes #19488

@carlos-zamora carlos-zamora merged commit d2f977a into main Nov 11, 2025
19 checks passed
@carlos-zamora carlos-zamora deleted the dev/cazamor/mark-mode/scrolled branch November 11, 2025 20:07
carlos-zamora added a commit that referenced this pull request Nov 18, 2025
## Summary of the Pull Request
Searching in terminal highlights all search results. However, those
results are considered separate from a selection. In the past, the
highlighted result would be selected, resulting in it being the initial
position for mark mode. Now that it's separate, mark mode doesn't start
there.

To fix this, there's 2 changes here:
1. When we exit the search, we now select the focused search result.
This becomes the initial position for mark mode.
2. When we're in the middle of a search and mark mode becomes enabled,
the focused search result becomes the initial position for mark mode.

With this change, mark mode's initial position is determined in this
order:
1. the position of an active selection
2. the position of the focused search result (if one is available)
3. the top-left position of the viewport (if there is a scrollback) (see
#19549)
4. the current cursor position

## Validation Steps Performed
Entering mark mode in scenario X results in a starting position of Y:
✅ selected text during a search --> selected text
- NOTE: this seems to only occur if you start a search, then manually
click on the terminal to bring focus there, but keep the search results
active

✅ performed a search and results are available -->focused search result
✅ performed a search and no results are available
   - scrolled up --> top-left of viewport
   - no scrollback --> cursor position

✅ performed a search, got results, then closed search --> focused search
result

Closes #19358
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

Successfully merging this pull request may close these issues.

Don't scroll back down on ctrl-shift-M

2 participants