f17e0219fdd38d9fabce2d96d0d283d98122733f

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

dotenv: fix prompt newline

Diff

 1diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh
 2index 84815a416b5ca44b54d62f0fc8c1f6c627da5c9a..54036bee383d794e621fd733f622fdcc1a288192 100644
 3--- a/plugins/dotenv/dotenv.plugin.zsh
 4+++ b/plugins/dotenv/dotenv.plugin.zsh
 5@@ -1,11 +1,13 @@
 6 source_env() {
 7   if [[ -f $ZSH_DOTENV_FILE ]]; then
 8-
 9     if [ "$ZSH_DOTENV_PROMPT" != "false" ]; then
10       # confirm before sourcing file
11       local confirmation
12+      # print same-line prompt and output newline character if necessary
13       echo -n "dotenv: source '$ZSH_DOTENV_FILE' file in the directory? (Y/n) "
14-      if read -k 1 confirmation && [[ $confirmation = [nN] ]]; then
15+      read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo
16+      # only bail out if confirmation character is n
17+      if [[ "$confirmation" = [nN] ]]; then
18         return
19       fi
20     fi