Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Fix transpose-words on 1-char word



Invoking transposewords on a 1-char word lead to previous words to be
swapped, i.e. foo and bar instead of bar and x:
        # foo bar x<transpose-words>
        # bar foo x

Commit 72bd9ee6 "24825: fix internal word-boundary widgets" rewrote
that part but changed a test:
        if (!x || zleline[x - 1] == ZWC('\n'))
            return 1;
into a test plus an assignment:
        if (!x)
            return 1;
        pos = x;
        DECPOS(pos);
        if (zleline[pos] == ZWC('\n'))
            return 1;
        x = pos;
---
 Src/Zle/zle_word.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Src/Zle/zle_word.c b/Src/Zle/zle_word.c
index 301b18d..cb5e5db 100644
--- a/Src/Zle/zle_word.c
+++ b/Src/Zle/zle_word.c
@@ -690,7 +690,6 @@ transposewords(UNUSED(char **args))
 	    DECPOS(pos);
 	    if (zleline[pos] == ZWC('\n'))
 		return 1;
-	    x = pos;
 	}
 	for (p4 = x; p4 != zlell && ZC_iword(zleline[p4]); INCPOS(p4))
 	    ;
-- 
2.1.3



Messages sorted by: Reverse Date, Date, Thread, Author