Refresh winsize before printing prompt

This allows prompts to react to $COLUMNS by e.g. omitting some parts.

We still fallback to a ">" prompt if that's still not short enough,
but now the user has a way of making a nicer prompt.

Fixes #904.
Fixes #4381.
This commit is contained in:
Fabian Homborg
2018-03-07 17:42:56 +01:00
parent b50541c655
commit 98d29b53de

View File

@@ -711,6 +711,10 @@ static void exec_prompt() {
// Do not allow the exit status of the prompts to leak through.
const bool apply_exit_status = false;
// HACK: Query winsize again because it might have changed.
// This allows prompts to react to $COLUMNS.
(void) get_current_winsize();
// If we have any prompts, they must be run non-interactively.
if (data->left_prompt.size() || data->right_prompt.size()) {
proc_push_interactive(0);