Mercurial > vim
comparison src/mbyte.c @ 13380:69517d67421f v8.0.1564
patch 8.0.1564: too many #ifdefs
commit https://github.com/vim/vim/commit/f2bd8ef2b4507d02c6043affff8f7e85e3414d5f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 4 18:08:14 2018 +0100
patch 8.0.1564: too many #ifdefs
Problem: Too many #ifdefs.
Solution: Graduate the +autocmd feature. Takes away 450 #ifdefs and
increases code size of tiny Vim by only 40 Kbyte.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 04 Mar 2018 18:15:08 +0100 |
parents | 8412df1479a3 |
children | e76499e85744 |
comparison
equal
deleted
inserted
replaced
13379:0f9dd1b43244 | 13380:69517d67421f |
---|---|
797 * line arguments from the active codepage to 'encoding'. */ | 797 * line arguments from the active codepage to 'encoding'. */ |
798 if (starting != 0) | 798 if (starting != 0) |
799 fix_arg_enc(); | 799 fix_arg_enc(); |
800 #endif | 800 #endif |
801 | 801 |
802 #ifdef FEAT_AUTOCMD | |
803 /* Fire an autocommand to let people do custom font setup. This must be | 802 /* Fire an autocommand to let people do custom font setup. This must be |
804 * after Vim has been setup for the new encoding. */ | 803 * after Vim has been setup for the new encoding. */ |
805 apply_autocmds(EVENT_ENCODINGCHANGED, NULL, (char_u *)"", FALSE, curbuf); | 804 apply_autocmds(EVENT_ENCODINGCHANGED, NULL, (char_u *)"", FALSE, curbuf); |
806 #endif | |
807 | 805 |
808 #ifdef FEAT_SPELL | 806 #ifdef FEAT_SPELL |
809 /* Need to reload spell dictionaries */ | 807 /* Need to reload spell dictionaries */ |
810 spell_reload(); | 808 spell_reload(); |
811 #endif | 809 #endif |
4790 #else | 4788 #else |
4791 # define USE_IMACTIVATEFUNC (*p_imaf != NUL) | 4789 # define USE_IMACTIVATEFUNC (*p_imaf != NUL) |
4792 # define USE_IMSTATUSFUNC (*p_imsf != NUL) | 4790 # define USE_IMSTATUSFUNC (*p_imsf != NUL) |
4793 #endif | 4791 #endif |
4794 | 4792 |
4795 #if defined(FEAT_EVAL) && defined(FEAT_MBYTE) | 4793 #if defined(FEAT_EVAL) && defined(FEAT_MBYTE) \ |
4794 && (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM)) | |
4796 static void | 4795 static void |
4797 call_imactivatefunc(int active) | 4796 call_imactivatefunc(int active) |
4798 { | 4797 { |
4799 char_u *argv[1]; | 4798 char_u *argv[1]; |
4800 | 4799 |
4809 call_imstatusfunc(void) | 4808 call_imstatusfunc(void) |
4810 { | 4809 { |
4811 int is_active; | 4810 int is_active; |
4812 | 4811 |
4813 /* FIXME: Don't execute user function in unsafe situation. */ | 4812 /* FIXME: Don't execute user function in unsafe situation. */ |
4814 if (exiting | 4813 if (exiting || is_autocmd_blocked()) |
4815 # ifdef FEAT_AUTOCMD | |
4816 || is_autocmd_blocked() | |
4817 # endif | |
4818 ) | |
4819 return FALSE; | 4814 return FALSE; |
4820 /* FIXME: :py print 'xxx' is shown duplicate result. | 4815 /* FIXME: :py print 'xxx' is shown duplicate result. |
4821 * Use silent to avoid it. */ | 4816 * Use silent to avoid it. */ |
4822 ++msg_silent; | 4817 ++msg_silent; |
4823 is_active = call_func_retnr(p_imsf, 0, NULL, FALSE); | 4818 is_active = call_func_retnr(p_imsf, 0, NULL, FALSE); |
5696 } | 5691 } |
5697 | 5692 |
5698 void | 5693 void |
5699 xim_reset(void) | 5694 xim_reset(void) |
5700 { | 5695 { |
5701 #ifdef FEAT_EVAL | 5696 # ifdef FEAT_EVAL |
5702 if (USE_IMACTIVATEFUNC) | 5697 if (USE_IMACTIVATEFUNC) |
5703 call_imactivatefunc(im_is_active); | 5698 call_imactivatefunc(im_is_active); |
5704 else | 5699 else |
5705 #endif | 5700 # endif |
5706 if (xic != NULL) | 5701 if (xic != NULL) |
5707 { | 5702 { |
5708 gtk_im_context_reset(xic); | 5703 gtk_im_context_reset(xic); |
5709 | 5704 |
5710 if (p_imdisable) | 5705 if (p_imdisable) |
6480 } | 6475 } |
6481 # endif | 6476 # endif |
6482 | 6477 |
6483 #else /* !defined(FEAT_XIM) */ | 6478 #else /* !defined(FEAT_XIM) */ |
6484 | 6479 |
6485 # if !defined(FEAT_GUI_W32) || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)) | 6480 # ifdef IME_WITHOUT_XIM |
6486 static int im_was_set_active = FALSE; | 6481 static int im_was_set_active = FALSE; |
6487 | 6482 |
6488 int | 6483 int |
6489 im_get_status() | 6484 im_get_status(void) |
6490 { | 6485 { |
6491 # if defined(FEAT_MBYTE) && defined(FEAT_EVAL) | 6486 # if defined(FEAT_MBYTE) && defined(FEAT_EVAL) |
6492 if (USE_IMSTATUSFUNC) | 6487 if (USE_IMSTATUSFUNC) |
6493 return call_imstatusfunc(); | 6488 return call_imstatusfunc(); |
6494 # endif | 6489 # endif |