summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2021-04-28 08:11:15 +1000
committerMaxime Coste <mawww@kakoune.org>2021-04-28 08:11:15 +1000
commit7394307a3dd676fc52eca48d3467e2f914f34111 (patch)
tree7227cb7c74a404838ae17c6f2e3e61a44b2600da /src
parentafc30a894067ccb1d06d2d3dcdaec72fde253783 (diff)
parenta9d33a879696818b556fab00080fcabb8a120db9 (diff)
Merge remote-tracking branch 'nojhan/feat_padding-options'
Diffstat (limited to 'src')
-rw-r--r--src/ncurses_ui.cc30
-rw-r--r--src/ncurses_ui.hh3
2 files changed, 32 insertions, 1 deletions
diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc
index 9f7b9011..68843135 100644
--- a/src/ncurses_ui.cc
+++ b/src/ncurses_ui.cc
@@ -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");
+ }
}
}
diff --git a/src/ncurses_ui.hh b/src/ncurses_ui.hh
index 693e6608..4cc354cd 100644
--- a/src/ncurses_ui.hh
+++ b/src/ncurses_ui.hh
@@ -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;