aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-13 23:08:01 +0800
committerGitHub <noreply@github.com>2023-05-13 23:08:01 +0800
commit79d5f06f79ca2f84a89be3fe2b3d498a72e37a55 (patch)
treee960618fe3e508a432ee9b814a387f8bf8c22024 /src/nvim/ex_getln.c
parent6f29c68928c3f20d9a1b1a7a311cfac65aa1b4e6 (diff)
parentcd9ca700e5053f8a9666c917310dcc39651e3bfa (diff)
downloadrneovim-79d5f06f79ca2f84a89be3fe2b3d498a72e37a55.tar.gz
rneovim-79d5f06f79ca2f84a89be3fe2b3d498a72e37a55.tar.bz2
rneovim-79d5f06f79ca2f84a89be3fe2b3d498a72e37a55.zip
Merge pull request #23612 from zeertzjq/vim-9.0.0064
vim-patch:9.0.{0064,0218,0249,0490,0492,0598}: cmdwin fixes
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 1345a29a21..a4c1863576 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -127,6 +127,7 @@ typedef struct command_line_state {
int break_ctrl_c;
expand_T xpc;
long *b_im_ptr;
+ buf_T *b_im_ptr_buf; ///< buffer where b_im_ptr is valid
} CommandLineState;
typedef struct cmdpreview_win_info {
@@ -736,7 +737,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool clea
} else {
s->b_im_ptr = &curbuf->b_p_imsearch;
}
-
+ s->b_im_ptr_buf = curbuf;
if (*s->b_im_ptr == B_IMODE_LMAP) {
State |= MODE_LANGMAP;
}
@@ -1538,20 +1539,21 @@ static int command_line_erase_chars(CommandLineState *s)
/// language :lmap mappings and/or Input Method.
static void command_line_toggle_langmap(CommandLineState *s)
{
+ long *b_im_ptr = buf_valid(s->b_im_ptr_buf) ? s->b_im_ptr : NULL;
if (map_to_exists_mode("", MODE_LANGMAP, false)) {
// ":lmap" mappings exists, toggle use of mappings.
State ^= MODE_LANGMAP;
- if (s->b_im_ptr != NULL) {
+ if (b_im_ptr != NULL) {
if (State & MODE_LANGMAP) {
- *s->b_im_ptr = B_IMODE_LMAP;
+ *b_im_ptr = B_IMODE_LMAP;
} else {
- *s->b_im_ptr = B_IMODE_NONE;
+ *b_im_ptr = B_IMODE_NONE;
}
}
}
- if (s->b_im_ptr != NULL) {
- if (s->b_im_ptr == &curbuf->b_p_iminsert) {
+ if (b_im_ptr != NULL) {
+ if (b_im_ptr == &curbuf->b_p_iminsert) {
set_iminsert_global(curbuf);
} else {
set_imsearch_global(curbuf);