vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 77171a744a7046bf94e8bf9edbc0838db6992cc7
parent 8e5bce7fb81d674e37bd01e28b2a916dbca67879
Author: Matěj Cepl <mcepl@cepl.eu>
Date:   Mon,  5 Feb 2024 22:56:40 +0100

Replace use of tr(1) with awk(1).

Unfortunately, GNU tr(1) is not Unicode-aware,
so we should use awk(1) instead. See
https://www.pixelbeat.org/docs/coreutils_i18n/ for more on the
situation of the support of Unicode in coreutils.

Apparently, awk is for this better than sed, because Unicode is
consistenly provided on all major versions of awk.

Signed-off-by: Matěj Cepl <mcepl@cepl.eu>
Supersedes: https://lists.sr.ht/~martanne/devel/patches/49113
Supersedes: https://lists.sr.ht/~martanne/devel/patches/49114

Diffstat:
Mconfig.def.h | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -161,8 +161,8 @@ static const KeyBinding bindings_operators[] = { { "c", ACTION(OPERATOR_CHANGE) }, { "d", ACTION(OPERATOR_DELETE) }, { "g~", ALIAS(":|tr '[:lower:][:upper:]' '[:upper:][:lower:]'<Enter>") }, - { "gu", ALIAS(":|tr '[:upper:]' '[:lower:]'<Enter>")}, - { "gU", ALIAS(":|tr '[:lower:]' '[:upper:]'<Enter>")}, + { "gu", ALIAS(":|awk '{printf \"%s\", tolower($0)}'<Enter>")}, + { "gU", ALIAS(":|awk '{printf \"%s\", toupper($0)}'<Enter>")}, { "p", ACTION(PUT_AFTER) }, { "P", ACTION(PUT_BEFORE) }, { "y", ACTION(OPERATOR_YANK) },