From owner-freebsd-current Tue Jun 4 09:51:23 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id JAA24967 for current-outgoing; Tue, 4 Jun 1996 09:51:23 -0700 (PDT) Received: from vector.jhs.no_domain (slip139-92-42-178.ut.nl.ibm.net [139.92.42.178]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id JAA24292; Tue, 4 Jun 1996 09:49:36 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by vector.jhs.no_domain (8.7.5/8.6.9) with SMTP id AAA00980; Tue, 4 Jun 1996 00:59:30 +0200 (MET DST) Message-Id: <199606032259.AAA00980@vector.jhs.no_domain> X-Authentication-Warning: vector.jhs.no_domain: Host localhost [127.0.0.1] didn't use HELO protocol To: current@freebsd.org Cc: terry@lambert.org, bostic@cs.berkeley.edu Subject: Re: editors From: "Julian H. Stacey" Reply-To: "Julian H. Stacey" Organization: Vector Systems Ltd. Address: Holz Strasse 27d, 80469 Munich, Germany Phone: +49.89.268616 Fax: +49.89.2608126 (later) Web: http://www.freebsd.org/~jhs/ Mailer: EXMH version 1.6.5 95 12 11, PGP available In-reply-to: Your message of "Wed, 29 May 1996 22:57:37 +0200." <199605292057.WAA02017@vector.jhs.no_domain> Date: Tue, 04 Jun 1996 00:59:29 +0200 Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk To current@freebsd.org, Cc Terry Lambert, Keith Bostic Reference my: > From: "Julian H. Stacey" > > From: Terry Lambert > > > It would be dead easy to hack the status mode word on the bottom line > > > that you get with showmode: > > > `Command' --> `Youre in Command mode Type :help if stuck' > > > `Insert' --> `Youre in Insert mode Type if stuck' > > > Showmode would be preset on, from .exrc, of course. > > Uh, you mean: > > `Insert' --> `Youre in Insert mode Hit if stuck' Ah, Yes :-) Here are patches to implement a terser version of above on FreeBSD-current/usr.bin/vi, ( to stop vi newbies getting stranded ). I've tested (& installed here) with set showmode ruler showdirty. If someone would try them, & they're considered OK, maybe they're acceptable for inclusion in src/ ? --------- *** old/src/usr.bin/vi/common/screen.h Wed Aug 17 01:36:43 1994 --- new/src/usr.bin/vi/common/screen.h Sat Jun 1 16:15:40 1996 *************** *** 166,172 **** CHAR_T cname[MAX_CHARACTER_COLUMNS + 1]; size_t clen; /* Length of display character. */ ! #define MAX_MODE_NAME 12 char *showmode; /* Mode. */ void *ex_private; /* Ex private area. */ --- 166,177 ---- CHAR_T cname[MAX_CHARACTER_COLUMNS + 1]; size_t clen; /* Length of display character. */ ! /* #define MAX_MODE_NAME 12 */ ! /* Extend MAX_MODE_NAME for size of new strings like ! vi/v_text.c: "Insert until " 22 chars ! vi/vi.c: "Command :help if stuck" 25 chars ! */ ! #define MAX_MODE_NAME 27 char *showmode; /* Mode. */ void *ex_private; /* Ex private area. */ *** old/src/usr.bin/vi/vi/v_text.c Thu Aug 18 03:15:20 1994 --- new/src/usr.bin/vi/vi/v_text.c Sat Jun 1 11:34:46 1996 *************** *** 56,61 **** --- 56,66 ---- #include "vi.h" #include "vcmd.h" + static char insert_msg[] = "Insert until " ; + static char append_msg[] = "Append until " ; + static char change_msg[] = "Change until " ; + static char replace_msg[] = "Replace until " ; + /* * !!! * Repeated input in the historic vi is mostly wrong and this isn't very *************** *** 111,117 **** int first; char *p; ! sp->showmode = "Append"; flags = set_txt_std(sp, vp, TXT_APPENDEOL); for (first = 1, lno = vp->m_start.lno, cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { --- 116,122 ---- int first; char *p; ! sp->showmode = append_msg; flags = set_txt_std(sp, vp, TXT_APPENDEOL); for (first = 1, lno = vp->m_start.lno, cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { *************** *** 164,170 **** size_t len; char *p; ! sp->showmode = "Append"; flags = set_txt_std(sp, vp, 0); for (lno = vp->m_start.lno, cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { --- 169,175 ---- size_t len; char *p; ! sp->showmode = append_msg; flags = set_txt_std(sp, vp, 0); for (lno = vp->m_start.lno, cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { *************** *** 219,225 **** int first; char *p; ! sp->showmode = "Insert"; flags = set_txt_std(sp, vp, 0); for (first = 1, lno = vp->m_start.lno, cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { --- 224,230 ---- int first; char *p; ! sp->showmode = insert_msg; flags = set_txt_std(sp, vp, 0); for (first = 1, lno = vp->m_start.lno, cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { *************** *** 274,280 **** u_int flags; char *p; ! sp->showmode = "Insert"; flags = set_txt_std(sp, vp, 0); for (lno = vp->m_start.lno, cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { --- 279,285 ---- u_int flags; char *p; ! sp->showmode = insert_msg; flags = set_txt_std(sp, vp, 0); for (lno = vp->m_start.lno, cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { *************** *** 325,331 **** int first; char *p; ! sp->showmode = "Insert"; flags = set_txt_std(sp, vp, TXT_APPENDEOL); for (first = 1, cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { if (sp->lno == 1) { --- 330,336 ---- int first; char *p; ! sp->showmode = insert_msg; flags = set_txt_std(sp, vp, TXT_APPENDEOL); for (first = 1, cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { if (sp->lno == 1) { *************** *** 380,386 **** int first; char *p; ! sp->showmode = "Insert"; flags = set_txt_std(sp, vp, TXT_APPENDEOL); for (first = 1, cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { --- 385,391 ---- int first; char *p; ! sp->showmode = insert_msg; flags = set_txt_std(sp, vp, TXT_APPENDEOL); for (first = 1, cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { *************** *** 483,489 **** char *p; u_int flags; ! sp->showmode = "Change"; flags = set_txt_std(sp, vp, iflags); /* --- 488,494 ---- char *p; u_int flags; ! sp->showmode = change_msg; flags = set_txt_std(sp, vp, iflags); /* *************** *** 588,594 **** int lmode, rval; char *bp, *p; ! sp->showmode = "Change"; flags = set_txt_std(sp, vp, 0); /* --- 593,599 ---- int lmode, rval; char *bp, *p; ! sp->showmode = change_msg; flags = set_txt_std(sp, vp, 0); /* *************** *** 740,746 **** u_int flags; char *p; ! sp->showmode = "Replace"; flags = set_txt_std(sp, vp, 0); cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; --- 745,751 ---- u_int flags; char *p; ! sp->showmode = replace_msg; flags = set_txt_std(sp, vp, 0); cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; *************** *** 816,822 **** u_int flags; char *p; ! sp->showmode = "Change"; flags = set_txt_std(sp, vp, 0); if ((p = file_gline(sp, ep, vp->m_start.lno, &len)) == NULL) { if (file_lline(sp, ep, &lno)) --- 821,827 ---- u_int flags; char *p; ! sp->showmode = change_msg; flags = set_txt_std(sp, vp, 0); if ((p = file_gline(sp, ep, vp->m_start.lno, &len)) == NULL) { if (file_lline(sp, ep, &lno)) *** old/src/usr.bin/vi/vi/vi.c Thu Aug 18 03:15:30 1994 --- new/src/usr.bin/vi/vi/vi.c Sat Jun 1 15:22:53 1996 *************** *** 96,102 **** for (eval = 0, vp = &cmd;;) { /* Refresh the screen. */ ! sp->showmode = "Command"; if (sp->s_refresh(sp, ep)) { eval = 1; break; --- 96,103 ---- for (eval = 0, vp = &cmd;;) { /* Refresh the screen. */ ! sp->showmode = ! "Command mode. Type `:help' if stuck"; if (sp->s_refresh(sp, ep)) { eval = 1; break; --------- Julian -- Julian H. Stacey jhs@freebsd.org http://www.freebsd.org/~jhs/