This was for nvi 1.34 & has not yet been upgraded to newer nvi version This patch makes :showmode better for newbies. There might be a bug in this that causes: Malloc warning: free(): already free page. *** old/src/contrib/nvi/common/screen.h Wed Aug 17 01:36:43 1994 --- new/src/contrib/nvi/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/contrib/nvi/vi/v_text.c Thu Aug 18 03:15:20 1994 --- new/src/contrib/nvi/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/contrib/nvi/vi/vi.c Thu Aug 18 03:15:30 1994 --- new/src/contrib/nvi/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;