Commit Graph

29056 Commits

Author SHA1 Message Date
fang
1c36ad129d
webterm: avoid needless %blew tasks
Any change to the session object was triggering this. But that now includes
an "unacked keystrokes" counter, which updates frequently, and we
definitely don't want to send resize notifications in that case.
2022-09-17 10:38:04 +02:00
fang
f5089b77eb
webterm: tune spinner values 2022-07-17 15:28:55 +02:00
tomholford
8d0ca32c5d
ux: show a keypress indicator after a delay 2022-07-17 15:16:35 +02:00
fang
d7ec69803f
webterm: add ugly keypress processing indicator
Needs to be made prettier by displaying only after a delay, have a cute
little animation, etc.
2022-07-17 15:15:10 +02:00
fang
f58bdbcec4
webterm: handle ctrl+shift key events specially
xterm.js seems to have a bug where it doesn't register ctrl+uppercase
keypresses correctly. To work around this, we catch such keypresses
explicitly and handle them inline.
2022-07-08 20:44:21 +02:00
fang
1b994e89bd
Merge pull request #5845 from dnmfarrell/dnmfarrell/term-recognize-vt-term-sequences
term: support vt escape sequences
2022-06-17 19:46:18 +02:00
David Farrell
d848587c04 Revert "term: recognize home & end keys"
The behavior of home/end haven't been decided on yet.

This reverts commit 2d9106ae2d4c4a76a0cb5098835fdbc426e2f289.
2022-06-17 09:16:21 -04:00
David Farrell
975e2f2a14 term: recognize home & end keys
Modifies term to detect home/end vt sequences, and adds complementary
%blit and arm handling.
2022-06-17 09:16:21 -04:00
David Farrell
66cbafe625 term: support vt escape sequences
Modifies the terminal to support vt escape sequences (as emulated by the
Gnome Terminal app and others).

For now it recognizes the delete key - other sequences are ignored as
drum does not (yet) support them.

