| 1 |
From f3d52a35f78379faf5dfdbed88d225d92d479dfc Mon Sep 17 00:00:00 2001 |
| 2 |
From: Koichi Murase <[email protected]> |
| 3 |
Date: Fri, 8 Dec 2023 20:51:49 +0900 |
| 4 |
Subject: [PATCH] later/pattern: work around "nocasematch" |
| 5 |
|
| 6 |
--- |
| 7 |
integration/bash-preexec.bash | 4 ++++ |
| 8 |
layer/pattern.bash | 14 +++++++------- |
| 9 |
2 files changed, 11 insertions(+), 7 deletions(-) |
| 10 |
|
| 11 |
diff --git a/integration/bash-preexec.bash b/integration/bash-preexec.bash |
| 12 |
index 366cada..6d47be6 100644 |
| 13 |
--- a/integration/bash-preexec.bash |
| 14 |
+++ b/integration/bash-preexec.bash |
| 15 |
@@ -98,6 +98,10 @@ function ble/contrib/integration:bash-preexec/attach.hook { |
| 16 |
|
| 17 |
# Remove __bp_install hook from PROMPT_COMMAND |
| 18 |
if [[ ${PROMPT_COMMAND-} == *"$__bp_install_string"* ]]; then |
| 19 |
+ # Note: Although `shopt -s nocasematch' might affect removing the |
| 20 |
+ # BP_INSTALL_STRING, it is unlikely to match an unrelated string even |
| 21 |
+ # when `nocasematch' is set. We here do not try to adjust `nocasematch'. |
| 22 |
+ # The same applies to the BP_PROMPT_COMMAND_{PREFIX,SUFFIX}. |
| 23 |
PROMPT_COMMAND="${PROMPT_COMMAND//$BP_INSTALL_STRING[;$'\n']}" # Edge case of appending to PROMPT_COMMAND |
| 24 |
PROMPT_COMMAND="${PROMPT_COMMAND//$BP_INSTALL_STRING}" |
| 25 |
fi |
| 26 |
diff --git a/layer/pattern.bash b/layer/pattern.bash |
| 27 |
index 8486566..b74244c 100644 |
| 28 |
--- a/layer/pattern.bash |
| 29 |
+++ b/layer/pattern.bash |
| 30 |
@@ -71,16 +71,16 @@ function ble/highlight/layer:{pattern}/declare { |
| 31 |
|
| 32 |
# define functions |
| 33 |
local _ble_local_script=' |
| 34 |
- function ble/highlight/layer:LAYER/initialize-vars { |
| 35 |
- ble/highlight/layer:{pattern}/initialize-vars LAYER |
| 36 |
+ function ble/highlight/layer:NAME/initialize-vars { |
| 37 |
+ ble/highlight/layer:{pattern}/initialize-vars NAME |
| 38 |
} |
| 39 |
- function ble/highlight/layer:LAYER/update { |
| 40 |
- ble/highlight/layer:{pattern}/update LAYER "$@" |
| 41 |
+ function ble/highlight/layer:NAME/update { |
| 42 |
+ ble/highlight/layer:{pattern}/update NAME "$@" |
| 43 |
} |
| 44 |
- function ble/highlight/layer:LAYER/getg { |
| 45 |
- ble/highlight/layer:{pattern}/getg LAYER "$@" |
| 46 |
+ function ble/highlight/layer:NAME/getg { |
| 47 |
+ ble/highlight/layer:{pattern}/getg NAME "$@" |
| 48 |
}' |
| 49 |
- builtin eval -- "${_ble_local_script//LAYER/$layer_name}" |
| 50 |
+ builtin eval -- "${_ble_local_script//NAME/$layer_name}" |
| 51 |
} |
| 52 |
|
| 53 |
function ble/highlight/layer:{pattern}/initialize-vars { |
| 54 |
-- |
| 55 |
2.41.0 |
| 56 |
|