Module Name: src
Committed By: rin
Date: Tue Aug 7 08:05:48 UTC 2018
Modified Files:
src/external/bsd/nvi/dist/cl: cl_funcs.c cl_main.c
src/external/bsd/nvi/dist/common: gs.h options.c options_f.c
src/external/bsd/nvi/dist/docs/vi.man: vi.1
src/external/bsd/nvi/dist/ip: ip_funcs.c ip_main.c
src/external/bsd/nvi/dist/vi: v_replace.c v_txt.c vi.c
src/external/bsd/nvi/usr.bin/nvi: Makefile
Log Message:
Add imctrl and imkey options, inspired by cannactrl and fepkey options in
nvi-m17n by itojun.
If imctrl option is set, input method is controlled by using escape
sequences compatible to Tera Term and RLogin. The state of input method in
commands specified by imkey option is saved and restored automatically.
Input method is then deactivated on returning to command mode.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/nvi/dist/cl/cl_funcs.c
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/nvi/dist/cl/cl_main.c
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/dist/common/gs.h \
src/external/bsd/nvi/dist/common/options_f.c
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/nvi/dist/common/options.c
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/nvi/dist/docs/vi.man/vi.1
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/nvi/dist/ip/ip_funcs.c
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/dist/ip/ip_main.c
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/dist/vi/v_replace.c
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/nvi/dist/vi/v_txt.c
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/nvi/dist/vi/vi.c
cvs rdiff -u -r1.16 -r1.17 src/external/bsd/nvi/usr.bin/nvi/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/nvi/dist/cl/cl_funcs.c
diff -u src/external/bsd/nvi/dist/cl/cl_funcs.c:1.8 src/external/bsd/nvi/dist/cl/cl_funcs.c:1.9
--- src/external/bsd/nvi/dist/cl/cl_funcs.c:1.8 Sun Feb 4 09:15:45 2018
+++ src/external/bsd/nvi/dist/cl/cl_funcs.c Tue Aug 7 08:05:47 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cl_funcs.c,v 1.8 2018/02/04 09:15:45 mrg Exp $ */
+/* $NetBSD: cl_funcs.c,v 1.9 2018/08/07 08:05:47 rin Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -16,7 +16,7 @@
static const char sccsid[] = "Id: cl_funcs.c,v 10.72 2002/03/02 23:18:33 skimo Exp (Berkeley) Date: 2002/03/02 23:18:33 ";
#endif /* not lint */
#else
-__RCSID("$NetBSD: cl_funcs.c,v 1.8 2018/02/04 09:15:45 mrg Exp $");
+__RCSID("$NetBSD: cl_funcs.c,v 1.9 2018/08/07 08:05:47 rin Exp $");
#endif
#include <sys/types.h>
@@ -465,6 +465,41 @@ cl_ex_adjust(SCR *sp, exadj_t action)
return (0);
}
+#ifdef IMCTRL
+/*
+ * cl_imctrl --
+ * Control the state of input method by using escape sequences compatible
+ * to Tera Term and RLogin.
+ *
+ * PUBLIC: void cl_imctrl __P((SCR *, imctrl_t));
+ */
+void
+cl_imctrl(SCR *sp, imctrl_t action)
+{
+#define TT_IM_OFF "\033[<t" /* TTIMEST */
+#define TT_IM_RESTORE "\033[<r" /* TTIMERS */
+#define TT_IM_SAVE "\033[<s" /* TTIMESV */
+
+ if (!O_ISSET(sp, O_IMCTRL) && action != IMCTRL_INIT)
+ return;
+
+ switch (action) {
+ case IMCTRL_INIT:
+ (void)printf(TT_IM_OFF TT_IM_SAVE);
+ break;
+ case IMCTRL_OFF:
+ (void)printf(TT_IM_SAVE TT_IM_OFF);
+ break;
+ case IMCTRL_ON:
+ (void)printf(TT_IM_RESTORE);
+ break;
+ default:
+ abort();
+ }
+ (void)fflush(stdout);
+}
+#endif
+
/*
* cl_insertln --
* Push down the current line, discarding the bottom line.
Index: src/external/bsd/nvi/dist/cl/cl_main.c
diff -u src/external/bsd/nvi/dist/cl/cl_main.c:1.9 src/external/bsd/nvi/dist/cl/cl_main.c:1.10
--- src/external/bsd/nvi/dist/cl/cl_main.c:1.9 Wed Dec 6 17:16:14 2017
+++ src/external/bsd/nvi/dist/cl/cl_main.c Tue Aug 7 08:05:47 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cl_main.c,v 1.9 2017/12/06 17:16:14 jmcneill Exp $ */
+/* $NetBSD: cl_main.c,v 1.10 2018/08/07 08:05:47 rin Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -16,7 +16,7 @@
static const char sccsid[] = "Id: cl_main.c,v 10.54 2001/07/29 19:07:27 skimo Exp (Berkeley) Date: 2001/07/29 19:07:27 ";
#endif /* not lint */
#else
-__RCSID("$NetBSD: cl_main.c,v 1.9 2017/12/06 17:16:14 jmcneill Exp $");
+__RCSID("$NetBSD: cl_main.c,v 1.10 2018/08/07 08:05:47 rin Exp $");
#endif
#include <sys/types.h>
@@ -442,6 +442,9 @@ cl_func_std(WIN *wp)
gp->scr_event = cl_event;
gp->scr_ex_adjust = cl_ex_adjust;
gp->scr_fmap = cl_fmap;
+#ifdef IMCTRL
+ gp->scr_imctrl = cl_imctrl;
+#endif
gp->scr_insertln = cl_insertln;
gp->scr_keyval = cl_keyval;
gp->scr_move = cl_move;
Index: src/external/bsd/nvi/dist/common/gs.h
diff -u src/external/bsd/nvi/dist/common/gs.h:1.3 src/external/bsd/nvi/dist/common/gs.h:1.4
--- src/external/bsd/nvi/dist/common/gs.h:1.3 Mon Nov 25 22:43:46 2013
+++ src/external/bsd/nvi/dist/common/gs.h Tue Aug 7 08:05:47 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: gs.h,v 1.3 2013/11/25 22:43:46 christos Exp $ */
+/* $NetBSD: gs.h,v 1.4 2018/08/07 08:05:47 rin Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -45,6 +45,11 @@ typedef enum { EX_TERM_CE, EX_TERM_SCROL
/* Screen attribute arguments to scr_attr(). */
typedef enum { SA_ALTERNATE, SA_INVERSE } scr_attr_t;
+#ifdef IMCTRL
+/* Input method control arguments to scr_imctrl(). */
+typedef enum { IMCTRL_INIT, IMCTRL_OFF, IMCTRL_ON } imctrl_t;
+#endif
+
/* Key type arguments to scr_keyval(). */
typedef enum { KEY_VEOF, KEY_VERASE, KEY_VKILL, KEY_VWERASE } scr_keyval_t;
@@ -152,6 +157,10 @@ struct _gs {
__P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
/* Get terminal key value. */
int (*scr_keyval) __P((SCR *, scr_keyval_t, CHAR_T *, int *));
+#ifdef IMCTRL
+ /* Control the state of input method. */
+ void (*scr_imctrl) __P((SCR *, imctrl_t));
+#endif
/* Insert a line. */
int (*scr_insertln) __P((SCR *));
/* Handle an option change. */
Index: src/external/bsd/nvi/dist/common/options_f.c
diff -u src/external/bsd/nvi/dist/common/options_f.c:1.3 src/external/bsd/nvi/dist/common/options_f.c:1.4
--- src/external/bsd/nvi/dist/common/options_f.c:1.3 Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/common/options_f.c Tue Aug 7 08:05:47 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: options_f.c,v 1.3 2014/01/26 21:43:45 christos Exp $ */
+/* $NetBSD: options_f.c,v 1.4 2018/08/07 08:05:47 rin Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -16,7 +16,7 @@
static const char sccsid[] = "Id: options_f.c,v 10.33 2001/06/25 15:19:11 skimo Exp (Berkeley) Date: 2001/06/25 15:19:11 ";
#endif /* not lint */
#else
-__RCSID("$NetBSD: options_f.c,v 1.3 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: options_f.c,v 1.4 2018/08/07 08:05:47 rin Exp $");
#endif
#include <sys/types.h>
@@ -301,3 +301,19 @@ f_encoding(SCR *sp, OPTION *op, const ch
return conv_enc(sp, offset, str);
}
+
+#ifdef IMCTRL
+/*
+ * PUBLIC: #ifdef IMCTRL
+ * PUBLIC: int f_imctrl __P((SCR *, OPTION *, const char *, u_long *));
+ * PUBLIC: #endif
+ */
+int
+f_imctrl(SCR *sp, OPTION *op, const char *str, u_long *valp)
+{
+
+ if (*valp)
+ sp->gp->scr_imctrl(sp, IMCTRL_INIT);
+ return (0);
+}
+#endif
Index: src/external/bsd/nvi/dist/common/options.c
diff -u src/external/bsd/nvi/dist/common/options.c:1.5 src/external/bsd/nvi/dist/common/options.c:1.6
--- src/external/bsd/nvi/dist/common/options.c:1.5 Mon Nov 6 03:21:13 2017
+++ src/external/bsd/nvi/dist/common/options.c Tue Aug 7 08:05:47 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: options.c,v 1.5 2017/11/06 03:21:13 rin Exp $ */
+/* $NetBSD: options.c,v 1.6 2018/08/07 08:05:47 rin Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -16,7 +16,7 @@
static const char sccsid[] = "Id: options.c,v 10.65 2002/01/18 22:34:43 skimo Exp (Berkeley) Date: 2002/01/18 22:34:43 ";
#endif /* not lint */
#else
-__RCSID("$NetBSD: options.c,v 1.5 2017/11/06 03:21:13 rin Exp $");
+__RCSID("$NetBSD: options.c,v 1.6 2018/08/07 08:05:47 rin Exp $");
#endif
#include <sys/types.h>
@@ -112,6 +112,18 @@ OPTLIST const optlist[] = {
{L("iclower"), f_recompile, OPT_0BOOL, 0},
/* O_IGNORECASE 4BSD */
{L("ignorecase"), f_recompile, OPT_0BOOL, 0},
+/* O_IMCTRL nvi-m17n/NetBSD */
+#ifdef IMCTRL
+ {L("imctrl"), f_imctrl, OPT_0BOOL, 0},
+#else
+ {L("imctrl"), NULL, OPT_0BOOL, OPT_NDISP|OPT_NOSAVE|OPT_NOSET},
+#endif
+/* O_IMKEY nvi-m17n/NetBSD */
+#ifdef IMCTRL
+ {L("imkey"), NULL, OPT_STR, 0},
+#else
+ {L("imkey"), NULL, OPT_STR, OPT_NDISP|OPT_NOSAVE},
+#endif
/* O_INPUTENCODING */
{L("inputencoding"),f_encoding, OPT_STR, OPT_WC},
/* O_KEYTIME 4.4BSD */
@@ -405,6 +417,9 @@ opts_init(SCR *sp, int *oargs)
OI(O_TABSTOP, L("tabstop=8"));
(void)SPRINTF(b2, SIZE(b2), L("tags=%s"), _PATH_TAGS);
OI(O_TAGS, b2);
+#ifdef IMCTRL
+ OI(O_IMKEY, L("imkey=/?aioAIO"));
+#endif
/*
* XXX
Index: src/external/bsd/nvi/dist/docs/vi.man/vi.1
diff -u src/external/bsd/nvi/dist/docs/vi.man/vi.1:1.5 src/external/bsd/nvi/dist/docs/vi.man/vi.1:1.6
--- src/external/bsd/nvi/dist/docs/vi.man/vi.1:1.5 Tue Dec 27 06:50:03 2016
+++ src/external/bsd/nvi/dist/docs/vi.man/vi.1 Tue Aug 7 08:05:47 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: vi.1,v 1.5 2016/12/27 06:50:03 abhinav Exp $
+.\" $NetBSD: vi.1,v 1.6 2018/08/07 08:05:47 rin Exp $
.\"
.\" Copyright (c) 1994
.\" The Regents of the University of California. All rights reserved.
@@ -12,7 +12,7 @@
.\"
.\" Id: vi.1,v 8.53 2001/01/28 13:20:06 skimo Exp (Berkeley) Date: 2001/01/28 13:20:06
.\"
-.TH VI 1 "November 22, 2013"
+.TH VI 1 "August 7, 2018"
.UC
.SH NAME
ex, vi, view \- text editors
@@ -1147,6 +1147,19 @@ as long as an upper-case letter does not
.B "ignorecase, ic [off]"
Ignore case differences in regular expressions.
.TP
+.B "imctrl [off]"
+Control input method by using escape sequences compatible to
+Tera Term and RLogin.
+The state of input method in commands specified by imkey option is
+saved and restored automatically.
+Input method is then deactivated on returning to command mode.
+If terminal does not accept these escape sequences,
+screen should be corrupted.
+.TP
+.B "imkey [/?aioAIO]"
+Set commands which the state of input method is restored and saved on
+entering and leaving, respectively.
+.TP
.B "keytime [6]"
The 10th's of a second
.I ex/vi
Index: src/external/bsd/nvi/dist/ip/ip_funcs.c
diff -u src/external/bsd/nvi/dist/ip/ip_funcs.c:1.4 src/external/bsd/nvi/dist/ip/ip_funcs.c:1.5
--- src/external/bsd/nvi/dist/ip/ip_funcs.c:1.4 Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/ip/ip_funcs.c Tue Aug 7 08:05:47 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_funcs.c,v 1.4 2014/01/26 21:43:45 christos Exp $ */
+/* $NetBSD: ip_funcs.c,v 1.5 2018/08/07 08:05:47 rin Exp $ */
/*-
* Copyright (c) 1996
* Keith Bostic. All rights reserved.
@@ -14,7 +14,7 @@
static const char sccsid[] = "Id: ip_funcs.c,v 8.23 2001/06/25 15:19:23 skimo Exp (Berkeley) Date: 2001/06/25 15:19:23 ";
#endif /* not lint */
#else
-__RCSID("$NetBSD: ip_funcs.c,v 1.4 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: ip_funcs.c,v 1.5 2018/08/07 08:05:47 rin Exp $");
#endif
#include <sys/types.h>
@@ -316,6 +316,23 @@ ip_ex_adjust(SCR *sp, exadj_t action)
/* NOTREACHED */
}
+#ifdef IMCTRL
+/*
+ * ip_imctrl --
+ * XXX not implemented yet.
+ *
+ * PUBLIC: #ifdef IMCTRL
+ * PUBLIC: void ip_imctrl __P((SCR *, imctrl_t));
+ * PUBLIC: #endif
+ */
+void
+ip_imctrl(SCR *sp, imctrl_t action)
+{
+
+ return;
+}
+#endif
+
/*
* ip_insertln --
* Push down the current line, discarding the bottom line.
Index: src/external/bsd/nvi/dist/ip/ip_main.c
diff -u src/external/bsd/nvi/dist/ip/ip_main.c:1.3 src/external/bsd/nvi/dist/ip/ip_main.c:1.4
--- src/external/bsd/nvi/dist/ip/ip_main.c:1.3 Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/ip/ip_main.c Tue Aug 7 08:05:47 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_main.c,v 1.3 2014/01/26 21:43:45 christos Exp $ */
+/* $NetBSD: ip_main.c,v 1.4 2018/08/07 08:05:47 rin Exp $ */
/*-
* Copyright (c) 1996
* Keith Bostic. All rights reserved.
@@ -14,7 +14,7 @@
static const char sccsid[] = "Id: ip_main.c,v 8.24 2001/07/29 19:07:30 skimo Exp (Berkeley) Date: 2001/07/29 19:07:30 ";
#endif /* not lint */
#else
-__RCSID("$NetBSD: ip_main.c,v 1.3 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: ip_main.c,v 1.4 2018/08/07 08:05:47 rin Exp $");
#endif
#include <sys/types.h>
@@ -296,6 +296,9 @@ ip_func_std(WIN *wp)
gp->scr_event = ip_event;
gp->scr_ex_adjust = ip_ex_adjust;
gp->scr_fmap = ip_fmap;
+#ifdef IMCTRL
+ gp->scr_imctrl = ip_imctrl;
+#endif
gp->scr_insertln = ip_insertln;
gp->scr_keyval = ip_keyval;
gp->scr_move = ip_move;
Index: src/external/bsd/nvi/dist/vi/v_replace.c
diff -u src/external/bsd/nvi/dist/vi/v_replace.c:1.3 src/external/bsd/nvi/dist/vi/v_replace.c:1.4
--- src/external/bsd/nvi/dist/vi/v_replace.c:1.3 Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/vi/v_replace.c Tue Aug 7 08:05:47 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: v_replace.c,v 1.3 2014/01/26 21:43:45 christos Exp $ */
+/* $NetBSD: v_replace.c,v 1.4 2018/08/07 08:05:47 rin Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -16,7 +16,7 @@
static const char sccsid[] = "Id: v_replace.c,v 10.24 2001/06/25 15:19:34 skimo Exp (Berkeley) Date: 2001/06/25 15:19:34 ";
#endif /* not lint */
#else
-__RCSID("$NetBSD: v_replace.c,v 1.3 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: v_replace.c,v 1.4 2018/08/07 08:05:47 rin Exp $");
#endif
#include <sys/types.h>
@@ -136,6 +136,9 @@ next: if (v_event_get(sp, &ev, 0, 0))
return (0);
case E_WRESIZE:
/* <resize> interrupts the input mode. */
+#ifdef IMCTRL
+ sp->gp->scr_imctrl(sp, IMCTRL_OFF);
+#endif
v_emsg(sp, NULL, VIM_WRESIZE);
return (0);
case E_REPAINT:
Index: src/external/bsd/nvi/dist/vi/v_txt.c
diff -u src/external/bsd/nvi/dist/vi/v_txt.c:1.5 src/external/bsd/nvi/dist/vi/v_txt.c:1.6
--- src/external/bsd/nvi/dist/vi/v_txt.c:1.5 Tue Nov 21 06:35:22 2017
+++ src/external/bsd/nvi/dist/vi/v_txt.c Tue Aug 7 08:05:47 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: v_txt.c,v 1.5 2017/11/21 06:35:22 rin Exp $ */
+/* $NetBSD: v_txt.c,v 1.6 2018/08/07 08:05:47 rin Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -16,7 +16,7 @@
static const char sccsid[] = "Id: v_txt.c,v 10.108 2003/07/18 21:27:42 skimo Exp (Berkeley) Date: 2003/07/18 21:27:42 ";
#endif /* not lint */
#else
-__RCSID("$NetBSD: v_txt.c,v 1.5 2017/11/21 06:35:22 rin Exp $");
+__RCSID("$NetBSD: v_txt.c,v 1.6 2018/08/07 08:05:47 rin Exp $");
#endif
#include <sys/types.h>
@@ -530,6 +530,9 @@ next: if (v_event_get(sp, evp, 0, ec_fla
goto next;
case E_WRESIZE:
/* <resize> interrupts the input mode. */
+#ifdef IMCTRL
+ sp->gp->scr_imctrl(sp, IMCTRL_OFF);
+#endif
v_emsg(sp, NULL, VIM_WRESIZE);
goto k_escape;
default:
Index: src/external/bsd/nvi/dist/vi/vi.c
diff -u src/external/bsd/nvi/dist/vi/vi.c:1.6 src/external/bsd/nvi/dist/vi/vi.c:1.7
--- src/external/bsd/nvi/dist/vi/vi.c:1.6 Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/vi/vi.c Tue Aug 7 08:05:47 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: vi.c,v 1.6 2014/01/26 21:43:45 christos Exp $ */
+/* $NetBSD: vi.c,v 1.7 2018/08/07 08:05:47 rin Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -16,7 +16,7 @@
static const char sccsid[] = "Id: vi.c,v 10.73 2002/04/11 19:49:30 skimo Exp (Berkeley) Date: 2002/04/11 19:49:30 ";
#endif /* not lint */
#else
-__RCSID("$NetBSD: vi.c,v 1.6 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: vi.c,v 1.7 2018/08/07 08:05:47 rin Exp $");
#endif
#include <sys/types.h>
@@ -76,6 +76,9 @@ vi(SCR **spp)
VICMD cmd, *vp;
VI_PRIVATE *vip;
int comcount, mapped, rval;
+#ifdef IMCTRL
+ int ret;
+#endif
/* Get the first screen. */
sp = *spp;
@@ -236,8 +239,18 @@ vi(SCR **spp)
v_comlog(sp, vp);
#endif
/* Call the function. */
+#ifndef IMCTRL
ex_continue: if (vp->kp->func(sp, vp))
goto err;
+#else
+ex_continue: if (strchr(O_STR(sp, O_IMKEY), vp->key))
+ sp->gp->scr_imctrl(sp, IMCTRL_ON);
+ ret = vp->kp->func(sp, vp);
+ if (strchr(O_STR(sp, O_IMKEY), vp->key))
+ sp->gp->scr_imctrl(sp, IMCTRL_OFF);
+ if (ret)
+ goto err;
+#endif
#ifdef DEBUG
/* Make sure no function left the temporary space locked. */
if (F_ISSET(wp, W_TMP_INUSE)) {
@@ -712,7 +725,17 @@ usage: if (ismotion == NULL)
/* Pick up required trailing character. */
if (LF_ISSET(V_CHAR))
+#ifndef IMCTRL
+ KEY(vp->character, 0);
+#else
+ {
+ if (strchr(O_STR(sp, O_IMKEY), vp->key))
+ sp->gp->scr_imctrl(sp, IMCTRL_ON);
KEY(vp->character, 0);
+ if (strchr(O_STR(sp, O_IMKEY), vp->key))
+ sp->gp->scr_imctrl(sp, IMCTRL_OFF);
+ }
+#endif
/* Get any associated cursor word. */
if (F_ISSET(kp, V_KEYW) && v_curword(sp))
@@ -747,6 +770,9 @@ v_motion(SCR *sp, VICMD *dm, VICMD *vp,
u_long cnt;
u_int flags;
int tilde_reset, notused;
+#ifdef IMKEY
+ int rval;
+#endif
/*
* If '.' command, use the dot motion, else get the motion command.
@@ -869,8 +895,18 @@ v_motion(SCR *sp, VICMD *dm, VICMD *vp,
motion.m_stop.cno = motion.m_start.cno = sp->cno;
/* Run the function. */
+#ifndef IMKEY
if ((motion.kp->func)(sp, &motion))
return (1);
+#else
+ if (strchr(O_STR(sp, O_IMKEY), motion.key))
+ imreset(sp);
+ rval = (motion.kp->func)(sp, &motion);
+ if (strchr(O_STR(sp, O_IMKEY), motion.key))
+ imoff(sp);
+ if (rval)
+ return (1);
+#endif
/*
* If the current line is missing, i.e. the file is empty,
Index: src/external/bsd/nvi/usr.bin/nvi/Makefile
diff -u src/external/bsd/nvi/usr.bin/nvi/Makefile:1.16 src/external/bsd/nvi/usr.bin/nvi/Makefile:1.17
--- src/external/bsd/nvi/usr.bin/nvi/Makefile:1.16 Tue Nov 21 02:47:14 2017
+++ src/external/bsd/nvi/usr.bin/nvi/Makefile Tue Aug 7 08:05:48 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.16 2017/11/21 02:47:14 rin Exp $
+# $NetBSD: Makefile,v 1.17 2018/08/07 08:05:48 rin Exp $
.include <bsd.own.mk>
@@ -18,7 +18,8 @@ CWARNFLAGS.gcc+= -Wno-unused
CWARNFLAGS.clang+= -Wno-unsequenced
.endif
-CPPFLAGS+=-I${DIST}/include -I${.CURDIR} -I. -DGTAGS
+CPPFLAGS+=-I${DIST}/include -I${.CURDIR} -I.
+CPPFLAGS+=-DGTAGS -DIMCTRL
CPPFLAGS+=-DHAVE_OPENPTY -DHAVE_UTIL_H
CPPFLAGS+=-DHAVE_SIGTIMEDWAIT
CPPFLAGS+=-DHAVE_MVWCHGAT