Merge remote-tracking branch 'nojhan/feat_padding-options'
This commit is contained in:
commit
7394307a3d
|
@ -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,17 @@ 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);
|
||||
column_index += m_padding_char.length();
|
||||
}
|
||||
}
|
||||
else
|
||||
m_window.draw(m_palette, m_padding_char, face);
|
||||
}
|
||||
|
||||
m_dirty = true;
|
||||
|
@ -1390,6 +1400,24 @@ 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())
|
||||
// Defaults to tilde.
|
||||
m_padding_char = DisplayAtom("~");
|
||||
else if (it->value.column_length() < 1)
|
||||
// Do not allow empty string, use space instead.
|
||||
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