Commit Graph
35 Commits
Author SHA1 Message Date
Miguel de Icaza 4ee1baefa8 iOS TerminalView: change the way selection works in a few ways. Now,
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
2021-06-25 23:41:30 -04:00
Miguel de Icaza 13d535f108 Brings to Mac the same bounds fix that I did to iOS, where I was queuing
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/9a61ac71dc0db8bb04db2028f2635779
https://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.
2021-06-19 12:22:53 -04:00
Miguel de Icaza 179d03b1c6 On iOS 15, use the more reliable keyboardLayoutGuide to automatically track the keyboard, instead of the manual event handling. Keep the old code for educational purposes 2021-06-09 18:18:31 -04:00
Miguel de Icaza c9cd1482e9 Dispatch events from the background to the main queue 2021-05-06 23:47:13 -04:00
Miguel de Icaza 80088184cc Merge 2021-05-02 22:08:27 -04:00
Miguel de Icaza f2156280dc Report Sixel through the proper channels 2021-04-23 18:28:15 -04:00
Miguel de Icaza da965ea7ef Make the arrow keys easier to hit, and prepare to have a custom keyboard for additional input 2021-04-22 20:32:41 -04:00
Miguel de Icaza 1570c7b69d Do not use safeAreaInsets.bottom for computing the terminal size, as that just adds another row of padding 2021-04-22 20:14:58 -04:00
Miguel de Icaza f83d75aa73 Merge branch 'main' into uitextinput-strategy-3 2021-04-22 10:51:20 -04:00
Miguel de Icaza 3cbda01601 Sixel progress: I do like this approach a lot more. Now, when an
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.
2021-04-21 22:23:52 -04:00
Miguel de Icaza d45154283e This commit merely cleans things up, and does not really introduce any fundamental changes 2021-04-05 22:19:37 -04:00
Miguel de Icaza 582ad80209 New strategy to implement UITextInput and family.
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.
2021-04-02 23:27:05 -04:00
Miguel de Icaza f4ef3c6cbb More debugging aids 2021-03-30 23:07:18 -04:00
Miguel de Icaza 73e8777044 Make bracketed paste mode public, style 2021-03-30 22:50:48 -04:00
Miguel de Icaza fc667c2d2b Use the system configured shell, instead of hardcoding bash 2020-12-07 22:38:33 -05:00
Miguel de Icaza 12ce12a779 Launch bash as a login shell; Set startup directory to be the home directory 2020-12-07 17:56:06 -05:00
Miguel de Icaza 367ca20539 Drop the git submodule, and instead use remote XCFraweworks (#152)
This should make it a lot simpler for users that wanted to take this for a spin.

Most forks were dealing with this.
2020-11-30 22:48:33 -05:00
Miguel de Icaza 1ed974b5c6 Mac app: export buffer, export selection; Library: API to expose contents as Data; Update localhost testing address 2020-11-30 21:56:30 -05:00
Miguel de Icaza 075fd23965 Fix the iOS build, and use the new SwiftSH.xcframework 2020-11-29 23:06:49 -05:00
Miguel de Icaza 4abff67a68 Wire up the OSC current-directory command to the Mac sample app 2020-11-27 14:57:21 -05:00
Miguel de Icaza dcb3c8d0e0 Better background processing (#147)
* 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
2020-10-27 17:17:46 -04:00
Miguel de Icaza e15afadd1c Usability: make the TerminalView font settable by the native font, not via our internal font structure; Mac terminal app - hook up the zoom in/out/magnification/reset size events 2020-06-04 20:18:46 -04:00
Miguel de Icaza 91e4a0b5fa Add support for transparent backgrounds to Mac and iOS 2020-05-29 20:03:43 -04:00
Miguel de Icaza d5ab249b56 Add universal binaries for SwiftSH 2020-05-12 23:00:29 -04:00
Miguel de Icaza e437ee4beb iOS InputAccessory support, implement some of the keys, and add some refactoring needed 2020-05-11 00:50:02 -04:00
miguel 9c5520f9eb Revert the patch change, this should get it building 2020-05-09 14:20:50 -04:00
Miguel de Icaza 4117d7870b Should fix once and for all the SwiftSH.binaries module.modulemap clash 2020-05-08 23:55:51 -04:00
Miguel de Icaza 478dc1d3b6 iOS: Take keyboard size into consideration, remove debugging junk, disable iOS chuning for now 2020-05-04 00:01:20 -04:00
Miguel de Icaza cbbe20c46f Disable chunking for now, it is triggering a redraw problem 2020-05-03 22:53:37 -04:00
Miguel de Icaza aed87e2973 iOS: process incoming data in chunks, otherwise, we would only get UI updates after massive chunks of data have been sent. In my local case, I would get two megabytes worth of data on a large transfer, and the UI would not update for the whole time this was being processed. 2020-05-03 17:56:29 -04:00
Miguel de Icaza ef62a251d1 Implement foreground/background color changes, fix bugs in the palette update code (it was not redisplaying changes - subtle, I was using the wrong index, one that did not take bold into account); implements palette reset as well - pending the actual changes to UI colors, see bug #111 2020-05-03 00:04:14 -04:00
Marcin Krzyzanowski 359447eebe Update Info.plist paths 2020-04-28 20:45:05 +02:00
Marcin Krzyzanowski 09879b4ce3 Merge branch 'master' into marcin/reorganize 2020-04-28 20:41:48 +02:00
Marcin Krzyzanowski b0c796be38 Include iOSTerminal project 2020-04-28 19:11:33 +02:00
Marcin Krzyzanowski 10db3c3896 Reorganize project. Move terminal apps into TerminalApp directory. Reference project from SwiftTErm.xcworkspace for Xcode 2020-04-28 12:58:18 +02:00