Subject: PATCH: fix vi visual range including blank final line
From: Oliver Kiddle <[email-masked]>
To: Zsh workers <[email-masked]>
Date: Wed, 13 Apr 2016 23:04:53 +0200
List-Id: Zsh Workers List <zsh-workers.zsh.org>

With a visual selection that has the cursor on the last line of the
buffer and where that line is empty, a yank would include the final null
character. This fixes it.

Oliver

diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c
index 86840bd..953af24 100644
--- a/Src/Zle/zle_vi.c
+++ b/Src/Zle/zle_vi.c
@@ -255,7 +255,7 @@ getvirange(int wf)
     }
 
     /* visual selection mode needs to include additional position */
-    if (visual == 1 && invicmdmode())
+    if (visual == 1 && pos < zlell && invicmdmode())
 	INCPOS(pos);
 
     /* Was it a line-oriented move?  If so, the command will have set *