Skip to content

Commit

Permalink
vimdll: Support 'iminsert' on console
Browse files Browse the repository at this point in the history
  • Loading branch information
k-takata committed Nov 29, 2019
1 parent 99fce97 commit be97416
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
13 changes: 13 additions & 0 deletions src/gui_w32.c
Original file line number Diff line number Diff line change
Expand Up @@ -5746,6 +5746,14 @@ im_set_active(int active)
HIMC hImc;
static HIMC hImcOld = (HIMC)0;

# ifdef VIMDLL
if (!gui.in_use)
{
mbyte_im_set_active(active);
return;
}
# endif

if (pImmGetContext) /* if NULL imm32.dll wasn't loaded (yet) */
{
if (p_imdisable)
Expand Down Expand Up @@ -5815,6 +5823,11 @@ im_get_status(void)
int status = 0;
HIMC hImc;

# ifdef VIMDLL
if (!gui.in_use)
return mbyte_im_get_status();
# endif

if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0)
{
status = pImmGetOpenStatus(hImc) ? 1 : 0;
Expand Down
15 changes: 12 additions & 3 deletions src/mbyte.c
Original file line number Diff line number Diff line change
Expand Up @@ -4789,7 +4789,8 @@ iconv_end(void)
# define USE_IMSTATUSFUNC (*p_imsf != NUL)
#endif

#if defined(FEAT_EVAL) && (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM))
#if defined(FEAT_EVAL) && \
(defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(VIMDLL))
static void
call_imactivatefunc(int active)
{
Expand Down Expand Up @@ -6454,11 +6455,15 @@ xim_get_status_area_height(void)

#else /* !defined(FEAT_XIM) */

# ifdef IME_WITHOUT_XIM
# if defined(IME_WITHOUT_XIM) || defined(VIMDLL)
static int im_was_set_active = FALSE;

int
# ifdef VIMDLL
mbyte_im_get_status(void)
# else
im_get_status(void)
# endif
{
# if defined(FEAT_EVAL)
if (USE_IMSTATUSFUNC)
Expand All @@ -6468,7 +6473,11 @@ im_get_status(void)
}

void
# ifdef VIMDLL
mbyte_im_set_active(int active_arg)
# else
im_set_active(int active_arg)
# endif
{
# if defined(FEAT_EVAL)
int active = !p_imdisable && active_arg;
Expand All @@ -6481,7 +6490,7 @@ im_set_active(int active_arg)
# endif
}

# ifdef FEAT_GUI
# if defined(FEAT_GUI) && !defined(VIMDLL)
void
im_set_position(int row UNUSED, int col UNUSED)
{
Expand Down
4 changes: 4 additions & 0 deletions src/proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ void qsort(void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void
# include "mouse.pro"
# include "move.pro"
# include "mbyte.pro"
# ifdef VIMDLL
int mbyte_im_get_status(void);
void mbyte_im_set_active(int active_arg);
# endif
# include "normal.pro"
# include "ops.pro"
# include "option.pro"
Expand Down

0 comments on commit be97416

Please sign in to comment.