-
Notifications
You must be signed in to change notification settings - Fork 63
Fix multiline Label widget to incorrectly display message with hyperlink #108
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8b91fa4
Fix the [/~] token to be displayed
cc7ca12
Fix multiline Label widget to incorrectly display message with hyperlink
fe61358
Handle the hyperlink termination token in a more elegant way
192a9e0
Change hyperlink from being a special case to a more general case
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -201,20 +201,21 @@ def tokenize_ansi( # pylint: disable=too-many-locals, too-many-branches, too-ma | |
| csi = matchobj.groups()[0:2] | ||
| link_osc = matchobj.groups()[2:4] | ||
|
|
||
| if cursor < start: | ||
| yield PlainToken(text[cursor:start]) | ||
|
|
||
| if link_osc != (None, None): | ||
| cursor = end | ||
| uri, label = link_osc | ||
|
|
||
| yield HLinkToken(uri) | ||
| yield PlainToken(label) | ||
| yield ClearToken("/~") | ||
|
|
||
| continue | ||
|
|
||
| full, content = csi | ||
|
|
||
| if cursor < start: | ||
| yield PlainToken(text[cursor:start]) | ||
|
|
||
| cursor = end | ||
|
|
||
| code = "" | ||
|
|
@@ -380,6 +381,9 @@ def parse_alias( | |
| def parse_clear(token: ClearToken, _: ContextDict, get_full: Callable[[], str]) -> str: | ||
| """Parses a clearer token.""" | ||
|
|
||
| if token.value == "/~": | ||
| return "\x1b]8;;\x1b\\" | ||
|
|
||
|
Comment on lines
+384
to
+386
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the sequence that shows up and AFAIK this is about the only place it's hard-coded, so it's a bit suspicious as well. (though sometimes it comes up as the full form, other times only |
||
| index = CLEARERS.get(token.value) | ||
| if index is None: | ||
| raise MarkupSyntaxError( | ||
|
|
@@ -513,6 +517,7 @@ def tokens_to_markup(tokens: list[Token]) -> str: | |
| markup += f"[{' '.join(tag.markup for tag in tags)}]" | ||
|
|
||
| markup += token.value | ||
|
|
||
| tags = [] | ||
|
|
||
| else: | ||
|
|
@@ -704,6 +709,9 @@ def parse_tokens( # pylint: disable=too-many-branches, too-many-locals, too-man | |
| if token.value in ("/", "/~"): | ||
| link = None | ||
|
|
||
| if token.value == "/~": | ||
| continue | ||
|
|
||
| found = False | ||
| for macro in macros.copy(): | ||
| if token.targets(macro): | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be that this being further up causes us to yield a non-plain link closer as if it was plain (though moving it back down didn't seem to fix things)