diff --git a/doc/pages/options.asciidoc b/doc/pages/options.asciidoc index 49627108..4f69cbfb 100644 --- a/doc/pages/options.asciidoc +++ b/doc/pages/options.asciidoc @@ -377,6 +377,10 @@ are exclusively available to built-in options. reduce terminal output with sequences that could trigger flickering if unsynchronized (defaults to *false*) + *terminal_info_max_width*::: + set the maximum allowable width of an info box. set to zero for + no limit. + [[startup-info]] *startup_info_version* `int`:: _default_ 0 + diff --git a/src/main.cc b/src/main.cc index 3e5ba370..cd547988 100644 --- a/src/main.cc +++ b/src/main.cc @@ -567,7 +567,8 @@ void register_options() " terminal_wheel_scroll_amount int\n" " terminal_shift_function_key int\n" " terminal_padding_char codepoint\n" - " terminal_padding_fill bool\n", + " terminal_padding_fill bool\n" + " terminal_info_max_width int\n", UserInterface::Options{}); reg.declare_option("modelinefmt", "format string used to generate the modeline", "%val{bufname} %val{cursor_line}:%val{cursor_char_column} {{context_info}} {{mode_info}} - %val{client}@[%val{session}]"_str); diff --git a/src/terminal_ui.cc b/src/terminal_ui.cc index 9d6cf4b0..311c2527 100644 --- a/src/terminal_ui.cc +++ b/src/terminal_ui.cc @@ -1264,7 +1264,9 @@ void TerminalUI::info_show(const DisplayLine& title, const DisplayLineList& cont else if (style != InfoStyle::Modal) max_size.line -= m_menu.size.line; - const auto max_content_width = max_size.column - (framed ? 4 : 2) - (assisted ? m_assistant[0].column_length() : 0); + const auto max_content_width = (m_info_max_width > 0 ? std::min(max_size.column, m_info_max_width) : max_size.column) - + (framed ? 4 : 2) - + (assisted ? m_assistant[0].column_length() : 0); if (max_content_width <= 0) return; @@ -1495,6 +1497,8 @@ void TerminalUI::set_ui_options(const Options& options) m_padding_char = find("terminal_padding_char").map([](StringView s) { return s.column_length() < 1 ? ' ' : s[0_char]; }).value_or(Codepoint{'~'}); m_padding_fill = find("terminal_padding_fill").map(to_bool).value_or(false); + + m_info_max_width = find("terminal_info_max_width").map(str_to_int_ifp).value_or(0); } } diff --git a/src/terminal_ui.hh b/src/terminal_ui.hh index b02cbb33..fe3f1d6b 100644 --- a/src/terminal_ui.hh +++ b/src/terminal_ui.hh @@ -170,6 +170,7 @@ private: void set_resize_pending(); ColumnCount m_status_len = 0; + ColumnCount m_info_max_width = 0; }; }