The main goal in this series is to allow using the pager when displaying hunks during "add -p" sessions, to make easier for users to review hunks longer than one screen height. This iteration, v3, introduces a new command: '|', suggested by Junio, instead of the 'P' command proposed in the previous iteration. This allows us to use the pager: (1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,s,e,p,|,?]? | But also to use other programs, like: (1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,s,e,p,|,?]? | head Or: (1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,s,e,p,|,?]? | grep term Hopefully, we'll find a way to avoid sending ANSI codes, on demand, without disabling it entirely with color.ui=never or any other global option. To make this usable: (1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,s,e,p,|,?]? | vim - However, the current functionality meets my current needs, so I'm happy with it. This, a new 'interactive.pipeCommand' setting, or a new switch: 'add -P', are left for discussing in, hopefully, a future series. One final note; I preferred to model the help text this way: y - stage this hunk n - do not stage this hunk q - quit; do not stage this hunk or any of the remaining ones a - stage this hunk and all later hunks in the file d - do not stage this hunk or any of the later hunks in the file j - leave this hunk undecided, see next undecided hunk J - leave this hunk undecided, see next hunk g - select a hunk to go to / - search for a hunk matching the given regex s - split the current hunk into smaller hunks e - manually edit the current hunk p - print the current hunk | - pipe the current hunk to the pager, or |<program> to use a program' ? - print help Instead of: y - stage this hunk n - do not stage this hunk q - quit; do not stage this hunk or any of the remaining ones a - stage this hunk and all later hunks in the file d - do not stage this hunk or any of the later hunks in the file j - leave this hunk undecided, see next undecided hunk J - leave this hunk undecided, see next hunk g - select a hunk to go to / - search for a hunk matching the given regex s - split the current hunk into smaller hunks e - manually edit the current hunk p - print the current hunk |[program] - pipe the current hunk to a program, the pager if none... ? - print help Because I believe it reads better by maintaining a single character before the dash. But I am not opposed to the latter. The series is now based on jc/add-patch-enforce-single-letter-input, which has been recently merged to master. Thanks. Rubén Justo (6): add-patch: test for 'p' command pager: do not close fd 2 unnecessarily pager: introduce wait_for_pager pager: introduce setup_custom_pager test-terminal: introduce --no-stdin-pty add-patch: introduce the command '|' add-patch.c | 17 ++++++++-- pager.c | 55 ++++++++++++++++++++++++------- pager.h | 7 +++- t/t3701-add-interactive.sh | 67 +++++++++++++++++++++++++++++--------- t/test-terminal.perl | 32 ++++++++++-------- 5 files changed, 135 insertions(+), 43 deletions(-) -- 2.45.0.97.g9fa538478d