SwiftTerm icon indicating copy to clipboard operation
SwiftTerm copied to clipboard

iOS Design: View Features

Open migueldeicaza opened this issue 4 years ago • 6 comments

There are some design features that are easy to implement, but should be designed, as some capabilities will override others. For instance, scrolling and tap-drag being sent to an app interested in the event can conflict with each other. So this should probably be done with an on/off toggle (it exists, but every action needs to be well documented and understood, and in some cases, made configurable):

  • [ ] Double tap, becomes tab
  • [x] Map touches to mouse events
  • [x] Terminal-bar #116
  • [x] Swipe gestures to send up/down/left/right
  • [x] Key autorepeat for accessory
  • [x] Implement iOS Paste menu and other contextual operations.
  • [x] (iPhone) Should resize terminal based on whether the keyboard is shown or not - this is not on the view itself, but on the sample app that monitors the keyboard state.
  • [x] implement selection and context menu for it
  • [x] UITextInput support Tracked separately
  • [x] Single tap should make the view become the first responder
  • [x] Keyboard should have a "hide keyboard" option, or we should have an API that can be controlled.
  • [x] On/Off for touch events, so that I can switch between scrolling/selection and mouse reporting and gestures.

migueldeicaza avatar Apr 27 '20 03:04 migueldeicaza

I'm experimenting with putting in a layer between Terminal and TerminalView for producing NSAttributtedString in a way that can be used in UITextView which would support scrolling and text selection.

Not sure if this is a good idea but seems worth a try.

Using UITextView would also make it possible to map native iOS cursor movement (dragging cursor + tap and hold space) into arrow keys.

palmin avatar Apr 28 '20 10:04 palmin

I’d like to port my app NewTerm over to SwiftTerm. It’s a jailbreak terminal app, originally based on MobileTerminal (which is almost as old as the iPhone itself!) and using a fork of iTerm (not iTerm2) as the emulator. I’ve planned to shift away from the ancient and broken emulator, and give it an SSH backend for release on the App Store. Porting xterm.js to Swift was a project I started working on, but you’ve definitely gotten way further than me on that 😁

Is there anything of interest that I could work on or provide here? I have some ideas on some UI aspects. I’ll be relicensing NewTerm under Apache License 2.0 once all GPL iTerm code has been removed. No original MobileTerminal code remains anywhere but in the Common/VT100/ directory.

kirb avatar Apr 28 '20 10:04 kirb

I'm experimenting with putting in a layer between Terminal and TerminalView for producing NSAttributtedString in a way that can be used in UITextView which would support scrolling and text selection.

To make it 1:1 we'd need to move from CoreText to TextKit (TextKit API is pretty annoying in comparison). There's a couple of problems to solve on the way.

krzyzanowskim avatar Apr 28 '20 19:04 krzyzanowskim

Apologies, I only saw this comment now.

On scrolling: I had some early bits in place, I committed them now, where I made the terminal view be a subclass to UIScrollView - I am not attached to this model, we can try other approaches.

I think this is a good match, but I need to think further. The reason why I think this works is because the scroll buffer grows, and I would not want to render the entire back-scroll, I would like to render the back scroll on demand.

I do not know much about UITextView as a backing engine for this, will need to research what this means.

For Sixel graphics, I think that we could flag a cell as having an image, and then the rendering code that is in place today would paint the image instead of adding this to the CTRun.

@kirb: In terms of what you could work on, any of the above gestures would work. I collected some of those from using terminals in the past and felt like these would be useful.

As an aside, I started putting my SwiftUI muscles to practice so we can remove that hardcoded "Miguel" login name, password and my localhost IP address to test. Here are some screenshots, I can put them here, but did not want to land code in such unbaked state, but if you folks want to help, I don't mind putting it here.

image image

migueldeicaza avatar Apr 29 '20 23:04 migueldeicaza

(btw, apologies in advance - I am terrible at reading GitHub comments, because I am still trying to create filters to remove legacy notifications that keep spamming me).

Usually @krzyzanowskim has pinged me on twitter if there is something to look at.

I promise I will look into fixing my GitHub notifications soon.

migueldeicaza avatar Apr 29 '20 23:04 migueldeicaza

I posted my work in progress here: GitHub.com/migueldeicaza/SwiftTermApp

migueldeicaza avatar May 08 '20 03:05 migueldeicaza