From d76bd709d0be62c0ee3122a9d732bade3d879843 Mon Sep 17 00:00:00 2001 From: Seth Underwood Date: Fri, 6 Jan 2023 21:32:27 -0500 Subject: [PATCH 1/2] lib/shopt: Allow CASE_SENSITIVE and HYPHEN_INSENSITIVE to work as documented Adjusted shopt.sh to use CASE_SENSITIVE and HYPHEN_INSENSITIVE variables to affect completion. Note: this changes the old default hyphen insensitive completion behavior. The user will need to set HYPHEN_INSENSITIVE="true" to have the old default behavior. --- lib/shopt.sh | 9 ++++++--- templates/bashrc.osh-template | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/shopt.sh b/lib/shopt.sh index 9e5f887..8fce108 100644 --- a/lib/shopt.sh +++ b/lib/shopt.sh @@ -43,10 +43,13 @@ if [[ ${OMB_CASE_SENSITIVE:-${CASE_SENSITIVE:-}} == true ]]; then else # By default, case sensitivity is disabled. bind "set completion-ignore-case on" -fi -# Treat hyphens and underscores as equivalent -bind "set completion-map-case on" + # Treat hyphens and underscores as equivalent + # CASE_SENSITIVE must be off + if [[ ${OMB_HYPHEN_INSENSITIVE:-${HYPHEN_INSENSITIVE:-false}} == true ]]; then + bind "set completion-map-case on" + fi +fi # Display matches for ambiguous patterns at first tab press bind "set show-all-if-ambiguous on" diff --git a/templates/bashrc.osh-template b/templates/bashrc.osh-template index 82be0d1..9f7c2e9 100644 --- a/templates/bashrc.osh-template +++ b/templates/bashrc.osh-template @@ -16,7 +16,7 @@ OSH_THEME="font" # Uncomment the following line to use hyphen-insensitive completion. Case # sensitive completion must be off. _ and - will be interchangeable. -# HYPHEN_INSENSITIVE="true" +# OMB_HYPHEN_INSENSITIVE="true" # Uncomment the following line to disable bi-weekly auto-update checks. # DISABLE_AUTO_UPDATE="true" From aed5238cadf7fe432e98a2f399b5be2a862bee4f Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Thu, 16 Feb 2023 10:48:45 +0900 Subject: [PATCH 2/2] lib/shopt: Revert the meaning "OMB_HYPHEN_{IN => }SENSITIVE" --- lib/shopt.sh | 8 +++++++- templates/bashrc.osh-template | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/shopt.sh b/lib/shopt.sh index 8fce108..f3db853 100644 --- a/lib/shopt.sh +++ b/lib/shopt.sh @@ -46,7 +46,13 @@ else # Treat hyphens and underscores as equivalent # CASE_SENSITIVE must be off - if [[ ${OMB_HYPHEN_INSENSITIVE:-${HYPHEN_INSENSITIVE:-false}} == true ]]; then + if [[ ! ${OMB_HYPHEN_SENSITIVE-} && ${HYPHEN_INSENSITIVE} ]]; then + case $HYPHEN_INSENSITIVE in + (true) OMB_HYPHEN_SENSITIVE=true ;; + (false) OMB_HYPHEN_SENSITIVE=false ;; + esac + fi + if [[ ${OMB_HYPHEN_SENSITIVE-} == false ]]; then bind "set completion-map-case on" fi fi diff --git a/templates/bashrc.osh-template b/templates/bashrc.osh-template index 9f7c2e9..591a05c 100644 --- a/templates/bashrc.osh-template +++ b/templates/bashrc.osh-template @@ -16,7 +16,7 @@ OSH_THEME="font" # Uncomment the following line to use hyphen-insensitive completion. Case # sensitive completion must be off. _ and - will be interchangeable. -# OMB_HYPHEN_INSENSITIVE="true" +# OMB_HYPHEN_SENSITIVE="false" # Uncomment the following line to disable bi-weekly auto-update checks. # DISABLE_AUTO_UPDATE="true"