@@ -80,7 +80,7 @@ field_overlay_source::build_field_lines(const listview_curses& lv,
8080 bool display = false ;
8181
8282 if (ll->is_time_skewed ()
83- || ll->get_msg_level () == log_level_t ::LEVEL_INVALID)
83+ || ll->get_msg_level () == log_level_t ::LEVEL_INVALID || ll-> has_ansi () )
8484 {
8585 display = true ;
8686 }
@@ -124,7 +124,7 @@ field_overlay_source::build_field_lines(const listview_curses& lv,
124124 }
125125
126126 if (ll->get_msg_level () == LEVEL_INVALID) {
127- for (const auto & sattr : this ->fos_log_helper .ldh_line_attrs ) {
127+ for (const auto & sattr : this ->fos_log_helper .ldh_attr_line . al_attrs ) {
128128 if (sattr.sa_type != &SA_INVALID) {
129129 continue ;
130130 }
@@ -165,6 +165,36 @@ field_overlay_source::build_field_lines(const listview_curses& lv,
165165 curr_timestamp[ts_len] = ' \0 ' ;
166166 }
167167
168+ auto first_nl = this ->fos_log_helper .ldh_attr_line .al_string .find (' \n ' );
169+ for (const auto & attr : this ->fos_log_helper .ldh_attr_line .al_attrs ) {
170+ if (attr.sa_type != &SA_UNSUPPORTED) {
171+ continue ;
172+ }
173+ if (first_nl != std::string::npos && attr.sa_range .lr_start >= first_nl)
174+ {
175+ continue ;
176+ }
177+
178+ const auto & msg
179+ = attr.sa_value .get <decltype (SA_UNSUPPORTED)::value_type>();
180+ auto msg_al
181+ = attr_line_t ()
182+ .pad_to (this ->fos_lss .get_filename_offset ()
183+ + attr.sa_range .lr_start )
184+ .append (ui_icon_t ::warning)
185+ .append (" " )
186+ .append (" Unsupported:" _h2)
187+ .append (" " )
188+ .append (msg)
189+ .with_attr_for_all (VC_ROLE.value (role_t ::VCR_WARNING));
190+ this ->fos_lines .emplace_back (msg_al);
191+ }
192+
193+ if (ll->is_continued ()) {
194+ // only need to display unsupported escapes for a continued line
195+ return ;
196+ }
197+
168198 if (ll->is_time_skewed ()) {
169199 time_lr.lr_start = 1 ;
170200 time_lr.lr_end = 2 ;
@@ -275,7 +305,9 @@ field_overlay_source::build_field_lines(const listview_curses& lv,
275305 this ->fos_lines .emplace_back (time_line);
276306 }
277307
278- if (this ->fos_contexts .empty () || !this ->fos_contexts .top ().c_show ) {
308+ if (this ->fos_contexts .empty () || !this ->fos_contexts .top ().c_show
309+ || row != lv.get_selection ())
310+ {
279311 return ;
280312 }
281313
@@ -352,7 +384,9 @@ field_overlay_source::build_field_lines(const listview_curses& lv,
352384 pattern_al,
353385 pattern_al.length (),
354386 line_range{skip, (int ) pattern_al.length ()});
355- this ->fos_lines .emplace_back (pattern_al);
387+ for (const auto & pattern_line_al : pattern_al.split_lines ()) {
388+ this ->fos_lines .emplace_back (pattern_line_al);
389+ }
356390 }
357391
358392 if (this ->fos_log_helper .ldh_line_values .lvv_opid_value ) {
@@ -939,8 +973,10 @@ field_overlay_source::list_value_for_overlay(
939973 vis_line_t row,
940974 std::vector<attr_line_t >& value_out)
941975{
942- // log_debug("value for overlay %d", row);
943- if (row == lv.get_selection ()) {
976+ auto line_pair_opt = this ->fos_lss .find_line_with_file (row);
977+ if (row == lv.get_selection ()
978+ || (line_pair_opt && line_pair_opt->second ->has_ansi ()))
979+ {
944980 this ->build_field_lines (lv, row);
945981 value_out = this ->fos_lines ;
946982 }
@@ -1211,22 +1247,22 @@ field_overlay_source::list_header_for_overlay(const listview_curses& lv,
12111247 attr_line_t retval;
12121248
12131249 retval.append (this ->fos_lss .get_filename_offset (), ' ' );
1214- if (this ->fos_contexts .top ().c_show ) {
1250+ if (lv. get_selection () == vl && this ->fos_contexts .top ().c_show ) {
12151251 retval.appendf (FMT_STRING (" \u258C Line {:L} parser details." ),
12161252 (int ) vl);
12171253 if (media == media_t ::display) {
12181254 retval.append (" Press " )
12191255 .append (" p" _hotkey)
12201256 .append (" to hide this panel." );
12211257 }
1222- } else {
1258+ } else if ( this -> fos_lss . find_bookmark_metadata (vl)) {
12231259 retval.append (" \u258C Line " )
12241260 .append (
12251261 lnav::roles::number (fmt::format (FMT_STRING (" {:L}" ), (int ) vl)))
12261262 .append (" metadata" );
12271263 }
12281264
1229- if (media == media_t ::display) {
1265+ if (!retval. empty () && media == media_t ::display) {
12301266 if (lv.get_overlay_selection ()) {
12311267 retval.append (" " )
12321268 .append (" SPC" _hotkey)
@@ -1242,5 +1278,9 @@ field_overlay_source::list_header_for_overlay(const listview_curses& lv,
12421278 }
12431279 }
12441280
1281+ if (retval.empty ()) {
1282+ return std::nullopt ;
1283+ }
1284+
12451285 return retval;
12461286}
0 commit comments