From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4573 invoked from network); 11 Jan 1997 22:07:35 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 11 Jan 1997 22:07:35 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id RAA04995; Sat, 11 Jan 1997 17:12:42 -0500 (EST) Resent-Date: Sat, 11 Jan 1997 17:12:42 -0500 (EST) From: Zefram Message-Id: <23682.199701112214@stone.dcs.warwick.ac.uk> Subject: lastcol To: zsh-workers@math.gatech.edu (Z Shell workers mailing list) Date: Sat, 11 Jan 1997 22:14:01 +0000 (GMT) X-Patch: 193 X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]8714.63 X-US-Congress: Moronic fuckers Content-Type: text Resent-Message-ID: <"ZeplO2.0.-D1.Q11so"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2780 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----BEGIN PGP SIGNED MESSAGE----- This patch makes lastcol maintenance not depend on lastcmd, and makes it work with vi-end-of-line correctly. -zefram *** Src/Zle/zle.h 1997/01/11 17:59:10 1.15 --- Src/Zle/zle.h 1997/01/11 19:04:59 *************** *** 59,64 **** --- 59,65 ---- #define ZLE_MENUCMP (1<<1) /* DON'T invalidate completion list */ #define ZLE_YANK (1<<3) #define ZLE_LINEMOVE (1<<4) /* command is a line-oriented movement */ + #define ZLE_LASTCOL (1<<5) /* command maintains lastcol correctly */ #define ZLE_KILL (1<<6) #define ZLE_KEEPSUFFIX (1<<9) /* DON'T remove added suffix */ *************** *** 105,111 **** /* flags associated with last command */ ZLEXTERN int lastcmd; ! /* column position before last LINEMOVE movement */ ZLEXTERN int lastcol; /* != 0 if we're getting a vi range */ --- 106,113 ---- /* flags associated with last command */ ZLEXTERN int lastcmd; ! /* Column position of vi ideal cursor. -1 if it is unknown -- most * ! * movements and changes do this. */ ZLEXTERN int lastcol; /* != 0 if we're getting a vi range */ *** Src/Zle/zle_bindings.c 1997/01/11 17:59:10 1.8 --- Src/Zle/zle_bindings.c 1997/01/11 19:12:46 *************** *** 60,78 **** C("beginning-of-line", beginningofline, 0) C("beginning-of-line-hist", beginningoflinehist, 0) C("capitalize-word", capitalizeword, 0) ! C("clear-screen", clearscreen, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("complete-word", completeword, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("copy-prev-word", copyprevword, 0) C("copy-region-as-kill", copyregionaskill, ZLE_KEEPSUFFIX) C("delete-char", deletechar, ZLE_KEEPSUFFIX) C("delete-char-or-list", deletecharorlist, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("delete-word", deleteword, ZLE_KEEPSUFFIX) ! C("describe-key-briefly", describekeybriefly, ZLE_MENUCMP | ZLE_KEEPSUFFIX) ! C("digit-argument", digitargument, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("down-case-word", downcaseword, 0) C("down-history", downhistory, 0) ! C("down-line-or-history", downlineorhistory, ZLE_LINEMOVE) ! C("down-line-or-search", downlineorsearch, ZLE_LINEMOVE) C("emacs-backward-word", emacsbackwardword, 0) C("emacs-forward-word", emacsforwardword, 0) C("end-of-buffer-or-history", endofbufferorhistory, 0) --- 60,78 ---- C("beginning-of-line", beginningofline, 0) C("beginning-of-line-hist", beginningoflinehist, 0) C("capitalize-word", capitalizeword, 0) ! C("clear-screen", clearscreen, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) C("complete-word", completeword, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("copy-prev-word", copyprevword, 0) C("copy-region-as-kill", copyregionaskill, ZLE_KEEPSUFFIX) C("delete-char", deletechar, ZLE_KEEPSUFFIX) C("delete-char-or-list", deletecharorlist, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("delete-word", deleteword, ZLE_KEEPSUFFIX) ! C("describe-key-briefly", describekeybriefly, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) ! C("digit-argument", digitargument, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) C("down-case-word", downcaseword, 0) C("down-history", downhistory, 0) ! C("down-line-or-history", downlineorhistory, ZLE_LINEMOVE | ZLE_LASTCOL) ! C("down-line-or-search", downlineorsearch, ZLE_LINEMOVE | ZLE_LASTCOL) C("emacs-backward-word", emacsbackwardword, 0) C("emacs-forward-word", emacsforwardword, 0) C("end-of-buffer-or-history", endofbufferorhistory, 0) *************** *** 104,115 **** C("kill-region", killregion, ZLE_KILL) C("kill-whole-line", killwholeline, ZLE_KILL) C("kill-word", killword, ZLE_KILL) ! C("list-choices", listchoices, ZLE_MENUCMP | ZLE_KEEPSUFFIX) ! C("list-expand", listexpand, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("magic-space", magicspace, 0) C("menu-complete", menucomplete, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("menu-expand-or-complete", menuexpandorcomplete, ZLE_MENUCMP | ZLE_KEEPSUFFIX) ! C("neg-argument", negargument, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("overwrite-mode", overwritemode, 0) C("pound-insert", poundinsert, 0) C("push-input", pushinput, 0) --- 104,115 ---- C("kill-region", killregion, ZLE_KILL) C("kill-whole-line", killwholeline, ZLE_KILL) C("kill-word", killword, ZLE_KILL) ! C("list-choices", listchoices, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) ! C("list-expand", listexpand, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) C("magic-space", magicspace, 0) C("menu-complete", menucomplete, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("menu-expand-or-complete", menuexpandorcomplete, ZLE_MENUCMP | ZLE_KEEPSUFFIX) ! C("neg-argument", negargument, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) C("overwrite-mode", overwritemode, 0) C("pound-insert", poundinsert, 0) C("push-input", pushinput, 0) *************** *** 118,141 **** C("quoted-insert", quotedinsert, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("quote-line", quoteline, 0) C("quote-region", quoteregion, 0) ! C("redisplay", redisplay, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("redo", redo, 0) C("reverse-menu-complete", reversemenucomplete, ZLE_MENUCMP | ZLE_KEEPSUFFIX) ! C("run-help", processcmd, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("self-insert", selfinsert, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("self-insert-unmeta", selfinsertunmeta, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("send-break", sendbreak, 0) ! C("set-mark-command", setmarkcommand, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("spell-word", spellword, 0) C("transpose-chars", transposechars, 0) C("transpose-words", transposewords, 0) C("undefined-key", undefinedkey, 0) C("undo", undo, 0) ! C("universal-argument", universalargument, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("up-case-word", upcaseword, 0) C("up-history", uphistory, 0) ! C("up-line-or-history", uplineorhistory, ZLE_LINEMOVE) ! C("up-line-or-search", uplineorsearch, ZLE_LINEMOVE) C("vi-add-eol", viaddeol, 0) C("vi-add-next", viaddnext, 0) C("vi-backward-blank-word", vibackwardblankword, 0) --- 118,141 ---- C("quoted-insert", quotedinsert, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("quote-line", quoteline, 0) C("quote-region", quoteregion, 0) ! C("redisplay", redisplay, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) C("redo", redo, 0) C("reverse-menu-complete", reversemenucomplete, ZLE_MENUCMP | ZLE_KEEPSUFFIX) ! C("run-help", processcmd, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) C("self-insert", selfinsert, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("self-insert-unmeta", selfinsertunmeta, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("send-break", sendbreak, 0) ! C("set-mark-command", setmarkcommand, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) C("spell-word", spellword, 0) C("transpose-chars", transposechars, 0) C("transpose-words", transposewords, 0) C("undefined-key", undefinedkey, 0) C("undo", undo, 0) ! C("universal-argument", universalargument, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) C("up-case-word", upcaseword, 0) C("up-history", uphistory, 0) ! C("up-line-or-history", uplineorhistory, ZLE_LINEMOVE | ZLE_LASTCOL) ! C("up-line-or-search", uplineorsearch, ZLE_LINEMOVE | ZLE_LASTCOL) C("vi-add-eol", viaddeol, 0) C("vi-add-next", viaddnext, 0) C("vi-backward-blank-word", vibackwardblankword, 0) *************** *** 153,159 **** C("vi-delete-char", videletechar, ZLE_KEEPSUFFIX) C("vi-digit-or-beginning-of-line", vidigitorbeginningofline, 0) C("vi-down-line-or-history", vidownlineorhistory, ZLE_LINEMOVE) ! C("vi-end-of-line", viendofline, 0) C("vi-fetch-history", vifetchhistory, 0) C("vi-find-next-char", vifindnextchar, 0) C("vi-find-next-char-skip", vifindnextcharskip, 0) --- 153,159 ---- C("vi-delete-char", videletechar, ZLE_KEEPSUFFIX) C("vi-digit-or-beginning-of-line", vidigitorbeginningofline, 0) C("vi-down-line-or-history", vidownlineorhistory, ZLE_LINEMOVE) ! C("vi-end-of-line", viendofline, ZLE_LASTCOL) C("vi-fetch-history", vifetchhistory, 0) C("vi-find-next-char", vifindnextchar, 0) C("vi-find-next-char-skip", vifindnextcharskip, 0) *************** *** 191,198 **** C("vi-replace-chars", vireplacechars, 0) C("vi-rev-repeat-find", virevrepeatfind, 0) C("vi-rev-repeat-search", virevrepeatsearch, 0) ! C("vi-set-buffer", visetbuffer, ZLE_MENUCMP | ZLE_KEEPSUFFIX) ! C("vi-set-mark", visetmark, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("vi-substitute", visubstitute, 0) C("vi-swap-case", viswapcase, 0) C("vi-undo-change", viundochange, 0) --- 191,198 ---- C("vi-replace-chars", vireplacechars, 0) C("vi-rev-repeat-find", virevrepeatfind, 0) C("vi-rev-repeat-search", virevrepeatsearch, 0) ! C("vi-set-buffer", visetbuffer, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) ! C("vi-set-mark", visetmark, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) C("vi-substitute", visubstitute, 0) C("vi-swap-case", viswapcase, 0) C("vi-undo-change", viundochange, 0) *************** *** 201,208 **** C("vi-yank", viyank, 0) C("vi-yank-eol", viyankeol, 0) C("vi-yank-whole-line", viyankwholeline, 0) ! C("where-is", whereis, ZLE_MENUCMP | ZLE_KEEPSUFFIX) ! C("which-command", processcmd, ZLE_MENUCMP | ZLE_KEEPSUFFIX) C("yank", yank, ZLE_YANK) C("yank-pop", yankpop, ZLE_YANK) C(NULL, NULL, 0) --- 201,208 ---- C("vi-yank", viyank, 0) C("vi-yank-eol", viyankeol, 0) C("vi-yank-whole-line", viyankwholeline, 0) ! C("where-is", whereis, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) ! C("which-command", processcmd, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL) C("yank", yank, ZLE_YANK) C("yank-pop", yankpop, ZLE_YANK) C(NULL, NULL, 0) *** Src/Zle/zle_hist.c 1997/01/11 17:59:11 1.10 --- Src/Zle/zle_hist.c 1997/01/11 19:12:25 *************** *** 85,91 **** downlineorhistory(); return; } ! if ((lastcmd & ZLE_LINEMOVE) != ZLE_LINEMOVE) lastcol = cs - findbol(); cs = findbol(); while (zmult) { --- 85,91 ---- downlineorhistory(); return; } ! if (lastcol == -1) lastcol = cs - findbol(); cs = findbol(); while (zmult) { *************** *** 141,147 **** uphistory(); } vifirstnonblank(); - lastcol = cs - findbol(); } --- 141,146 ---- *************** *** 156,162 **** downlineorsearch(); return; } ! if ((lastcmd & ZLE_LINEMOVE) != ZLE_LINEMOVE) lastcol = cs - findbol(); cs = findbol(); while (zmult) { --- 155,161 ---- downlineorsearch(); return; } ! if (lastcol == -1) lastcol = cs - findbol(); cs = findbol(); while (zmult) { *************** *** 195,201 **** uplineorhistory(); return; } ! if ((lastcmd & ZLE_LINEMOVE) != ZLE_LINEMOVE) lastcol = cs - findbol(); while (zmult) { int x = findeol(); --- 194,200 ---- uplineorhistory(); return; } ! if (lastcol == -1) lastcol = cs - findbol(); while (zmult) { int x = findeol(); *************** *** 251,257 **** downhistory(); } vifirstnonblank(); - lastcol = cs - findbol(); } /**/ --- 250,255 ---- *************** *** 265,271 **** uplineorsearch(); return; } ! if ((lastcmd & ZLE_LINEMOVE) != ZLE_LINEMOVE) lastcol = cs - findbol(); while (zmult) { int x = findeol(); --- 263,269 ---- uplineorsearch(); return; } ! if (lastcol == -1) lastcol = cs - findbol(); while (zmult) { int x = findeol(); *** Src/Zle/zle_main.c 1997/01/11 17:59:11 1.18 --- Src/Zle/zle_main.c 1997/01/11 19:11:38 *************** *** 392,397 **** --- 392,398 ---- zleactive = 1; resetneeded = 1; errflag = retflag = 0; + lastcol = -1; initmodifier(&zmod); prefixflag = 0; feepflag = 0; *************** *** 478,483 **** --- 479,486 ---- } if (func->flags & ZLE_LINEMOVE) vilinerange = 1; + if(!(func->flags & ZLE_LASTCOL)) + lastcol = -1; func->ifunc(); } } *** Src/Zle/zle_move.c 1997/01/04 17:47:27 1.4 --- Src/Zle/zle_move.c 1997/01/11 19:13:38 *************** *** 306,311 **** --- 306,312 ---- cs = findeol() + 1; } cs--; + lastcol = 1<<30; } /**/ -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQCVAwUBMtfotXD/+HJTpU/hAQHTygP9FWzdKhvf9pX9h9Cvybwo2GPcGs3VnOH3 JX1giqhSHTB841zM/qQsM0uej7Ef73rCINvr0L8unX49RhNqDwLBQHnD65Ueu7bT jdAXZGzKJvV8J7+39r5BuwJF4wuNTzJA58+uJFI4W1G9UeEMphvNlCG2p3AZCjC6 NyoUpc9+xpU= =U2Ds -----END PGP SIGNATURE-----