[feat] add ui_options: padding_char & padding_fill
In some cases, it may be difficult to easily spot the area out of the buffer (bad color scheme, small font, superimposed windows). This patch adds two ncurses ui_options to bypass this problem: - `ncurses_padding_char`, to configure the padding character, - `ncurses_padding_fill`, to indicate whether to fill the padding line (or to display a single character). The default config is the legacy one (a single "~").
This commit is contained in:
parent
212242cc60
commit
daa63ba879
|
@ -353,6 +353,15 @@ are exclusively available to built-in options.
|
|||
Function key from which shifted function key start, if the
|
||||
terminal sends F13 for <s-F1>, this should be set to 12.
|
||||
|
||||
*ncurses_padding_char*:::
|
||||
character used to indicate the area out of the displayed buffer
|
||||
(defaults to '~')
|
||||
|
||||
*ncurses_padding_fill*:::
|
||||
if *yes* or *true*, fill the padding area with the padding character
|
||||
instead of displaying a single character at the beginning of the
|
||||
padding line (defaults to *false*)
|
||||
|
||||
[[startup-info]]
|
||||
*startup_info_version* `int`::
|
||||
_default_ 0 +
|
||||
|
|
|
@ -474,7 +474,14 @@ void NCursesUI::draw(const DisplayBuffer& display_buffer,
|
|||
while (line_index < dim.line + line_offset)
|
||||
{
|
||||
m_window.move_cursor(line_index++);
|
||||
m_window.draw(m_palette, DisplayAtom("~"), face);
|
||||
if (m_padding_fill)
|
||||
{
|
||||
ColumnCount column_index = 0;
|
||||
while (column_index++ < dim.column)
|
||||
m_window.draw(m_palette, m_padding_char, face);
|
||||
}
|
||||
else
|
||||
m_window.draw(m_palette, m_padding_char, face);
|
||||
}
|
||||
|
||||
m_dirty = true;
|
||||
|
@ -1361,6 +1368,22 @@ void NCursesUI::set_ui_options(const Options& options)
|
|||
m_wheel_scroll_amount = wheel_scroll_amount_it != options.end() ?
|
||||
str_to_int_ifp(wheel_scroll_amount_it->value).value_or(3) : 3;
|
||||
}
|
||||
|
||||
{
|
||||
auto it = options.find("ncurses_padding_char"_sv);
|
||||
if (it == options.end())
|
||||
m_padding_char = DisplayAtom("~");
|
||||
else if (it->value.length() < 1)
|
||||
m_padding_char = DisplayAtom(" ");
|
||||
else
|
||||
m_padding_char = DisplayAtom(it->value);
|
||||
}
|
||||
|
||||
{
|
||||
auto it = options.find("ncurses_padding_fill"_sv);
|
||||
m_padding_fill = it != options.end() and
|
||||
(it->value == "yes" or it->value == "true");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -169,6 +169,9 @@ private:
|
|||
|
||||
bool m_set_title = true;
|
||||
|
||||
DisplayAtom m_padding_char = DisplayAtom("~");
|
||||
bool m_padding_fill = false;
|
||||
|
||||
bool m_dirty = false;
|
||||
|
||||
bool m_resize_pending = false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user