fix(web): label only the first prompt row with the working directory
A multi-line command repeated the cwd label on every prompt row, which states something the view does not know: it carries ONE working directory — where the call started — and a `cd` in the command moves later lines elsewhere. `cd ~` then `ls` rendered both rows labelled with the session workspace while `ls` actually listed the home directory. The label now appears on the first row only, and later rows keep a bare `$` so they still read as prompts. Same reasoning as the run-state dot: neither a per-line directory nor a per-line exit status exists to report. The built-bundle snapshot records the effect on fixture turn 60's two-line command (`fixture echo done` becomes `$ echo done`).
This commit is contained in:
@@ -174,7 +174,15 @@ export function TerminalBlock({
|
||||
per-command status, so a dot per row would assert a
|
||||
per-line outcome nothing here knows. */}
|
||||
{index === 0 && <StateDot state={state.state} className={css.runState} />}
|
||||
<span className={css.cwd}>{cwd === undefined ? '$' : promptLabel(cwd, home)}</span>
|
||||
{/* The cwd labels the CALL, so only its first row carries it. The
|
||||
view knows one working directory — where the call started —
|
||||
and a later line may well run somewhere else (a `cd` in the
|
||||
command is enough), so repeating the label down the rows would
|
||||
assert a directory per line that nothing here knows. Later
|
||||
rows keep a bare `$` to stay aligned as prompts. */}
|
||||
<span className={css.cwd}>
|
||||
{index > 0 || cwd === undefined ? '$' : promptLabel(cwd, home)}
|
||||
</span>
|
||||
<span className={css.command}>{line}</span>
|
||||
</div>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user