Page MenuHome

UI: Info Editor Multi-Line Error Reports
AbandonedPublic

Authored by Harley Acheson (harley) on Mar 11 2020, 2:59 AM.

Details

Summary

With the recent Info Editor changes I left in the "simple case" for multi-line reports as I thought that was the better of the two alternatives. The "simple" case outputs each line of a multi-line error report as separate report lines. But because we place each new item at the bottom this naturally reverses these reports, rendering them hard to follow.

This patch changes the behavior of multi-line error reports only. Regular reports remain unchanged.

In the capture below the current behavior is shown on the left. The multi-line error (in red) shows as separate report lines in reverse order. The lines of the single error shown starts with the "Traceback" line and ends with a blank line after "location".

The changed behavior is shown on the right where the multi-line errors are treated as a single unit and is therefore in the correct order. The only downside, of course is that we lose the carriage returns but this seems like a nice trade-off to get them in correct order.

Diff Detail

Repository
rB Blender

Event Timeline

Harley Acheson (harley) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) requested changes to this revision.EditedMar 11 2020, 8:57 AM

This replaces proper newline stepping with code that modifies the content it displays, removing newlines from existing reports and removing the ability to display newlines.

This seems to be all that's needed not to show the icon multiple times:

diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 4d5f59cdb7c..e94df4a38e8 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -61,7 +61,11 @@ static int report_line_data(struct TextViewContext *tvc,
   int icon_fg_id;
   int icon_bg_id;
 
-  if (report->type & RPT_ERROR_ALL) {
+  /* Only draw the icon for the first line, by checking the internal line wrapping step. */
+  if (tvc->iter_char_next != report->len) {
+    *icon = ICON_NONE;
+  }
+  else if (report->type & RPT_ERROR_ALL) {
     icon_fg_id = TH_INFO_ERROR_TEXT;
     icon_bg_id = TH_INFO_ERROR;
     *icon = ICON_CANCEL;

Correcting the order will be a bigger change, but should be possible keeping the currently newline stepping logic for single lines (step backwards over lines instead of forwards).

source/blender/editors/space_info/textview.c
108

Causes:

/src/blender/source/blender/editors/space_info/textview.c:155:35: error: passing argument 1 of ‘textview_wrap_offsets’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  155 |   str_len = textview_wrap_offsets(str, str_len, tds->columns, &tot_lines, &offsets);
This revision now requires changes to proceed.Mar 11 2020, 8:57 AM
Harley Acheson (harley) planned changes to this revision.Mar 11 2020, 4:14 PM

@Campbell Barton (campbellbarton) - This seems to be all that's needed not to show the icon multiple...Correcting the order will be a bigger change, but...

Yes, showing only one icon is pretty easy, but correcting for the reversed order is causing my brain to hurt. LOL. Will keep at it.