Last active
December 29, 2015 09:49
-
-
Save guns/7652536 to your computer and use it in GitHub Desktop.
gherkin readline() patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gherkin b/gherkin | |
index 2567adf..aeb97e6 100755 | |
--- a/gherkin | |
+++ b/gherkin | |
@@ -37,15 +37,12 @@ pb_get="^$" | |
pb_unget="^$" | |
readline() { | |
- IFS=$'\n\b' | |
+ local IFS=$'\n\b' | |
local prompt="> " | |
local line | |
- read -e -p "$prompt" line || exit 0 | |
- for ch in $(echo "^${line}" | grep -o . | tail -n +2 | tr "*" "$pb_star"); do | |
- pb_get="${pb_get:0:$((${#pb_get}-1))}${ch}$" | |
- done | |
- pb_get="${pb_get:0:$((${#pb_get}-1))}${pb_newline}$" | |
- IFS="$DEFAULT_IFS" | |
+ read -e -r -p "$prompt" line || exit 0 | |
+ pb_get="${pb_get:0:$((${#pb_get}-1))}${line}${pb_newline}$" | |
+ unset IFS | |
if [[ "$line" =~ ^[[:space:]]*- ]]; then | |
echo "warning: lines starting with - aren't stored in history" >&2 | |
else |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment