чување 84dbc511f3ef8b491a1a749df533b2f0a7702b8b
родитељ cc1828b61d31224ab8a2cca0cacf26f1dbbc9ee5
Аутор: Страхиња Радић <sr@strahinja.org>
Датум: Wed, 25 Jun 2025 11:41:50 +0200
ste.in: Update maxcols on commands affecting the header row
Diffstat:
измењених датотека: 2, додавања: 17(+), брисања: 2(-)
diff --git a/TODO b/TODO
@@ -1,11 +1,14 @@
TODO
====
-[ ] Bugfix: closing the editor after the insert command (effectively cancelling
+[/] Bugfix: closing the editor after the insert command (effectively cancelling
it) should not insert an empty row
+ - Is this a bug at all? This looks more like a matter of policy. For
+ example, how would one otherwise add an empty row on purpose?
-[ ] Bugfix: changing the number of columns by editing header row should update
+[/] Bugfix: changing the number of columns by editing header row should update
the variable
+ - This was fixed? Added the recalculation of maxcols anyway
< > Command to insert/delete a column?
diff --git a/ste.in b/ste.in
@@ -385,6 +385,10 @@ directly from stdin"
currow=0
fi
fi
+ if [ "$currow" -eq 0 ]; then
+ maxcols=$(sed 1q "$file" | tr -dc '\t' | wc -c |
+ awk '{print $1+1}')
+ fi
redraw=1
;;
edit|e) if [ "$editfilter" ]; then
@@ -395,6 +399,10 @@ directly from stdin"
${selprog} "$file" "$((currow + 1))"
cat | ${editprog} "$file" "$((currow + 1))"
fi
+ if [ "$currow" -eq 0 ]; then
+ maxcols=$(sed 1q "$file" | tr -dc '\t' | wc -c |
+ awk '{print $1+1}')
+ fi
redraw=1
;;
exit|q) running=0
@@ -428,6 +436,10 @@ directly from stdin"
${selprog} "$file" "$((maxrows + 1))"
cat | ${insprog} "$file" "$((currow))"
fi
+ if [ "$currow" -eq 0 ]; then
+ maxcols=$(sed 1q "$file" | tr -dc '\t' |
+ wc -c | awk '{print $1+1}')
+ fi
redraw=1;;
+) if [ "$editfilter" ]; then
${selprog} "$file" "$((maxrows + 1))" |