Use StatusLine face as default for the status line
This commit is contained in:
parent
87a7a94471
commit
3fe8446065
|
@ -97,10 +97,9 @@ DisplayLine Client::generate_mode_line() const
|
||||||
|
|
||||||
DisplayLine status;
|
DisplayLine status;
|
||||||
Face info_face = get_face("Information");
|
Face info_face = get_face("Information");
|
||||||
Face status_face = get_face("StatusLine");
|
|
||||||
|
|
||||||
status.push_back({ context().buffer().display_name(), status_face });
|
status.push_back({ context().buffer().display_name() });
|
||||||
status.push_back({ format(" {}:{} ", pos.line+1, col+1), status_face });
|
status.push_back({ format(" {}:{} ", pos.line+1, col+1) });
|
||||||
if (context().buffer().is_modified())
|
if (context().buffer().is_modified())
|
||||||
status.push_back({ "[+]", info_face });
|
status.push_back({ "[+]", info_face });
|
||||||
if (m_input_handler.is_recording())
|
if (m_input_handler.is_recording())
|
||||||
|
@ -111,10 +110,10 @@ DisplayLine Client::generate_mode_line() const
|
||||||
status.push_back({ "[no-hooks]", info_face });
|
status.push_back({ "[no-hooks]", info_face });
|
||||||
if (context().buffer().flags() & Buffer::Flags::Fifo)
|
if (context().buffer().flags() & Buffer::Flags::Fifo)
|
||||||
status.push_back({ "[fifo]", info_face });
|
status.push_back({ "[fifo]", info_face });
|
||||||
status.push_back({ " ", status_face });
|
status.push_back({ " " });
|
||||||
for (auto& atom : m_input_handler.mode_line())
|
for (auto& atom : m_input_handler.mode_line())
|
||||||
status.push_back(std::move(atom));
|
status.push_back(std::move(atom));
|
||||||
status.push_back({ format(" - {}@[{}]", context().name(), Server::instance().session()), status_face });
|
status.push_back({ format(" - {}@[{}]", context().name(), Server::instance().session()) });
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -143,14 +142,12 @@ void Client::change_buffer(Buffer& buffer)
|
||||||
|
|
||||||
void Client::redraw_ifn()
|
void Client::redraw_ifn()
|
||||||
{
|
{
|
||||||
Face default_face = get_face("Default");
|
|
||||||
|
|
||||||
Window& window = context().window();
|
Window& window = context().window();
|
||||||
UserInterface& ui = context().ui();
|
UserInterface& ui = context().ui();
|
||||||
|
|
||||||
const bool needs_redraw = window.needs_redraw(context());
|
const bool needs_redraw = window.needs_redraw(context());
|
||||||
if (needs_redraw)
|
if (needs_redraw)
|
||||||
ui.draw(window.update_display_buffer(context()), default_face);
|
ui.draw(window.update_display_buffer(context()), get_face("Default"));
|
||||||
|
|
||||||
DisplayLine mode_line = generate_mode_line();
|
DisplayLine mode_line = generate_mode_line();
|
||||||
if (needs_redraw or
|
if (needs_redraw or
|
||||||
|
@ -160,7 +157,7 @@ void Client::redraw_ifn()
|
||||||
m_mode_line = std::move(mode_line);
|
m_mode_line = std::move(mode_line);
|
||||||
m_status_line = m_pending_status_line;
|
m_status_line = m_pending_status_line;
|
||||||
|
|
||||||
ui.draw_status(m_status_line, m_mode_line, default_face);
|
ui.draw_status(m_status_line, m_mode_line, get_face("StatusLine"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.refresh();
|
ui.refresh();
|
||||||
|
|
|
@ -397,10 +397,14 @@ void NCursesUI::draw_status(const DisplayLine& status_line,
|
||||||
const DisplayLine& mode_line,
|
const DisplayLine& mode_line,
|
||||||
const Face& default_face)
|
const Face& default_face)
|
||||||
{
|
{
|
||||||
int status_line_pos = m_status_on_top ? 0 : (int)m_dimensions.line;
|
const int status_line_pos = m_status_on_top ? 0 : (int)m_dimensions.line;
|
||||||
wmove(m_window, status_line_pos, 0);
|
wmove(m_window, status_line_pos, 0);
|
||||||
|
|
||||||
|
wbkgdset(m_window, COLOR_PAIR(get_color_pair(default_face)));
|
||||||
wclrtoeol(m_window);
|
wclrtoeol(m_window);
|
||||||
|
|
||||||
draw_line(status_line, 0, default_face);
|
draw_line(status_line, 0, default_face);
|
||||||
|
|
||||||
const auto mode_len = mode_line.length();
|
const auto mode_len = mode_line.length();
|
||||||
const auto remaining = m_dimensions.column - status_line.length();
|
const auto remaining = m_dimensions.column - status_line.length();
|
||||||
if (mode_len < remaining)
|
if (mode_len < remaining)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user