mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-30 06:03:49 +08:00
d74b774f51
Reproducer: type `: \<RET><M-p>`. This used to print an error due to builtin test receiving too many arguments. It looks like (commandline -j) can return multiple items, because a job can be broken up in multiple lines terminated by backslashes.
18 lines
366 B
Fish
18 lines
366 B
Fish
function __fish_paginate -d "Paginate the current command using the users default pager"
|
|
|
|
set -l cmd less
|
|
if set -q PAGER
|
|
set cmd $PAGER
|
|
end
|
|
|
|
if test -z (commandline -j | string join '')
|
|
commandline -a $history[1]
|
|
end
|
|
|
|
if commandline -j | string match -q -r -v "$cmd *\$"
|
|
|
|
commandline -aj " 2>&1 | $cmd;"
|
|
end
|
|
|
|
end
|