Skip to content

Commit 5e697dc

Browse files
committed
demos: make jj perform the line wrapping instead of term-transcript
Previously, `jj` couldn't determine the terminal widths inside demos.
1 parent 926c117 commit 5e697dc

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

demos/helpers.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ new_tmp_dir() {
1111

1212
run_command() {
1313
echo "\$ $@"
14-
eval "$@"
14+
# `bash` often resets $COLUMNS, so we also
15+
# allow $RUN_COMMAND_COLUMNS
16+
COLUMNS=${RUN_COMMAND_COLUMNS-${COLUMNS-80}} eval "$@"
1517
}
1618

1719
run_command_allow_broken_pipe() {

demos/run_scripts.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ which convert > /dev/null \
2525
echo "jj --version: (set PATH to change)"
2626
jj --version
2727

28+
# Make `jj` wrap text as opposed to `term-transcript`. `term-transcript` wraps
29+
# at 80 columns. Also, 80 seems to be the maximum number of columns that's
30+
# somewhat readable on mobile devices.
31+
#
32+
# Note that `bash` likes to reset the value of $COLUMNS, so we use a different
33+
# variable here that is interpreted by `run_command()` in `helpers.sh`.
34+
RUN_COMMAND_COLUMNS=80
35+
export RUN_COMMAND_COLUMNS
36+
2837
run_script_through_term_transcript_and_pipe_result_to_stderr() {
2938
script="$1"
3039
script_base="${script%.sh}"

demos/setup_standard_config.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ username = "jjfan"
1717
[ui]
1818
color="always"
1919
paginate="never"
20+
log-word-wrap=true # Need to set COLUMNS for this to work
2021
EOF
2122

2223
GIT_CONFIG_GLOBAL=$(mktemp --tmpdir gitconfig-XXXX)

0 commit comments

Comments
 (0)