Skip to content

feat(terminal): follow browser navigation in the embedded terminal - #1

Closed
spandan11106 wants to merge 1 commit into
feat/93-embedded-terminalfrom
feat/93-terminal-cwd-sync
Closed

spandan11106 wants to merge 1 commit into
feat/93-embedded-terminalfrom
feat/93-terminal-cwd-sync

Conversation

@spandan11106

Copy link
Copy Markdown
Owner

Description

Stacked on feat/93-embedded-terminal (lgse#1089). Only the second commit belongs to this change; review the diff against that base.

Second of the three steps on lgse#93: the embedded terminal now follows the folder the browser is showing.

  • The browser stays the source of truth. Navigation is observed through the existing observer; nothing here ever moves the browser.
  • A directory change is injected only when the shell itself owns the terminal and the user has left no half-typed line at the prompt. tcgetpgrp on the PTY reports the first. The second is invisible to tcgetpgrp, so VTE's commit signal tracks whether the current line was submitted or discarded.
  • While neither holds, the newest requested folder is held and retried on a timer until the shell is free. Navigating past several folders while a build or an editor runs applies only the last of them, once.
  • Paths are single-quote escaped, so spaces, quotes and shell metacharacters in folder names are inert.
  • Locations with no local path, trash included, pause synchronisation rather than inventing a path.
  • The panel now tracks the location in the breadcrumb rather than the hovered column, so it matches what the window says it is showing. Ctrl+T is unchanged and still acts on a selected folder.

Still one-way: nothing reads the shell's own cd back into the browser.

Visual evidence

Pending — a short video showing navigation following, a busy shell being left alone, and the deferred change landing afterwards will follow in a comment.

How to test

  1. Open a folder, press F4, run pwd.
  2. Click into a subfolder in the browser, then run pwd in the panel again — it followed.
  3. Run sleep 15; echo DONE and navigate to a different folder while it runs. Nothing is injected; the sleep is untouched.
  4. Wait for it to finish. The folder you navigated to is applied on its own.
  5. Type echo HALF-TYPED without pressing Enter, then navigate elsewhere. The typed line is still intact and unchanged.
  6. Press Enter. The pending folder change applies after your command runs.
  7. Navigate to Trash. Synchronisation pauses and the terminal stays where it was.
  8. Make a folder whose name contains a space and a quote, and navigate into it.

Expected result: the terminal tracks the browser while the shell is idle, never interrupts a running process or corrupts typed input, applies only the newest pending folder once it can, and leaves non-local locations alone.

Related issue

Refs lgse#93

The embedded terminal now tracks the folder the browser is showing. The
browser stays the source of truth: navigation is observed, never driven.

A directory change is only injected when the shell itself owns the
terminal and the user has left no half-typed line at the prompt.
tcgetpgrp reports the first; the commit signal tracks the second, which
tcgetpgrp cannot see. While neither holds, the newest requested folder
is held and retried until the shell is free, so navigating past several
folders while a build or an editor runs applies only the last of them.

Locations with no local path, trash included, pause synchronisation
rather than inventing a path. The panel now follows the location in the
breadcrumb rather than the hovered column, so it matches what the window
says it is showing. Ctrl+T is unchanged and still acts on a selected
folder.

Refs lgse#93
@spandan11106

Copy link
Copy Markdown
Owner Author

Reopened against lgse/strata as lgse#1093, now that the base branch exists there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant