jobs listing format + subshell spacing (batch88)#294
Merged
Conversation
The `jobs' listing diverged from bash in three ways: the status field was padded to 22 columns instead of bash's 27 (LONGEST_SIGNAL_DESC); every job was marked `+' instead of `+' for the current job, `-' for the previous, and a space otherwise; and a running background job was missing its trailing ` &'. Pad the status to 27, mark the two most recently started jobs `+'/`-' (an approximation of bash's current/previous job), and append ` &' to a running background job. Closes #293.
The single-line printer emitted `(list)' without the spaces bash uses, so job listings and command substitutions containing a subshell (`( sleep 2; exit 4 )') rendered differently from bash. Emit `( list )', matching bash's deparser (the multi-line function pretty-printer already spaced it).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related formatting fixes (
jobs83 → 67,comsub235 → 27, zero regressions).1. jobs listing format
The
jobslisting diverged from bash in three ways:LONGEST_SIGNAL_DESC);+instead of+for the current job,-for the previous, and a space otherwise;&.Now pads the status to 27, marks the two most recently started jobs
+/-(an approximation of bash's current/previous job), and appends&to a running background job.2. subshell spacing
The single-line AST printer emitted
(list)without the spaces bash uses. Emit( list )to match bash's deparser (the multi-line function pretty-printer already spaced it). This also fixed subshells inside command substitutions, hence thecomsub2improvement.Testing
jobs83 → 67,comsub235 → 27, zero regressions across the full suite&and subshell rendering (jobs, declare -f, type, trap) against bash 5.3Closes #293.