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

Various fixes for hyperlink instability #2156

Merged
merged 11 commits into from
Aug 28, 2024

Conversation

qwerasd205
Copy link
Collaborator

A handful of fixes mostly relating to managed memory handling, significantly improves stability of resizing with OSC8 links on screen.

  • Fix double-counting in hyperlink set [No unit tests added]
  • Fix clonePartialRowFrom affecting the source row if it's on the same page, by moving hyperlink data, resulting in an invalid state due to cells marked as hyperlinks that have had their data moved elsewhere. This could be hit during scroll operations on the alt screen or with a scroll margin since insertLines and deleteLines use clonePartialRowFrom with the src and dst on the same page. [No unit tests added]
  • Fix reflow trying to clone non-existent managed memory in moveLastRowToNewPage by resetting managed memory markers before attempting any clones that may result in the row being moved. [No unit tests added]
  • Fix handling of hyperlinks in cursorCopy (which is, as of now, only used to transfer the cursor to and from the alt screen). Previously it would cause a crash if you switched to the alt screen while an OSC8 link was active on the cursor. [Unit tests added!]
  • Refactor PageList.clone to avoid a lot of excess work (which may have also had edge case logic errors somewhere in it, since this does seem to improve stability compared to not having it), making it a lot more straightforward, and actually improving screen clone times for the renderer by a significant margin. [No additional unit tests needed] (unless you can figure out what exactly the edge cases it was getting wrong were... that seems like a lot of work though.)

qwerasd205 and others added 11 commits August 27, 2024 01:01
avoids double counting in several places
If we call `moveLastRowToNewPage` at any point because we failed to copy
some managed memory, it tries to copy managed memory that hasn't been
cloned yet when moving our progress to a new page.

Avoid this by setting our content tag, hyperlink flag, and style id to
indicate no managed memory is present on the cell.
Also avoids leaving content in out-of-bounds rows, since it doesn't copy
the content to them in the first place. Over all, just a lot cleaner.
@mitchellh mitchellh merged commit 42a23f2 into ghostty-org:main Aug 28, 2024
5 of 7 checks passed
@mitchellh mitchellh deleted the hyperlink-fixes branch August 28, 2024 17:01
@mitchellh
Copy link
Contributor

Thank you!

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.

2 participants