Skip to content

Commit 505eea3

Browse files
committed
[lss] text_size_for_line() was not handling case when text_value_for_line() returns empty
Related to #1485
1 parent 61c3cd4 commit 505eea3

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/logfile_sub_source.cc

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ logfile_sub_source::text_value_for_line(textview_curses& tc,
242242
{
243243
if (this->lss_indexing_in_progress) {
244244
value_out = "";
245+
this->lss_token_attrs.clear();
245246
return {};
246247
}
247248

@@ -3296,12 +3297,16 @@ logfile_sub_source::text_size_for_line(textview_curses& tc,
32963297
if (this->lss_line_context == line_context_t::time_column) {
32973298
auto time_attr
32983299
= find_string_attr(this->lss_token_attrs, &L_TIMESTAMP);
3299-
line_width -= time_attr->sa_range.length();
3300-
auto format = this->lss_token_file->get_format();
3301-
if (format->lf_level_hideable) {
3302-
auto level_attr
3303-
= find_string_attr(this->lss_token_attrs, &L_LEVEL);
3304-
line_width -= level_attr->sa_range.length();
3300+
if (time_attr != this->lss_token_attrs.end()) {
3301+
line_width -= time_attr->sa_range.length();
3302+
auto format = this->lss_token_file->get_format();
3303+
if (format->lf_level_hideable) {
3304+
auto level_attr
3305+
= find_string_attr(this->lss_token_attrs, &L_LEVEL);
3306+
if (level_attr != this->lss_token_attrs.end()) {
3307+
line_width -= level_attr->sa_range.length();
3308+
}
3309+
}
33053310
}
33063311
}
33073312
this->lss_line_size_cache[index].second = line_width;

0 commit comments

Comments
 (0)