diff --git a/builtin.cpp b/builtin.cpp index a01c2519b..e4f276f9f 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -220,7 +220,14 @@ wcstring builtin_help_get(parser_t &parser, const wchar_t *name) wcstring_list_t lst; wcstring out; const wcstring name_esc = escape_string(name, 1); - const wcstring cmd = format_string(L"__fish_print_help %ls", name_esc.c_str()); + wcstring cmd = format_string(L"__fish_print_help %ls", name_esc.c_str()); + if (!builtin_out_redirect && isatty(1)) + { + // since we're using a subshell, __fish_print_help can't tell we're in + // a terminal. Tell it ourselves. + int cols = common_get_width(); + cmd = format_string(L"__fish_print_help --tty-width %d %ls", cols, name_esc.c_str()); + } if (exec_subshell(cmd, lst, false /* don't apply exit status */) >= 0) { for (size_t i=0; i