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

Document tabbing to hyperlink #558

Merged
merged 2 commits into from
Sep 12, 2022

Conversation

carlos-zamora
Copy link
Contributor

Document that in mark mode you can now tab to the next/previous hyperlink.

@opbld30
Copy link

opbld30 commented Jul 7, 2022

Docs Build status updates of commit 5787283:

⚠️ Validation status: warnings

File Status Preview URL Details
TerminalDocs/selection.md ⚠️Warning View Details

TerminalDocs/selection.md

  • Line 43, Column 206: [Warning: hard-coded-locale - See documentation] Link 'https://docs.microsoft.com/en-us/windows/terminal/customize-settings/interaction#automatically-detect-urls-and-make-them-clickable' contains locale code 'en-us'. For localizability, remove 'en-us' from links to most Microsoft sites.
  • Line 43, Column 206: [Suggestion: docs-link-absolute - See documentation] Absolute link 'https://docs.microsoft.com/en-us/windows/terminal/customize-settings/interaction#automatically-detect-urls-and-make-them-clickable' will be broken in isolated environments. Replace with a relative link.

For more details, please refer to the build report.

If you see build warnings/errors with permission issues, it might be due to single sign-on (SSO) enabled on Microsoft's GitHub organizations. Please follow instructions here to re-authorize your GitHub account to Docs Build.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

Note: Your PR may contain errors or warnings unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

For any questions, please:

@opbld30
Copy link

opbld30 commented Jul 7, 2022

Docs Build status updates of commit 5628a35:

✅ Validation status: passed

File Status Preview URL Details
TerminalDocs/selection.md ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@mattwojo
Copy link
Collaborator

mattwojo commented Jul 7, 2022

Kayla is investigating to ensure this is in the current GA release.

@mattwojo mattwojo added the futureRelease This is releated to a future version that has not yet been release via Microsoft Store label Jul 7, 2022
@mattwojo
Copy link
Collaborator

mattwojo commented Jul 7, 2022

Not yet ready for merge - still in a PR

ghost pushed a commit to microsoft/terminal that referenced this pull request Jul 12, 2022
## Summary of the Pull Request
Adds support to navigate to clickable hyperlinks using only the keyboard. When in mark mode, the user can press [shift+]tab to go the previous/next hyperlink in the text buffer. Once a hyperlink is selected, the user can press <kbd>Ctrl+Enter</kbd> to open the hyperlink.

## References
#4993 

## PR Checklist
* [x] Closes #6649
* [x] Documentation updated at MicrosoftDocs/terminal#558

## Detailed Description of the Pull Request / Additional comments
- Main change
   - The `OpenHyperlink` event needs to be piped down to `ControlCore` now so that we can open a hyperlink at that layer.
   - `SelectHyperlink(dir)` searches the buffer in a given direction and finds the first hyperlink, then selects it.
   - "finding the hyperlink" is the tough part because the pattern tree takes in buffer coordinates, searches through the buffer in that given space, then stores everything relative to the defined space. Normally, the given buffer coordinates would align with the viewport's start and end. However, we're now trying to search outside of the viewport (sometimes), so we need to manage two coordinate systems at the same time.
   - `convertToSearchArea()` lambda was used to convert a given coordinate into the search area coordinate system. So if the search area is the visible viewport, we spit out a viewport position. If the search area is the _next_ viewport, we spit out a position relative to that.
   - `extractResultFromList()` lambda takes the list of patterns from the pattern tree and spits out the hyperlink we want. If we're searching forwards, we get the next one. Otherwise, we get the previous one. We explicitly ignore the one we're already on. If we don't find any, we return `nullopt`.
   - Now that we have all these cool tools, we use them to progressively search through the buffer to find the next/previous hyperlink. Start by searching the visible viewport _after_ (or _before_) the current selection. If we can't find anything, go to the next "page" (viewport scrolled up/down). Repeat this process until something comes up.
   - If we can't find anything, nothing happens. We don't wrap around.
- Other relevant changes
   - the `copy` action is no longer bound to `Enter`. Instead, we manually handle it in `ControlCore.cpp`. This also lets us handle <kbd>Shift+Enter</kbd> appropriately without having to take another key binding.
   - `_ScrollToPoint` was added. It's a simple function that just scrolls the viewport such that the provided buffer position is in view. This was used to de-duplicate code.
   - `_ScrollToPoint` was added into the `ToggleMarkMode()` function. Turns out, we don't scroll to the new selection when we enter mark mode (whoops!). We _should_ do that and we should backport this part of the change too. I'll handle that.
   - add some clarity when some functions are using the viewport position vs the buffer position. This is important because the pattern interval tree works in the viewport space.

## Validation Steps Performed
- case: all hyperlinks are in the view
   - ✅ get next link
   - ✅ get prev link
- ✅ case: need to scroll down for next link
- ✅ case: need to scroll up for next link
@cinnamon-msft cinnamon-msft changed the base branch from main to release-1.16 September 12, 2022 21:55
@opbld30
Copy link

opbld30 commented Sep 12, 2022

Docs Build status updates of commit 5628a35:

✅ Validation status: passed

File Status Preview URL Details
TerminalDocs/selection.md ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@cinnamon-msft cinnamon-msft merged commit c9b3946 into release-1.16 Sep 12, 2022
@cinnamon-msft cinnamon-msft deleted the dev/cazamor/mark-mode/tab-to-hyperlink branch September 12, 2022 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
futureRelease This is releated to a future version that has not yet been release via Microsoft Store
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants