Mercurial > vim
comparison src/getchar.c @ 17809:59f8948b7590 v8.1.1901
patch 8.1.1901: the +insert_expand feature is not always available
Commit: https://github.com/vim/vim/commit/e2c453d38f6512ac4cff7cd26aa7780b4e2534d7
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 21 14:37:09 2019 +0200
patch 8.1.1901: the +insert_expand feature is not always available
Problem: The +insert_expand feature is not always available.
Solution: Graduate the +insert_expand feature.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 21 Aug 2019 14:45:04 +0200 |
parents | 0f7ae8010787 |
children | a1396a35444c |
comparison
equal
deleted
inserted
replaced
17808:42561b61bfd8 | 17809:59f8948b7590 |
---|---|
1479 while (scriptin[0] != NULL) | 1479 while (scriptin[0] != NULL) |
1480 closescript(); | 1480 closescript(); |
1481 } | 1481 } |
1482 #endif | 1482 #endif |
1483 | 1483 |
1484 #if defined(FEAT_INS_EXPAND) || defined(PROTO) | |
1485 /* | 1484 /* |
1486 * Return TRUE when reading keys from a script file. | 1485 * Return TRUE when reading keys from a script file. |
1487 */ | 1486 */ |
1488 int | 1487 int |
1489 using_script(void) | 1488 using_script(void) |
1490 { | 1489 { |
1491 return scriptin[curscript] != NULL; | 1490 return scriptin[curscript] != NULL; |
1492 } | 1491 } |
1493 #endif | |
1494 | 1492 |
1495 /* | 1493 /* |
1496 * This function is called just before doing a blocking wait. Thus after | 1494 * This function is called just before doing a blocking wait. Thus after |
1497 * waiting 'updatetime' for a character to arrive. | 1495 * waiting 'updatetime' for a character to arrive. |
1498 */ | 1496 */ |
1864 --allow_keys; | 1862 --allow_keys; |
1865 return c; | 1863 return c; |
1866 } | 1864 } |
1867 #endif | 1865 #endif |
1868 | 1866 |
1869 #if defined(FEAT_INS_EXPAND) || defined(FEAT_EVAL) || defined(PROTO) | |
1870 /* | 1867 /* |
1871 * Check if any character is available, also half an escape sequence. | 1868 * Check if any character is available, also half an escape sequence. |
1872 * Trick: when no typeahead found, but there is something in the typeahead | 1869 * Trick: when no typeahead found, but there is something in the typeahead |
1873 * buffer, it must be an ESC that is recognized as the start of a key code. | 1870 * buffer, it must be an ESC that is recognized as the start of a key code. |
1874 */ | 1871 */ |
1880 c = vpeekc(); | 1877 c = vpeekc(); |
1881 if (c == NUL && typebuf.tb_len > 0) | 1878 if (c == NUL && typebuf.tb_len > 0) |
1882 c = ESC; | 1879 c = ESC; |
1883 return c; | 1880 return c; |
1884 } | 1881 } |
1885 #endif | |
1886 | 1882 |
1887 /* | 1883 /* |
1888 * Call vpeekc() without causing anything to be mapped. | 1884 * Call vpeekc() without causing anything to be mapped. |
1889 * Return TRUE if a character is available, FALSE otherwise. | 1885 * Return TRUE if a character is available, FALSE otherwise. |
1890 */ | 1886 */ |
1961 & (RM_NONE|RM_ABBR)) == 0)) | 1957 & (RM_NONE|RM_ABBR)) == 0)) |
1962 && !(p_paste && (State & (INSERT + CMDLINE))) | 1958 && !(p_paste && (State & (INSERT + CMDLINE))) |
1963 && !(State == HITRETURN && (tb_c1 == CAR || tb_c1 == ' ')) | 1959 && !(State == HITRETURN && (tb_c1 == CAR || tb_c1 == ' ')) |
1964 && State != ASKMORE | 1960 && State != ASKMORE |
1965 && State != CONFIRM | 1961 && State != CONFIRM |
1966 #ifdef FEAT_INS_EXPAND | |
1967 && !((ctrl_x_mode_not_default() && vim_is_ctrl_x_key(tb_c1)) | 1962 && !((ctrl_x_mode_not_default() && vim_is_ctrl_x_key(tb_c1)) |
1968 || ((compl_cont_status & CONT_LOCAL) | 1963 || ((compl_cont_status & CONT_LOCAL) |
1969 && (tb_c1 == Ctrl_N || tb_c1 == Ctrl_P))) | 1964 && (tb_c1 == Ctrl_N || tb_c1 == Ctrl_P)))) |
1970 #endif | |
1971 ) | |
1972 { | 1965 { |
1973 #ifdef FEAT_LANGMAP | 1966 #ifdef FEAT_LANGMAP |
1974 if (tb_c1 == K_SPECIAL) | 1967 if (tb_c1 == K_SPECIAL) |
1975 nolmaplen = 2; | 1968 nolmaplen = 2; |
1976 else | 1969 else |