This also stops all vt escape sequences from emitting sigs.
2022-06-17 09:16:21 -04:00
fang
c77bee3388
webterm: include utility for highlighting renders
Flashes areas of the screen that get redrawn by blits a bright pink.
Doesn't behave quite right in some scenarios (where the first blit isn't
a cursor movement, or there is a %nel at the end of the buffer), but
works sufficiently for the common cases.
2022-05-16 15:56:33 +02:00
fang
5c23b3fdb9
webterm: ensure content under cursor is visible 2022-05-15 19:01:02 +02:00
fang
dc81adb735
webterm: send simple keystrokes simply
%txt should be reserved for chunks of pasted text and other
non-keystroke text inputs. Perhaps at a later point in time we'll handle
paste events explicitly, letting this be more accurate.
2022-05-15 01:13:54 +02:00
tomholford
2d3e803704 devex: improved resize behavior
- only resize when necessary (check the container's height)
- refactor CSS: use position relative / absolute to stack Buffers instead of display:none; this affects the calcuations used by fit()
- fix dark mode styles, tweak viewport height (100vh --> 99vh) to prevent overflow scroller
2022-04-19 03:41:40 -07:00
fang
65f9f904c7
zuse: rewrite klr:format's +scag and +slag
The previous implementation was counting the full length of the stub
unnecessarily. Doing a single "dumb" traversal is ~40% faster.
2022-04-15 18:04:37 +02:00
tomholford
dfded5e592 ux: refactor resize behavior
- debounced resize event listener
- new Buffer#onSelect: resize, focus, and pokes `herm` with updated rows / cols
- simplify container ref implementation (no need for a callback ref), remove isOpen hack
- add lodash for debounce
- Tab#onClick no longer handles focus (it's now handled by Buffer#onSelect)
2022-04-14 07:13:09 -07:00
tomholford
37ce741a77 deps: replace deprecated xterm#setOption
See:
https://github.com/xtermjs/xterm.js/blob/4.15.0/typings/xterm.d.ts#L1053
2022-04-14 04:52:43 -07:00
tomholford
349033fb12 ux: detect OS for hotkey instructions
Also, ensure changes from this PR are included in the session branch:
https://github.com/urbit/urbit/pull/5529
2022-04-13 08:47:30 -07:00
tomholford
50d120e3c1 devex: address PR feedback
- move App#initSessions definition outside function component closure
- enhance useAddSessions performance
2022-04-11 12:05:25 -07:00
fang
d3f9d76217
term: move cursor to end before exit
When urbit exits, the host shell it was running in takes over, often
re-prints its own prompt.

Here, we move the cursor to the bottom of the screen right before
exiting, so that any subsequent output doesn't destroy whatever we had
on-screen when we closed.
2022-04-03 21:49:25 +02:00
fang
064b15e5a0
term: move coordinate origin to top left
Having the origin at the top left instead of the bottom left is more
conventional and ergonomic. The only thing this complicates is
prompt-specific logic, where we care about the coordinates of the
bottom-most line on the screen.

For that reason, the bulk of the changes here are in vere, where we
treat the bottom-most line specially, drawing the spinner onto it.
Webterm is likewise updated to account for the new coordinate system.

Drum now opts to accept clicks anywhere on the screen, and does its best
to move the cursor as close to the clicked location as possible (within
the confines of the prompt).
2022-04-03 21:38:09 +02:00
fang
c5b07f5203
term: batch simple input events into a single %txt
By accumulating %txt events until we reach a more complex event or reach
the end of the input buffer, we can significantly reduce the "overhead"
of pasting text into the terminal. Instead of an event for each
character, we now inject up to a buffer's worth of characters
(currently, 123 bytes) at a time. This makes pasting process much
faster.

Incidentally, the behavior for pasting text with syntax errors into the
dojo may be a little bit surprising: after every buffer boundary, the
dojo will complain about the syntax error, moving the cursor to its
location, and causing the remainder of the text to be inserted in that
position. This may result in garbled-looking input in some cases.
This ux problem should be resolved on dojo's end, perhaps by
highlighting syntax errors with color, instead of the cursor.

Alleviates most of the need for #5687.
2022-04-01 22:15:34 +02:00
tomholford
531fd61ace ux: add info modal
Add a new tab to the top bar that shows an alert with a brief usage guide.
2022-04-01 06:59:39 -07:00
fang
60ed368bc4
webterm: fix bell icon in tabs
Presumably due to how js non-objects work in closures, the selected prop
we were reading out whenever a blit came in was stale.

Also, it was possible that a bell was hiding inside a %mor blit, so we
add a small helper for checking properly.
2022-03-25 15:38:56 +01:00
fang
8da6c20f70
herm: stop sending %hail on-connect
Client will probably want to send a %blew first anyway. By not doing any
screen refreshed in herm, we avoid doing unnecessary redraws on-connect.
2022-03-25 15:08:50 +01:00
fang
890e5f1e9b
webterm: do not warn on session creation cancel 2022-03-25 14:41:53 +01:00
fang
01de5a06b0
term: consistently use x/y coordinate ordering
%rez has always used "width & height". Certainly, "x & y" is more
standard than "row & column". As such, we settle on making %hop and %hit
respect the more natural ordering. This change is safe because these
interfaces haven't made it to livenet yet.
2022-03-25 13:45:29 +01:00
tomholford
6256a0a664 ux: inform user when session input is invalid
Show a helpful error message via `alert` instead of failing silently.
2022-03-15 11:16:44 -06:00
fang
0d2c135959
webterm: small cleanup, comments
Also includes a more-sane prompt() description.
2022-03-15 01:34:19 +01:00
fang
586c2da857
webterm: improve session creation regexes
Trailing dashes are, in fact, allowed. As are numerics in the agent
name.
2022-03-15 01:24:16 +01:00
tomholford
bf0f4e97c9 api: exponential backoff when resubscribing
Use the new `lib/retry` to attempt to reconnect when clogged. If unsucessful after 5 attempts, stop retrying and log an error.
2022-03-10 22:54:30 -06:00
tomholford
200b504c4e api: resubscribe after clog 2022-03-10 00:03:27 -06:00
tomholford
ee492e6f83 devex: cleaning up lint issues 2022-03-09 16:25:10 -06:00
tomholford
e7e5c63409 ux: support agent!session-name syntax
When adding a session, using this special syntax will create a new session for the indicated agent.

E.g., `book!my-session` opens a new session for the %book agent.
2022-03-09 16:15:24 -06:00
tomholford
8d9a59bfe4 devex: eslint config 2022-03-09 16:14:06 -06:00
fang
8906d1c17d
dill: move %mor case into $blit
This lets us send a single blit around, instead of sending facts for
every individual blit in a draw event.
2022-03-05 18:17:48 -06:00
tomholford
87ac253b8d ux: default terminal sets correct theme onload
also, increase size of Tab click target
2022-03-03 18:11:37 -06:00
tomholford
438e6d4df9 ui: style tabs
also rename join --> useDark; clean up extraneous logging statements
2022-03-03 17:10:54 -06:00
tomholford
fe1ece47d8 api: clean up subscriptions on deletion of session
On subscribe, track the subcription ID in the Session state.

On deletion, unsubscribe using the same ID.
2022-03-03 17:09:38 -06:00
tomholford
1a50957950 ux: session ID input validation
When creating a new session, validate that it meets the following conditions:

 - must start with an alphabetical
 - can be composed of alphanumerics with hyphens
 - can be length 1 or longer
 - cannot begin or end with a hyphen
2022-03-03 16:58:48 -06:00
fang
25a1c79aa3
drum: properly hook up new |link
More uncommitted code.
2022-03-02 23:25:38 -06:00
fang
e41263c653
dojo: add missing nu-sole-id compatability
Forgotten code.
2022-03-02 22:49:31 -06:00
fang
d98611a04b
webterm: support multiple sessions
Fully implements webterm support for multiple dill terminal sessions.

Remaining work includes styling, session creation safety (name-wise),
and general cleanup.

Co-authored-by: tomholford <tomholford@users.noreply.github.com>
Co-authored-by: liam-fitzgerald <liam@tlon.io>
2022-03-02 17:34:19 -06:00
fang
998f7d081a
dill: fix %shut session deletion
+abet would re-insert the session into state, so we just pull the
deletion logic outside of the main core.
2022-03-02 17:24:54 -06:00
fang
e53cb4a205
drum: make |un/link work for non-default sessions 2022-02-28 16:47:49 -06:00
fang
f6f2fcfcac
drum: make eel per-session
This allows us to have different apps connected to different sessions.
2022-02-28 16:45:56 -06:00
fang
41a063867b
dojo: auto-fill generator's named drum-session arg
If a generator has a named argument named "drum-session", and the caller
doesn't specify a value for it, dojo auto-fills it with the current drum
session identifier.
2022-02-28 16:41:49 -06:00
fang
bf97b8da38
drum: move +se-view call into +se-abet
We practically always do se-abet:se-view anyway.
2022-02-28 16:27:29 -06:00
fang
bb11c74278
drum: don't drop state during se-subze
Previously, it was putting new session state into the old map,
preserving only the state of the last session in the map.
2022-02-28 16:24:41 -06:00
fang
da47cfb08e
drum: correctly initialize session in +prep 2022-02-21 12:11:40 -06:00
fang
3120681b2b
sole: properly support multiple sessions
We update the sole protocol to more cleanly support multiple sessions.

Primarily, the "sole id" is updated to be a [@p @ta] instead of a @ta,
and it is now generated based off the connected dill session, rather
than statically.

This change ripples out to applications that support the sole protocol:
the subscription path becomes /sole/[ship]/[session] (as opposed to
/sole/[per-ship-constant]), and %sole-action pokes include the new id as
well.
For shoe agents, this means (at the very least) updating the function
signatures of the shoe arms.

/lib/sole has been updated to include helper functions for parsing a
sole-id from a subscription path, and turning a sole-id into its
corresponding path. It also has a function to aid in migrating old
sole-ids.

Existing sole agents are made to kick any known open sessions, forcing a
resubscribe by drum, so that they may use exclusively the new format
going forward. Third-party agents are recommended to do the same.

Note that some functionality, such as |link, still operates exclusively
on the default session. Improvements in this area to follow soon.
2022-02-20 17:19:03 -06:00