diff options
Diffstat (limited to 'usr.bin/vi')
-rw-r--r-- | usr.bin/vi/common/api.c | 4 | ||||
-rw-r--r-- | usr.bin/vi/common/search.c | 28 | ||||
-rw-r--r-- | usr.bin/vi/ex/ex.c | 3 |
3 files changed, 23 insertions, 12 deletions
diff --git a/usr.bin/vi/common/api.c b/usr.bin/vi/common/api.c index cef2dd94057..bf90d1c717e 100644 --- a/usr.bin/vi/common/api.c +++ b/usr.bin/vi/common/api.c @@ -398,7 +398,7 @@ api_opts_get(sp, name, value) switch (op->type) { case OPT_0BOOL: case OPT_1BOOL: - MALLOC_RET(sp, *value, char *, strlen(op->name) + 2); + MALLOC_RET(sp, *value, char *, strlen(op->name) + 2 + 1); (void)sprintf(*value, "%s%s", O_ISSET(sp, offset) ? "" : "no", op->name); break; @@ -412,7 +412,7 @@ api_opts_get(sp, name, value) value[0] = '\0'; } else { MALLOC_RET(sp, - *value, char *, strlen(O_STR(sp, offset))); + *value, char *, strlen(O_STR(sp, offset)) + 1); (void)sprintf(*value, "%s", O_STR(sp, offset)); } break; diff --git a/usr.bin/vi/common/search.c b/usr.bin/vi/common/search.c index fbbaf76ab97..5823f250ff4 100644 --- a/usr.bin/vi/common/search.c +++ b/usr.bin/vi/common/search.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "@(#)search.c 10.23 (Berkeley) 5/15/96"; +static const char sccsid[] = "@(#)search.c 10.24 (Berkeley) 5/26/96"; #endif /* not lint */ #include <sys/types.h> @@ -248,20 +248,29 @@ f_search(sp, fm, rm, ptrn, eptrn, flags) /* * XXX * Warn if the search wrapped. This message is only displayed - * if there are no keys in the queue. The problem is that the - * command is going to succeed, and the message isn't an error, - * it's informational in nature. If a macro causes it to be - * output repeatedly, e.g., the pattern only occurs once in the - * file and wrapscan is set, you can lose, particularly if the - * macro does something like: + * if we're in interactive mode and there are no keys in the + * queue. The problem is that the command is going to succeed, + * and the message isn't an error, it's merely informational. + * So, if we're reading the .exrc file, displaying it causes + * the screen to pause before entering the file, which is bad. + * Or, if a macro causes it to be repeatedly displayed, e.g., + * the pattern only occurs once in the file and wrapscan is set, + * you lose, particularly if the macro does something like: * :map K /pattern/^MjK * Each new search will display the message and the /pattern/ * will immediately overwrite it, with strange results. The * System V vi displays the "wrapped" message multiple times, * but it's overwritten each time, so it's not as noticeable. * Since we don't discard messages, it's a real problem. + * + * XXX + * The test for SC_SCR_EX or SC_SCR_VI feels wrong to me. I + * didn't originally intend for that bit to reflect that the + * user has "gone interactive", but that's the only solution + * I see. */ - if (wrapped && LF_ISSET(SEARCH_MSG) && !KEYS_WAITING(sp)) + if (wrapped && LF_ISSET(SEARCH_MSG) && + F_ISSET(sp, SC_SCR_EX | SC_SCR_VI) && !KEYS_WAITING(sp)) search_msg(sp, S_WRAP); #if defined(DEBUG) && 0 @@ -403,7 +412,8 @@ b_search(sp, fm, rm, ptrn, eptrn, flags) * XXX * See the comment in f_search() for more information. */ - if (wrapped && LF_ISSET(SEARCH_MSG) && !KEYS_WAITING(sp)) + if (wrapped && LF_ISSET(SEARCH_MSG) && + F_ISSET(sp, SC_SCR_EX | SC_SCR_VI) && !KEYS_WAITING(sp)) search_msg(sp, S_WRAP); #if defined(DEBUG) && 0 diff --git a/usr.bin/vi/ex/ex.c b/usr.bin/vi/ex/ex.c index 001fada80a8..3f2af66b5c4 100644 --- a/usr.bin/vi/ex/ex.c +++ b/usr.bin/vi/ex/ex.c @@ -91,8 +91,9 @@ ex(spp) for (;; ++gp->excmd.if_lno) { /* Display status line and flush. */ if (F_ISSET(sp, SC_STATUS)) { + if (!F_ISSET(sp, SC_EX_SILENT)) + msgq_status(sp, sp->lno, 0); F_CLR(sp, SC_STATUS); - msgq_status(sp, sp->lno, 0); } (void)ex_fflush(sp); |