Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: fix vi visual range including blank final line
- X-seq: zsh-workers 38287
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: fix vi visual range including blank final line
- Date: Wed, 13 Apr 2016 23:04:53 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1460581494; bh=iZKzEyY5XVPfieCu3uljSf1JbkVMmNf+MmZtNGbbCq8=; h=From:To:Subject:Date:From:Subject; b=pqRUrlpcJo5tHUvjoTKc60FawbNm2ZupkvBvKCLJNCkfZI3Q+AU//kIoRf+vWHoRw41BOs1Q9QaTfN/Om717ELl8vFzHkwCSrcb6T+5jeginONi2Vbpq2MwM9IX38DYmPLnX5ICvrstW78Ttr9s/Z7l6kT0Q+KLXFzhpHZ8lKDD8L0wR+ZxkJ5YQ1wKa0zp6O9GX32OtA56PIx08OicxVu6fCZAd8DkPQhpauHCQPHiAPUgXEC64cbk5K2YpL0wSJ3815L9xJJl70J11+dh3i1S0aQd+NNMXXsU/r8O/0SmnstZwa7c73+6PugKxoH1YN6m4xXRgH7ZC+w67LGZAiA==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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 *
Messages sorted by:
Reverse Date,
Date,
Thread,
Author