Skip to content

Commit 394e4df

Browse files
committed
[ui] top should not move when new data comes in
1 parent e606186 commit 394e4df

File tree

6 files changed

+28
-13
lines changed

6 files changed

+28
-13
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ Bug Fixes:
77
* The abbreviated month `%b` time-conversion was not
88
always falling back to English locale, which could
99
prevent lnav from starting up.
10+
* The top of the LOG view could move in some cases when
11+
filtering was enabled.
12+
* Some status bar fields were not always showing
13+
updates.
1014

1115
## lnav v0.13.1
1216

src/bottom_status_source.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ bottom_status_source::update_hits(textview_curses* tc)
169169
}
170170
if (!sf.is_cylon()) {
171171
sf.set_cylon(true);
172-
retval = true;
173172
}
173+
retval = true;
174174
} else {
175175
new_role = role_t::VCR_STATUS;
176176
if (sf.is_cylon()) {

src/filter_status_source.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,22 @@ filter_status_source::statusview_value_for_field(int field)
201201
return this->tss_fields[field];
202202
}
203203

204-
void
204+
bool
205205
filter_status_source::update_filtered(text_sub_source* tss)
206206
{
207207
if (tss == nullptr) {
208-
return;
208+
return false;
209209
}
210210

211211
auto& sf = this->tss_fields[TSF_FILTERED];
212+
auto retval = false;
212213

213214
if (tss->get_filtered_count() == 0) {
214215
if (tss->tss_apply_filters) {
215-
sf.clear();
216+
if (!sf.empty()) {
217+
sf.clear();
218+
retval = true;
219+
}
216220
} else {
217221
sf.set_value(
218222
" \u2718 Filtering disabled, re-enable with " ANSI_BOLD_START
@@ -228,14 +232,18 @@ filter_status_source::update_filtered(text_sub_source* tss)
228232
al.with_attr(
229233
string_attr(line_range{0, -1},
230234
VC_STYLE.value(text_attrs::with_bold())));
235+
retval = true;
231236
}
232237
} else {
233238
this->tss_fields[TSF_FILTERED].set_role(role_t::VCR_ALERT_STATUS);
234239
this->bss_last_filtered_count = tss->get_filtered_count();
235240
timer.start_fade(this->bss_filter_counter, 3);
241+
sf.set_value("%'9d Lines not shown ", tss->get_filtered_count());
242+
retval = true;
236243
}
237-
sf.set_value("%'9d Lines not shown ", tss->get_filtered_count());
238244
}
245+
246+
return retval;
239247
}
240248

241249
filter_help_status_source::filter_help_status_source()

src/filter_status_source.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public:
5555

5656
status_field& statusview_value_for_field(int field) override;
5757

58-
void update_filtered(text_sub_source* tss);
58+
bool update_filtered(text_sub_source* tss);
5959

6060
private:
6161
status_field tss_fields[TSF__MAX];

src/lnav.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,10 +1031,12 @@ struct refresh_status_bars {
10311031
{
10321032
prompt.p_editor.set_inactive_value(cancel_msg);
10331033
}
1034-
10351034
if (!lnav_data.ld_log_source.is_indexing_in_progress()
1036-
|| lnav_data.ld_log_source.text_line_count() == 0)
1035+
|| lnav_data.ld_log_source.lss_index_generation == 0)
10371036
{
1037+
if (lnav_data.ld_log_source.lss_index_generation == 0) {
1038+
lnav_data.ld_view_stack.top().value()->set_needs_update();
1039+
}
10381040
lnav_data.ld_view_stack.do_update();
10391041
}
10401042
if (this->rsb_top_source->update_time(current_time)) {
@@ -1534,10 +1536,9 @@ VALUES ('org.lnav.mouse-support', -1, DATETIME('now', '+1 minute'),
15341536
if (link_iter != al.al_attrs.end()) {
15351537
auto href = link_iter->sa_value.get<std::string>();
15361538
if (!startswith(href, "#")) {
1537-
ec.execute_with(
1538-
INTERNAL_SRC_LOC,
1539-
":xopen $href",
1540-
std::make_pair("href", href));
1539+
ec.execute_with(INTERNAL_SRC_LOC,
1540+
":xopen $href",
1541+
std::make_pair("href", href));
15411542
}
15421543
}
15431544
};

src/lnav.indexing.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,9 @@ rebuild_indexes(std::optional<ui_clock::time_point> deadline)
433433
}
434434

435435
auto* tss = tc->get_sub_source();
436-
lnav_data.ld_filter_status_source.update_filtered(tss);
436+
if (lnav_data.ld_filter_status_source.update_filtered(tss)) {
437+
lnav_data.ld_status[LNS_FILTER].set_needs_update();
438+
}
437439
if (retval.rir_changes > 0) {
438440
lnav_data.ld_scroll_broadcaster(tc);
439441
}

0 commit comments

Comments
 (0)