Skip to content

Commit

Permalink
Update heading of UrlViewFormAction on RESIZE
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisschagt committed Oct 26, 2020
1 parent 011c3ae commit 9ae8ce1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions include/urlviewformaction.h
Expand Up @@ -32,6 +32,8 @@ class UrlViewFormAction : public FormAction {
bool process_operation(Operation op,
bool automatic = false,
std::vector<std::string>* args = nullptr) override;
void update_heading();

std::vector<LinkPair> links;
bool quit;
std::shared_ptr<RssFeed> feed;
Expand Down
12 changes: 9 additions & 3 deletions src/urlviewformaction.cpp
Expand Up @@ -124,6 +124,8 @@ bool UrlViewFormAction::process_operation(Operation op,
void UrlViewFormAction::prepare()
{
if (do_redraw) {
update_heading();

ListFormatter listfmt;
unsigned int i = 0;
for (const auto& link : links) {
Expand All @@ -141,6 +143,13 @@ void UrlViewFormAction::init()

f.run(-3); // compute all widget dimensions

do_redraw = true;
quit = false;
set_keymap_hints();
}

void UrlViewFormAction::update_heading()
{
const unsigned int width = urls_list.get_width();

FmtStrFormatter fmt;
Expand All @@ -150,9 +159,6 @@ void UrlViewFormAction::init()
f.set("head",
fmt.do_format(
cfg->get_configvalue("urlview-title-format"), width));
do_redraw = true;
quit = false;
set_keymap_hints();
}

KeyMapHintEntry* UrlViewFormAction::get_keymap_hint()
Expand Down

0 comments on commit 9ae8ce1

Please sign in to comment.