summaryrefslogtreecommitdiff
path: root/Src/Zle/zle_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/zle_misc.c')
-rw-r--r--Src/Zle/zle_misc.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 8379b2333..a6f7e803b 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -801,10 +801,20 @@ copyprevword(UNUSED(char **args))
for (;;) {
t1 = t0;
- while (t0 && !ZC_iword(zleline[t0-1]))
- t0--;
- while (t0 && ZC_iword(zleline[t0-1]))
- t0--;
+ while (t0) {
+ int prev = t0;
+ DECPOS(prev);
+ if (ZC_iword(zleline[prev]))
+ break;
+ t0 = prev;
+ }
+ while (t0) {
+ int prev = t0;
+ DECPOS(prev);
+ if (!ZC_iword(zleline[prev]))
+ break;
+ t0 = prev;
+ }
if (!--count)
break;