made local really local

This commit is contained in:
fatalerrors
2026-05-21 11:17:21 +02:00
parent 19ca7fa905
commit c92ca8a51f
4 changed files with 46 additions and 6 deletions

View File

@@ -128,6 +128,7 @@ export -f set_colors
# D : debug (cyan)
disp()
{
local _disp_print_wrapped
_disp_print_wrapped()
{
local prefix="$1"
@@ -241,6 +242,7 @@ export -f disp
# Usage: mdcat [file]
mdcat()
{
local _mdcat_style_inline
_mdcat_style_inline()
{
local text="$1"
@@ -346,6 +348,7 @@ mdcat()
printf "%s\n" "$text"
}
local _mdcat_print_hr
_mdcat_print_hr()
{
local cols="${COLUMNS:-}"
@@ -364,6 +367,7 @@ mdcat()
fi
}
local _mdcat_print_code_block
_mdcat_print_code_block()
{
local lang="$1"
@@ -422,14 +426,11 @@ mdcat()
printf "%b%s%b\n" "$frame_on" "$border" "$off"
}
local _mdcat_print_table
# That function is a bit slow, we need to try to optimize it
_mdcat_print_table()
{
local -a lines=("$@")
local -a table_rows=()
local -a col_widths=()
local i j ncols=0
local sep=$'\x1f'
local _mdcat_parse_table_row
_mdcat_parse_table_row()
{
local input="$1"
@@ -466,6 +467,12 @@ mdcat()
printf '%s' "$joined"
}
local -a lines=("$@")
local -a table_rows=()
local -a col_widths=()
local i j ncols=0
local sep=$'\x1f'
# Parse header and data rows, skipping the Markdown separator row.
# Width is computed from visible text length with ANSI escapes stripped.
for ((i=0; i<${#lines[@]}; ++i)); do