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
changes made for Secure ShellFish #138
Conversation
…ug when line wraps across 3 or more lines
Thank you for your contribution Anders! Question: does the comment:
Is that some sort of "screen-scraping" capability? If so, that is one of the open tasks that I had, so it would be doubly useful! |
I present the terminal lines in a UITextView containing all lines in scrollback. I need to detect changes inside SwiftTerm and pull out relevant lines. This also allows slightly more fine-grained updates where I only need to refresh lines that have changes and not the whole interval between minimum and maximum changed line. |
Thanks for the information, three comments:
For instance, I think that the current code might call repeatedly the front-end in some scenarios, rather than having the frontend just process the range of changed lines in one go. |
I found the culprit for the regression. This change breaks the xterm/iterm2 test suite, so I suspect that this was a fix that is hiding the real source of the problem, and I would love to know what triggered this, so I can find the real problem and fix that instead. This is the change with the regression:
But this other change also has an odd smell, because it sets the right margin to the wrong value (it should at best be
(My version is in branch |
@@ -3996,7 +3995,7 @@ open class Terminal { | |||
// Insert the line using the fastest method | |||
if bottomRow == buffer.lines.count - 1 { | |||
if willBufferBeTrimmed { | |||
buffer.lines.recycle ().copyFrom (line: newLine) | |||
buffer.lines.recycle () | |||
} else { |
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.
I am wondering - do you remember what this change was for?
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.
I'm not sure. Sorry.
I remember some problems where I would get the wrong lines once the scrollback buffer couldn't fit the entire terminal history. But these problems could just be about the way I extracted lines.
One last comment - do you have any Sixel tests that you are using, I would like to add some tests for it. |
I'm still sort of following this idiom but instead of representing changes as a line number interval I have a set of all changes line numbers. When the processing is done I run through all lines marked as changed and update these. I needed the delegate to update this set of line numbers. This will reduce the amount of work in situations where you have changes at the top of the buffer and the bottom but not in between such as when editing at the top of the screen and the editor updates column and line numbers at the bottom. This would require a near full buffer update per keystroke when looking at ranges and a two-line update with this more fine-grained tracking of changes. |
That looks all wrong and I'm not sure what I was thinking or how it could even sometimes work. I made these changes because I was seeing bad behaviour if the terminal started out narrow, was resized to being wider and then switched to alt mode. When typing in emacs the characters would stop appearing before the right end of the screen as if it was limited to the old width. |
I do not have automated tests for this but two images proved particularly helpful when doing visual comparisons.
|
Thank you for your responses, a couple of follow ups: Would it make sense to keep a list of dirty lines in the buffer, that is consulted after the render pass, rather than pushing notifications for changes per-line? That is, rather than having a range "begin/end" of dirty lines, some sort of iterator Thanks for the scenario on resizing - I will investigate that: #140 |
I think that would make a lot of sense. It could perhaps be a |
Thank you for the changes! I have merged a modified version of this change, and I am tracking a couple of tasks that I need to implement for you (the Set change discussed above) |
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.
The work in these commits is covered by the MIT license and I hope it can be of some use even if a lot is about extracting lines in a scroll-invariant way.