Date: Tue, 04 Jun 1996 00:59:29 +0200 From: "Julian H. Stacey" <jhs@freebsd.org> To: current@freebsd.org Cc: terry@lambert.org, bostic@cs.berkeley.edu Subject: Re: editors Message-ID: <199606032259.AAA00980@vector.jhs.no_domain> In-Reply-To: Your message of "Wed, 29 May 1996 22:57:37 %2B0200." <199605292057.WAA02017@vector.jhs.no_domain>
next in thread | previous in thread | raw e-mail | index | archive | help
To current@freebsd.org,
Cc Terry Lambert, Keith Bostic
Reference my:
> From: "Julian H. Stacey" <jhs@FreeBSD.org>
> > From: Terry Lambert <terry@lambert.org>
> > > 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 <escape> if stuck'
> > > Showmode would be preset on, from .exrc, of course.
> > Uh, you mean:
> > `Insert' --> `Youre in Insert mode Hit <escape> 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 <Escape>" 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 <Escape>" ;
+ static char append_msg[] = "Append until <Escape>" ;
+ static char change_msg[] = "Change until <Escape>" ;
+ static char replace_msg[] = "Replace until <Escape>" ;
+
/*
* !!!
* 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/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606032259.AAA00980>
