diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2020-10-20 03:42:14 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2020-10-20 03:44:15 +0200 |
commit | 6f40b8db3a4e413cfd0462e38ec1476bb6c0bffe (patch) | |
tree | 6cd9423fb22fd85d62915335248699a79c1e1739 /README.adoc | |
parent | 63e7895905a1cc31c5b6881b4738cd04217adbc1 (diff) | |
download | sdn-6f40b8db3a4e413cfd0462e38ec1476bb6c0bffe.tar.gz sdn-6f40b8db3a4e413cfd0462e38ec1476bb6c0bffe.tar.xz sdn-6f40b8db3a4e413cfd0462e38ec1476bb6c0bffe.zip |
Fix ext-helpers with older bash versions
See Midnight Commander commit 436296f, blindly trusting it.
wc(1) could be used unconditionally but let's make it clear.
Diffstat (limited to 'README.adoc')
-rw-r--r-- | README.adoc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/README.adoc b/README.adoc index de865de..780ff60 100644 --- a/README.adoc +++ b/README.adoc @@ -100,11 +100,17 @@ there's no way to invoke `prompt_again()` from a `bind -x` handler but we can work around it by submitting a blank line: ---- +sdn-cursor () { + if [[ $BASH_VERSINFO -lt 5 ]] + then echo -n "$SDN_L" | wc -m + else echo "$SDN_P" + fi +} sdn-navigate () { SDN_L=$READLINE_LINE SDN_P=$READLINE_POINT READLINE_LINE= - while eval "`sdn "$SDN_L" "$SDN_P"`"; do + while eval "`sdn "$SDN_L" "$(sdn-cursor)"`"; do [[ -z "$cd" ]] || cd "$cd" [[ -z "$insert" ]] || { SDN_L="${SDN_L:0:$SDN_P}$insert ${SDN_L:$SDN_P}" |