Handle <c-l> redrawing on the server side
That way we can force a redraw at any moment, including during batch execution.
This commit is contained in:
parent
26e81976d3
commit
f1fb2114da
|
@ -77,6 +77,8 @@ void Client::handle_available_input(EventMode mode)
|
|||
{
|
||||
if (*key == ctrl('c'))
|
||||
killpg(getpgrp(), SIGINT);
|
||||
if (*key == ctrl('l'))
|
||||
redraw_ifn(true);
|
||||
else if (*key == Key::FocusIn)
|
||||
context().hooks().run_hook("FocusIn", context().name(), context());
|
||||
else if (*key == Key::FocusOut)
|
||||
|
@ -171,18 +173,18 @@ static bool is_inline(InfoStyle style)
|
|||
style == InfoStyle::InlineBelow;
|
||||
}
|
||||
|
||||
void Client::redraw_ifn()
|
||||
void Client::redraw_ifn(bool force)
|
||||
{
|
||||
Window& window = context().window();
|
||||
|
||||
const bool needs_redraw = window.needs_redraw(context());
|
||||
if (needs_redraw)
|
||||
if (needs_redraw or force)
|
||||
{
|
||||
auto window_pos = window.position();
|
||||
m_ui->draw(window.update_display_buffer(context()), get_face("Default"));
|
||||
|
||||
// window moved, reanchor eventual menu and info
|
||||
if (window_pos != window.position())
|
||||
if (force or window_pos != window.position())
|
||||
{
|
||||
if (not m_menu.items.empty() and m_menu.style == MenuStyle::Inline)
|
||||
{
|
||||
|
@ -199,7 +201,7 @@ void Client::redraw_ifn()
|
|||
}
|
||||
|
||||
DisplayLine mode_line = generate_mode_line();
|
||||
if (needs_redraw or
|
||||
if (force or needs_redraw or
|
||||
m_status_line.atoms() != m_pending_status_line.atoms() or
|
||||
mode_line.atoms() != m_mode_line.atoms())
|
||||
{
|
||||
|
@ -210,10 +212,10 @@ void Client::redraw_ifn()
|
|||
m_ui_dirty = true;
|
||||
}
|
||||
|
||||
if (m_ui_dirty)
|
||||
if (m_ui_dirty or force)
|
||||
{
|
||||
m_ui_dirty = false;
|
||||
m_ui->refresh();
|
||||
m_ui->refresh(force);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
CharCoord dimensions() const { return m_ui->dimensions(); }
|
||||
|
||||
void force_redraw();
|
||||
void redraw_ifn();
|
||||
void redraw_ifn(bool force = false);
|
||||
|
||||
void check_if_buffer_needs_reloading();
|
||||
|
||||
|
|
|
@ -197,9 +197,9 @@ void JsonUI::info_hide()
|
|||
rpc_call("info_hide");
|
||||
}
|
||||
|
||||
void JsonUI::refresh()
|
||||
void JsonUI::refresh(bool force)
|
||||
{
|
||||
rpc_call("refresh");
|
||||
rpc_call("refresh", force);
|
||||
}
|
||||
|
||||
void JsonUI::set_input_callback(InputCallback callback)
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
InfoStyle style) override;
|
||||
void info_hide() override;
|
||||
|
||||
void refresh() override;
|
||||
void refresh(bool force) override;
|
||||
|
||||
void set_input_callback(InputCallback callback) override;
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ std::unique_ptr<UserInterface> create_local_ui(bool dummy_ui)
|
|||
CharCoord dimensions() override { return {24,80}; }
|
||||
bool is_key_available() override { return false; }
|
||||
Key get_key() override { return Key::Invalid; }
|
||||
void refresh() override {}
|
||||
void refresh(bool) override {}
|
||||
void set_input_callback(InputCallback) override {}
|
||||
void set_ui_options(const Options&) override {}
|
||||
};
|
||||
|
|
|
@ -301,9 +301,12 @@ void NCursesUI::redraw()
|
|||
doupdate();
|
||||
}
|
||||
|
||||
void NCursesUI::refresh()
|
||||
void NCursesUI::refresh(bool force)
|
||||
{
|
||||
if (m_dirty)
|
||||
if (force)
|
||||
redrawwin(m_window);
|
||||
|
||||
if (m_dirty or force)
|
||||
redraw();
|
||||
m_dirty = false;
|
||||
}
|
||||
|
@ -491,11 +494,6 @@ Key NCursesUI::get_key()
|
|||
|
||||
if (c > 0 and c < 27)
|
||||
{
|
||||
if (c == control('l'))
|
||||
{
|
||||
redrawwin(m_window);
|
||||
redraw();
|
||||
}
|
||||
if (c == control('z'))
|
||||
{
|
||||
raise(SIGTSTP);
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
InfoStyle style) override;
|
||||
void info_hide() override;
|
||||
|
||||
void refresh() override;
|
||||
void refresh(bool force) override;
|
||||
|
||||
void set_input_callback(InputCallback callback) override;
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ public:
|
|||
const DisplayLine& mode_line,
|
||||
const Face& default_face) override;
|
||||
|
||||
void refresh() override;
|
||||
void refresh(bool force) override;
|
||||
|
||||
bool is_key_available() override;
|
||||
Key get_key() override;
|
||||
|
@ -353,10 +353,11 @@ void RemoteUI::draw_status(const DisplayLine& status_line,
|
|||
msg.write(default_face);
|
||||
}
|
||||
|
||||
void RemoteUI::refresh()
|
||||
void RemoteUI::refresh(bool force)
|
||||
{
|
||||
Message msg(m_socket_watcher.fd());
|
||||
msg.write(RemoteUIMsg::Refresh);
|
||||
msg.write(force);
|
||||
}
|
||||
|
||||
void RemoteUI::set_ui_options(const Options& options)
|
||||
|
@ -516,7 +517,7 @@ void RemoteClient::process_next_message()
|
|||
break;
|
||||
}
|
||||
case RemoteUIMsg::Refresh:
|
||||
m_ui->refresh();
|
||||
m_ui->refresh(read<bool>(socket));
|
||||
break;
|
||||
case RemoteUIMsg::SetOptions:
|
||||
m_ui->set_ui_options(read_idmap<String, MemoryDomain::Options>(socket));
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
virtual bool is_key_available() = 0;
|
||||
virtual Key get_key() = 0;
|
||||
|
||||
virtual void refresh() = 0;
|
||||
virtual void refresh(bool force) = 0;
|
||||
|
||||
virtual void set_input_callback(InputCallback callback) = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user