padz 1.2.0

An ergonomic, context-aware scratch pad for the terminal — a good Unix citizen
{#- Single pad line rendering using Tabular with sub-columns -#}
{#- Expects: pad (PadLineData), peek (bool), col_* (column widths) -#}

{#- Determine index style based on section type -#}
{%- set index_style = "list-index" -%}
{%- if pad.is_pinned_section -%}
  {%- set index_style = "pinned" -%}
{%- elif pad.is_deleted -%}
  {%- set index_style = "deleted-index" -%}
{%- endif -%}

{#- Determine title style based on state -#}
{%- set title_style = "list-title" -%}
{%- if pad.is_deleted -%}
  {%- set title_style = "deleted-title" -%}
{%- elif peek -%}
  {%- set title_style = "title" -%}
{%- endif -%}

{#- Define tabular layout with sub-columns for title+tags -#}
{%- set t = tabular([
    {"name": "left_pin", "width": col_left_pin, "style": "pinned"},
    {"name": "status", "width": col_status, "style": "status-icon"},
    {"name": "index", "width": col_index, "style": index_style},
    {"name": "content", "width": pad.title_width, "sub_columns": {
        "columns": [
            {"width": "fill", "overflow": "truncate", "style": title_style},
            {"width": {"min": 0, "max": 30}, "align": "right"}
        ],
        "separator": " "
    }},
    {"name": "time", "width": col_time, "align": "right", "style": "time"}
], width=line_width) -%}

{#- Render the row with indent prefix -#}
{{- pad.indent -}}
{{- t.row([
    pad.left_pin,
    pad.status_icon,
    pad.index,
    [pad.title, pad.tags_display],
    pad.time_ago
]) -}}
{{ "" | nl -}}