From d3e4af1f0a33849b36196b035fddf64037e0c282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Mon, 5 Feb 2024 22:56:40 +0100 Subject: [PATCH] Replace use of tr(1) with awk(1). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Supersedes: https://lists.sr.ht/~martanne/devel/patches/49113 Supersedes: https://lists.sr.ht/~martanne/devel/patches/49114 --- config.def.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index 8b3cb97b7..54be734af 100644 --- 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:]'") }, - { "gu", ALIAS(":|tr '[:upper:]' '[:lower:]'")}, - { "gU", ALIAS(":|tr '[:lower:]' '[:upper:]'")}, + { "gu", ALIAS(":|awk '{printf \"%s\", tolower($0)}'")}, + { "gU", ALIAS(":|awk '{printf \"%s\", toupper($0)}'")}, { "p", ACTION(PUT_AFTER) }, { "P", ACTION(PUT_BEFORE) }, { "y", ACTION(OPERATOR_YANK) },