Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
vi start of insert is easily broken
- X-seq: zsh-workers 33575
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: vi start of insert is easily broken
- Date: Thu, 30 Oct 2014 18:48:44 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1414691325; bh=rBEs3B78lvTE1pGHXTtqgTGBunTeAOaycRwSUFQpOFU=; h=From:To:Subject:Date:From:Subject; b=jzews/F/BvQOES/dQA03Br6VRo5YDiwqD+QVkjOSKUatmFGjXoIY1Ovg3FEA5i4e/ol5dYDFVH3H28V5lWI/CfkQRT40LebLu2cilHQSkDk5wxOKAyeWFRt6/Hm0xyQ1dsyohdVFG33YgNIxVA4fjGpOky4KJyKItI+aAh2RM/beG8+W0n1G2kOBAMahGI14Pg6tmIm6X6FNrmkpgewYAA1VSMf1RlC1jG+3s7JgmcPRsKfkx6mMLLluOoqFcvijDjkM+v7U9ZyCNo9ulZxClfzxSQazM047M5sJ7vAEs9UJ8LMeH5f3NasdIZSL6fKx/RYo0BPORp43LMQV6mTNRg==
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.co.uk; b=QwveO5+JfVpa2K1BTHTpWlAx0qMsAiWbnn4a6S8rOc1UXztBcGCbqy6Fek7bWFuNGcNzajXNOiIRrAJrJDLNYCp8j8UBAHlaB1PF3MIx6d58344NeQB2CPG8k+iKLaxkRXWAyCfyi06tEQAJKEEBeo2M6kc5V7kmY9lUuyN6zOyJ1/jKnkTvhHV178KNautLu0NjfUH3pI0tO5kuJAA7YrePFMWLnGiYwgy1mCB4OiirawYk9PYCv4KtuxbmamkXeDuZYXobmcj0UbifIA9+7OTqpPROKVrBuotSKPRj9Gxe9eZYp/TFp1GFlhxAo5NJ6hx7Pjzftpo/YfBL6257lw==;
- 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
In vi mode, it isn't hard to insert text in a position before
viinsbegin. This messes up widgets that stop there.
The default bindings for both left and up cursors happily ignore
viinsbegin. Furthermore, being used to vim, I use the emacs backspace
binding instead of the vi one because it doesn't stop at the line or
insert beginning.
Many cases can be fixed in spaceinline(). The question is, should we
just assign 0 to it or increment it by ct as we do for mark? Should I
apply the patch below (or something similar)?
Emacs style history commands from vi mode also preserve viinsbegin.
Assigning 0 to it in setline as below fixes that but might break a
user-defined widget that assigns to BUFFER. It also stays reset if the
history command is undone. Any thoughts on that?
Zsh also preserves mark when moving between history lines. Is that useful?
That would be harder to fix when accounting for user defined widgets.
Oliver
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 46d5373..741f119 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -785,6 +785,8 @@ spaceinline(int ct)
if (mark > zlecs)
mark += ct;
+ if (viinsbegin > zlecs)
+ viinsbegin = 0;
if (region_highlights) {
for (rhp = region_highlights + N_SPECIAL_HIGHLIGHTS;
@@ -1104,6 +1106,7 @@ setline(char *s, int flags)
*/
free(zleline);
+ viinsbegin = 0;
zleline = stringaszleline(scp, 0, &zlell, &linesz, NULL);
if ((flags & ZSL_TOEND) && (zlecs = zlell) && invicmdmode())
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index 5845207..dc5fed4 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -198,7 +198,7 @@ set_buffer(UNUSED(Param pm), char *x)
setline(x, 0);
zsfree(x);
} else
- zlecs = zlell = 0;
+ viinsbegin = zlecs = zlell = 0;
fixsuffix();
menucmp = 0;
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author