the wrong chunk of data.
Starting with BigSur any screen updates will invoke the draw() method
with the whole region, regardless of how much changed.
Added a new `disableFullRedrawOnAnyChanges` property that by default
will make the Terminal avoid this new behavior. It can be controlled
by client code.
Setting this to true, will disable this OS behavior, setting it to
false, will keep the original BigSur behavior to redraw the whole
region.
For more details on this see:
https://gist.github.com/lukaskubanek/9a61ac71dc0db8bb04db2028f2635779https://developer.apple.com/forums/thread/663256?answerId=646653022#646653022
Added an NSView.rectsBeingDrawn method to get the exposed areas - also
sort of worthless on BigSur an older if the flag is not set.
image has bee completed, it is the job of the front-end to insert
it in a way that is suitable.
In the Mac+iOS cases, I divide the image in bands, and attach each
band to the display, this ensures that images work when scrolling
and that no odd repaint side effect happens when we update portions
that were not the "reference" row that contained the image. Now,
every row has the image it needs to display.
Leveraged the Bufferline structure, and placed an optional array of
images there. The images contain the column where they were
attached, so the front-end can iterate over the images (typically,
no more than one) to redraw.
Fixed also the HLS to RGB conversion, and does this without requiring
the core of the terminal to rely on UIKit or AppKit, so this should
be finally back to reusable on non-Apple platforms.
* Exploration on making the input parsing a background task - and let the UI run free
* The multi-threaded renderer idea works.
The general idea is to move away from the idea that the view is
updated after text is fed into the TerminalView, as this can hang the
UI when large amounts of data are fed into the terminal (this happens
with an ssh connection when a command sends too much data over the
connection).
The idea is instead to run a CADisplayLink that updates the display
at discrete intervals and send the data to the terminal on a
background thread.
For this to work, the queue that I was using for SSH needs to be
serialized, and I had it configured as concurrent in
UIKitSshTerminalView, so that should also be fixed on master.
Some challenges with this approach, which prevent this from being
merged right now.
1. The messages posted from the terminal into the delegate are done
from the background thread (the one that is calling parse). Either,
I provide an explicit queue to deliver messages, or the terminal could
pick the queue on which it was created to deliver messages on.
2. The CADisplayLink can be expensive when nothing is happening, so
probably it should be turned off when no data has been pushed, or have
a small boolean that indicates whether any data has been fed,
otherwise, to return immediately.
* Multi-threading: Pause the display update when there are no changes, currently only iOS has been wired up
* Two performance optimization: preload the content of self.buffer to avoid multiple nested calls in insertCharacter, and copyFrom can rely on Swift's array copy-on-write semantics instead of copy data like a troglodyte
* EscapeSequenceParser: while it took a slice, it was iterating not over the startIndex..endIndex, but startIndex..len which could have been smaller, so it was not really working with slices
* Undo the locking-based multi-threading, and instead buffer output in chunks from SSH data receiver
* Update comments to reflect the two bugs fixes, and the now desired pattern to use it
* Make multithreading build on Mac