Commit Graph

45 Commits

Author SHA1 Message Date
fang
f6ee174d64
webterm: simpler printf rendering
As it turns out, the exact behavior of the 'S' CSI command is not "move
contents up into scrollback", but rather "delete the top line(s), move other
contents up". This behavior leads webterm to eat into outputs whenever it
renders slogs.

Xterm(.js), when given a newline character at the bottom of a scroll region,
does produce the desired behavior of bumping the top line away into scrollback,
instead of obliterating it.

This implementation now diverges from vere's, which is unfortunate, but the
alternative is making webterm track the contents of the bottom-most line of
the default session, which seems rather ridiculous by comparison.

Fixes #6257.
2023-01-28 00:34:03 +01:00
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
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
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
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
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
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
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
2c5510db64
Merge branch 'jb/next-gen-term' into next/dill
Resolves a good number of conflicts. Most notably, re-propagates removal
of gall's %onto, confirms new /app/herm behavior, coerces hood/drum
state adapters back into place, and updates webterm to use the latest
api.
2022-01-24 14:50:16 +01:00
fang
c7c601c041
herm: avoid trailing empty path segments
append /view to the existing subscription paths to "wrap" the possibly
empty path segment of the session name.
2021-12-13 14:24:20 +01:00
fang
b20abb8841
webterm: remove border, let term live in page
This also helps conceal some xterm resizing inaccuracies.
2021-12-09 00:36:50 +01:00
Hunter Miller
3ee9132416 theme: cleaning up a few mismatches 2021-12-08 17:00:25 -06:00
fang
81a45608a0
webterm: handle old-style blits and belts
Additions and changes easily distinguishable for extermination once the
new backend lands.
2021-12-08 17:12:38 +01:00
Liam Fitzgerald
9de35cfd70 webterm: update imports 2021-12-06 10:05:54 -05:00
Liam Fitzgerald
3fa572b53a webterm: fix broken imports 2021-12-06 10:05:14 -05:00
Liam Fitzgerald
3b3564cae9 webterm: update package name for lerna 2021-12-06 10:04:36 -05:00
fang
04f16e047b
webterm: backport
Doesn't quite compile, untested.
2021-11-25 13:00:52 +01:00
Fang
ac1d73dbbd
webterm: cleanup 2021-09-14 15:18:09 +02:00
Fang
a675dbda44
webterm: web interface only, herm stays in base
As per earlier discussion with @belisarius222.
2021-09-14 15:07:22 +02:00
Fang
208d8cebf9
webterm: standalone package
Splits herm and the webterm interface out into their own directories
for separate distribution.

Webterm glob pending.
2021-09-14 14:14:29 +02:00