here, instead, took the space for the auxiliary keyboard input, which
is now requested from a client app - the only reason is that the
prototype I wrote uses SwiftUI, and I need a UIViewController to do
the view rehosting, and that is not possible on the library itself.
Maybe I could rewrite the keyboard with UIKit, but it just does not
seem remotely as fun.
iOSAccessoryView: the referece to the parent terminal and the
terminalView are now properly weak.
Moved extensions for the UIKit and AppKit into their separate files.
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
Mac and iOS, into a new function processSizeChange, which additionally
reports whether the underlying terminal size has changed, which we
use to avoid unnecessary redraws while resizing
Early test to prevent rendering lines that we do not need, still needs
some testing.
Interesting observation, on iOS, `bounds` is the method that gets
called, but `frame` is not, when the size changes. On macOS, it is
the other way around.
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.
* Rename createImage to createImageFromBitmap.
Introduce createImage that is a more general purpose facility that
expects the front-end to decode the image (could be a PNG or JPEG
file), and that takes a width and height specification that contain
a payload.
On the Apple View implementation, this takes care of scaling based on
the iTerm2 rules the image, based on these inputs, and based on the
PreserveRatio attribute.
The Terminal delegate method iTermContent is no longer a general
purpose handler, but instead merely a fallback that receives the data
if it was not handled before - this means that the image is
pre-processed during the "1337" iTerm handler, and is not delivered to
the iTerm2 custom handler. The parsing is now done centraly, and a
UI should implement the createImage method.
* Make the code compile for both AppKit and UIKit
* AppleTerminalView: rather than duplicating code between createImage
and createImageFromBitmap, abstract the actual rendering into a shared
insertImage method. This means that sixel graphics now can support
scaling by default.
This also fixes also the inverted image problem for sixels that was
introduced in the move from CGImage to TTImage (the proxy to
NSImage/UIImage)
into newline + carriage return by default. This broke Emacs rendering, and it
is not the baseline setting that we should have.
For some reason, this has been carried for a while, a bug I introduced
in 2019 in XtermSharp when I commited the change in
0281d198c596063c40c5f1de514ed1bc9dff7def with the message "Small
fixes". This code did not appear on xterm.js as far as I can tell.
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.
than embedding platform specific information inside Terminal
(AppKit/UIKit), the handling of the image is delegated to the platform
specific part.
Made some of the delegate methods of Terminal follow the same convention
than the rest already had.
Started to think about how I am going to render the sixel data. It
looks like the image is in the wrong place, and it is too large, I think
I might need to scale it.
Also, currently this has a side-effect, the buildAttributedString is poking
at a global `images` array, which I do not like. I need a better system
to render, but I want to avoid walking the terminal buffer twice, so a
variation of this is still needed.
The code is currently disabled.
helper classes, the code created a strong cycle, that prevented the
Terminal resources from being disposed.
This patch makes it so that the various helper classes use weak references
to the container Terminal, and also makes the TerminalDelegate weak
There is still a pending crash, with chinese input, I seem to be
creating an invalid text range, and can crash, to reproduce: dictate
"hello world", then enter some multi-character chinese characters,
then press delete. This creates an invalid range that ends up
requesting an invalid range of text.
A defensive check would work, but we should get to the root of it, so
I am keeping the abort for now.
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.