xF: simplify variable naming

This commit is contained in:
2026-08-08 05:51:58 +02:00
parent 60e40f4fe2
commit 57e2163bac
+56 -57
View File
@@ -534,10 +534,10 @@ app_measure_line_span (const struct buffer_line *line,
if (from < to)
{
char *text = xstrndup (item->text + from - offset, to - from);
struct widget *widget = app_make_line_item_widget
struct widget *w = app_make_line_item_widget
(base, line->leaked, item, text, false);
width += widget->width;
widget_destroy (widget);
width += w->width;
widget_destroy (w);
free (text);
}
offset = item_end;
@@ -2023,13 +2023,13 @@ tui_render_editor (struct widget *self)
static struct widget *
tui_make_editor (chtype attrs)
{
struct widget *widget = xcalloc (1, sizeof *widget + 1);
widget->on_render = tui_render_editor;
widget->attrs = attrs;
widget->width = -1;
widget->height = 1;
widget->text = "";
return widget;
struct widget *w = xcalloc (1, sizeof *w + 1);
w->on_render = tui_render_editor;
w->attrs = attrs;
w->width = -1;
w->height = 1;
w->text = "";
return w;
}
// --- X11 widgets -------------------------------------------------------------
@@ -2103,15 +2103,15 @@ x11_render_editor (struct widget *self)
static struct widget *
x11_make_editor (chtype attrs)
{
struct widget *widget = xcalloc (1, sizeof *widget + 1);
widget->on_render = x11_render_editor;
widget->attrs = attrs;
widget->width = -1;
widget->height = g_xui.vunit;
widget->text = "";
struct widget *w = xcalloc (1, sizeof *w + 1);
w->on_render = x11_render_editor;
w->attrs = attrs;
w->width = -1;
w->height = g_xui.vunit;
w->text = "";
// Enforce clipping by putting this inside a container.
struct widget *wrapper = xui_hbox (widget);
struct widget *wrapper = xui_hbox (w);
wrapper->width = -1;
return wrapper;
}
@@ -2206,14 +2206,14 @@ app_make_scrollbar (enum app_widget_id id)
|| view.total <= app_viewport_height ())
return NULL;
struct widget *scrollbar = g_xui.ui->scrollbar
struct widget *w = g_xui.ui->scrollbar
(g_attrs[ATTRIBUTE_SCROLLBAR].attrs, top, view.total);
#ifdef HAVE_X11
if (g_xui.ui == &x11_ui)
scrollbar->on_render = app_x11_render_scrollbar;
w->on_render = app_x11_render_scrollbar;
#endif // HAVE_X11
scrollbar->widget_id = id;
return scrollbar;
w->widget_id = id;
return w;
}
static int
@@ -2244,11 +2244,10 @@ app_push (struct layout *l, struct widget *w)
static struct widget *
app_label_attrs (chtype attrs, unsigned extended, const char *text, bool fill)
{
struct widget *widget =
g_xui.ui->label (attrs, extended, text ? text : "");
struct widget *w = g_xui.ui->label (attrs, extended, text ? text : "");
if (fill)
widget->width = -1;
return widget;
w->width = -1;
return w;
}
static struct widget *
@@ -2262,11 +2261,10 @@ app_button (enum app_attribute attribute, const char *text, enum action action)
{
const struct xui_icon_point *icon =
action == ACTION_RECONNECT ? app_icon_reconnect : NULL;
struct widget *widget =
g_xui.ui->symbol (g_attrs[attribute].attrs, text, icon);
widget->widget_id = WIDGET_BUTTON;
widget->userdata = action;
return widget;
struct widget *w = g_xui.ui->symbol (g_attrs[attribute].attrs, text, icon);
w->widget_id = WIDGET_BUTTON;
w->userdata = action;
return w;
}
static struct widget *
@@ -2396,14 +2394,14 @@ app_make_line_item_widget (chtype base, bool leaked,
attrs |= link;
}
struct widget *widget
struct widget *w
= app_label_attrs (attrs, extended, text, flexible && !link);
if (link)
{
widget->widget_id = WIDGET_LINK;
widget->userdata = item->style;
w->widget_id = WIDGET_LINK;
w->userdata = item->style;
}
return widget;
return w;
}
static void
@@ -2555,10 +2553,10 @@ app_make_buffer_row (struct buffer *b, int index)
app_push (&row, app_padding (attribute, 0.25));
free (label);
struct widget *widget = xui_hbox (row.head);
widget->widget_id = WIDGET_BUFFER;
widget->userdata = index;
return widget;
struct widget *w = xui_hbox (row.head);
w->widget_id = WIDGET_BUFFER;
w->userdata = index;
return w;
}
static void
@@ -2668,9 +2666,10 @@ app_make_date_change_marker (time_t when)
app_push (&row, app_label (ATTRIBUTE_DATE_CHANGE,
app_format_date (when), true));
app_push (&row, app_padding (ATTRIBUTE_NORMAL, 0.25));
struct widget *marker = xui_hbox (row.head);
marker->height = g_xui.vunit;
return marker;
struct widget *w = xui_hbox (row.head);
w->height = g_xui.vunit;
return w;
}
static const char *
@@ -2800,20 +2799,20 @@ app_make_read_marker (void)
{
if (g_xui.ui == &tui_ui)
{
struct widget *marker = xcalloc (1, sizeof *marker + 1);
marker->on_render = tui_render_read_marker;
marker->attrs = g_attrs[ATTRIBUTE_READ_MARKER].attrs;
marker->width = -1;
marker->height = READ_MARKER_HEIGHT;
return marker;
struct widget *w = xcalloc (1, sizeof *w + 1);
w->on_render = tui_render_read_marker;
w->attrs = g_attrs[ATTRIBUTE_READ_MARKER].attrs;
w->width = -1;
w->height = READ_MARKER_HEIGHT;
return w;
}
// Reversing swaps the orange foreground into the padding background.
struct widget *marker = g_xui.ui->padding
struct widget *w = g_xui.ui->padding
(g_attrs[ATTRIBUTE_READ_MARKER].attrs | A_REVERSE, 0, 0);
marker->width = -1;
marker->height = READ_MARKER_HEIGHT;
return marker;
w->width = -1;
w->height = READ_MARKER_HEIGHT;
return w;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -2940,12 +2939,12 @@ app_make_transcript (time_t now)
{ .slice = app_make_transcript_slice () };
app_walk_transcript (now, transcript_layout_visit, &ctx);
struct widget *transcript = xui_vbox (ctx.rows.head);
transcript->on_allocated = app_on_viewport_allocated;
transcript->widget_id = WIDGET_TRANSCRIPT;
transcript->userdata = app_transcript_slice_offset (&ctx.slice);
transcript->width = transcript->height = -1;
return transcript;
struct widget *w = xui_vbox (ctx.rows.head);
w->on_allocated = app_on_viewport_allocated;
w->widget_id = WIDGET_TRANSCRIPT;
w->userdata = app_transcript_slice_offset (&ctx.slice);
w->width = w->height = -1;
return w;
}
struct transcript_height_ctx