it behaves more like a text input control in iOS. A long-press will
add a "Select" option.
New selection markers are rendered, which can be used to adjust the
selection and these will scroll the view as well if they are near the
edge.
fuzzyHasSelectionBackground: Fixes the selection rendering on iOS, the
logic to return always true was wrong, it has to be true in one case,
false in the other.
Some behavioral changes to better match the iOS behavior:
- Long press will open a context menu, where it is possible to start a
selection.
- Selecting "Select" after a long press, shows a new menu with
additional context options.
- Menu is shown at the end of a pan operation when selection is on.
Additional property to control the color handles for the selection
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.
The previous code never managed to get any strings to be sent during
insertion, and I am not quite sure what caused this. The new approach
rather than trying to map the terminal dimensions to the screen, instead
uses an offline char array called 'storage' that is used during things like
the dictation and where both the UITextInput selection and marked text
are applied - which is independent of the "selection" SelectionService field
in the TerminalView itself.
This makes dicatation work.
Currently this seems to regress international input (in particular the
Chinese input) but I am not sure if the reason is the accessorView and
AutoLayout (I do get a warning error about a conflict), or something
else (setting autoresizemask on the inputAccessoryView did not seem to
fix this).
Some hard earned lessons:
- insertText (text: String) sometimes get a bunch of spaces, but those
are ok, because we need to track
_markedTextRange/_selectedTextRange, and remove the text from the
storage before applying the text.
This solves the mysterious 10 white spaces, followed by the dictated content.
- The new logic that keeps storage elsewhere, sadly, has the
disadvantage of not sending chiense input to the target. So this
approach regresses this part (this is handled by the setMarkText
code).
- the logic in insertText currently sets sendData to either the text in storage,
or the text being sent, and this is not right, and regresses some basic functionality.
Seems like I made a bunch of progress in dictation, but regressed the
input methods.
* 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