Mercurial > vim
comparison src/screen.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 | 4bd21046902b |
children | ba63a184e6b6 |
comparison
equal
deleted
inserted
replaced
17808:42561b61bfd8 | 17809:59f8948b7590 |
---|---|
783 } | 783 } |
784 } | 784 } |
785 #if defined(FEAT_SEARCH_EXTRA) | 785 #if defined(FEAT_SEARCH_EXTRA) |
786 end_search_hl(); | 786 end_search_hl(); |
787 #endif | 787 #endif |
788 #ifdef FEAT_INS_EXPAND | |
789 /* May need to redraw the popup menu. */ | 788 /* May need to redraw the popup menu. */ |
790 pum_may_redraw(); | 789 pum_may_redraw(); |
791 #endif | |
792 | 790 |
793 /* Reset b_mod_set flags. Going through all windows is probably faster | 791 /* Reset b_mod_set flags. Going through all windows is probably faster |
794 * than going through all buffers (there could be many buffers). */ | 792 * than going through all buffers (there could be many buffers). */ |
795 FOR_ALL_WINDOWS(wp) | 793 FOR_ALL_WINDOWS(wp) |
796 wp->w_buffer->b_mod_set = FALSE; | 794 wp->w_buffer->b_mod_set = FALSE; |
6875 { | 6873 { |
6876 /* no status line, can only be last window */ | 6874 /* no status line, can only be last window */ |
6877 redraw_cmdline = TRUE; | 6875 redraw_cmdline = TRUE; |
6878 } | 6876 } |
6879 else if (!redrawing() | 6877 else if (!redrawing() |
6880 #ifdef FEAT_INS_EXPAND | |
6881 // don't update status line when popup menu is visible and may be | 6878 // don't update status line when popup menu is visible and may be |
6882 // drawn over it, unless it will be redrawn later | 6879 // drawn over it, unless it will be redrawn later |
6883 || (!ignore_pum && pum_visible()) | 6880 || (!ignore_pum && pum_visible())) |
6884 #endif | |
6885 ) | |
6886 { | 6881 { |
6887 /* Don't redraw right now, do it later. */ | 6882 /* Don't redraw right now, do it later. */ |
6888 wp->w_redr_status = TRUE; | 6883 wp->w_redr_status = TRUE; |
6889 } | 6884 } |
6890 #ifdef FEAT_STL_OPT | 6885 #ifdef FEAT_STL_OPT |
7966 /* Check for illegal values, just in case (could happen just after | 7961 /* Check for illegal values, just in case (could happen just after |
7967 * resizing). */ | 7962 * resizing). */ |
7968 if (row >= screen_Rows || col >= screen_Columns) | 7963 if (row >= screen_Rows || col >= screen_Columns) |
7969 return; | 7964 return; |
7970 | 7965 |
7971 #ifdef FEAT_INS_EXPAND | |
7972 // Skip if under the popup menu. | 7966 // Skip if under the popup menu. |
7973 // Popup windows with zindex higher than POPUPMENU_ZINDEX go on top. | 7967 // Popup windows with zindex higher than POPUPMENU_ZINDEX go on top. |
7974 if (pum_under_menu(row, col) | 7968 if (pum_under_menu(row, col) |
7975 # ifdef FEAT_TEXT_PROP | 7969 #ifdef FEAT_TEXT_PROP |
7976 && screen_zindex <= POPUPMENU_ZINDEX | 7970 && screen_zindex <= POPUPMENU_ZINDEX |
7977 # endif | 7971 #endif |
7978 ) | 7972 ) |
7979 return; | 7973 return; |
7980 #endif | |
7981 #ifdef FEAT_TEXT_PROP | 7974 #ifdef FEAT_TEXT_PROP |
7982 if (blocked_by_popup(row, col)) | 7975 if (blocked_by_popup(row, col)) |
7983 return; | 7976 return; |
7984 #endif | 7977 #endif |
7985 | 7978 |
9951 int need_clear; | 9944 int need_clear; |
9952 int length = 0; | 9945 int length = 0; |
9953 int do_mode; | 9946 int do_mode; |
9954 int attr; | 9947 int attr; |
9955 int nwr_save; | 9948 int nwr_save; |
9956 #ifdef FEAT_INS_EXPAND | |
9957 int sub_attr; | 9949 int sub_attr; |
9958 #endif | |
9959 | 9950 |
9960 do_mode = ((p_smd && msg_silent == 0) | 9951 do_mode = ((p_smd && msg_silent == 0) |
9961 && ((State & INSERT) | 9952 && ((State & INSERT) |
9962 || restart_edit != NUL | 9953 || restart_edit != NUL |
9963 || VIsual_active)); | 9954 || VIsual_active)); |
10008 else | 9999 else |
10009 msg_puts_attr(" \307\321\261\333", attr); | 10000 msg_puts_attr(" \307\321\261\333", attr); |
10010 } | 10001 } |
10011 } | 10002 } |
10012 #endif | 10003 #endif |
10013 #ifdef FEAT_INS_EXPAND | |
10014 /* CTRL-X in Insert mode */ | 10004 /* CTRL-X in Insert mode */ |
10015 if (edit_submode != NULL && !shortmess(SHM_COMPLETIONMENU)) | 10005 if (edit_submode != NULL && !shortmess(SHM_COMPLETIONMENU)) |
10016 { | 10006 { |
10017 /* These messages can get long, avoid a wrap in a narrow | 10007 /* These messages can get long, avoid a wrap in a narrow |
10018 * window. Prefer showing edit_submode_extra. */ | 10008 * window. Prefer showing edit_submode_extra. */ |
10039 msg_puts_attr((char *)edit_submode_extra, sub_attr); | 10029 msg_puts_attr((char *)edit_submode_extra, sub_attr); |
10040 } | 10030 } |
10041 } | 10031 } |
10042 } | 10032 } |
10043 else | 10033 else |
10044 #endif | |
10045 { | 10034 { |
10046 if (State & VREPLACE_FLAG) | 10035 if (State & VREPLACE_FLAG) |
10047 msg_puts_attr(_(" VREPLACE"), attr); | 10036 msg_puts_attr(_(" VREPLACE"), attr); |
10048 else if (State & REPLACE_FLAG) | 10037 else if (State & REPLACE_FLAG) |
10049 msg_puts_attr(_(" REPLACE"), attr); | 10038 msg_puts_attr(_(" REPLACE"), attr); |
10104 } | 10093 } |
10105 | 10094 |
10106 need_clear = TRUE; | 10095 need_clear = TRUE; |
10107 } | 10096 } |
10108 if (reg_recording != 0 | 10097 if (reg_recording != 0 |
10109 #ifdef FEAT_INS_EXPAND | 10098 && edit_submode == NULL) // otherwise it gets too long |
10110 && edit_submode == NULL /* otherwise it gets too long */ | |
10111 #endif | |
10112 ) | |
10113 { | 10099 { |
10114 recording_mode(attr); | 10100 recording_mode(attr); |
10115 need_clear = TRUE; | 10101 need_clear = TRUE; |
10116 } | 10102 } |
10117 | 10103 |
10564 void | 10550 void |
10565 showruler(int always) | 10551 showruler(int always) |
10566 { | 10552 { |
10567 if (!always && !redrawing()) | 10553 if (!always && !redrawing()) |
10568 return; | 10554 return; |
10569 #ifdef FEAT_INS_EXPAND | |
10570 if (pum_visible()) | 10555 if (pum_visible()) |
10571 { | 10556 { |
10572 /* Don't redraw right now, do it later. */ | 10557 /* Don't redraw right now, do it later. */ |
10573 curwin->w_redr_status = TRUE; | 10558 curwin->w_redr_status = TRUE; |
10574 return; | 10559 return; |
10575 } | 10560 } |
10576 #endif | |
10577 #if defined(FEAT_STL_OPT) | 10561 #if defined(FEAT_STL_OPT) |
10578 if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && curwin->w_status_height) | 10562 if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && curwin->w_status_height) |
10579 redraw_custom_statusline(curwin); | 10563 redraw_custom_statusline(curwin); |
10580 else | 10564 else |
10581 #endif | 10565 #endif |
10624 * after deleting lines, before cursor.lnum is corrected. | 10608 * after deleting lines, before cursor.lnum is corrected. |
10625 */ | 10609 */ |
10626 if (wp->w_cursor.lnum > wp->w_buffer->b_ml.ml_line_count) | 10610 if (wp->w_cursor.lnum > wp->w_buffer->b_ml.ml_line_count) |
10627 return; | 10611 return; |
10628 | 10612 |
10629 #ifdef FEAT_INS_EXPAND | 10613 // Don't draw the ruler while doing insert-completion, it might overwrite |
10630 /* Don't draw the ruler while doing insert-completion, it might overwrite | 10614 // the (long) mode message. |
10631 * the (long) mode message. */ | |
10632 if (wp == lastwin && lastwin->w_status_height == 0) | 10615 if (wp == lastwin && lastwin->w_status_height == 0) |
10633 if (edit_submode != NULL) | 10616 if (edit_submode != NULL) |
10634 return; | 10617 return; |
10635 // Don't draw the ruler when the popup menu is visible, it may overlap. | 10618 // Don't draw the ruler when the popup menu is visible, it may overlap. |
10636 // Except when the popup menu will be redrawn anyway. | 10619 // Except when the popup menu will be redrawn anyway. |
10637 if (!ignore_pum && pum_visible()) | 10620 if (!ignore_pum && pum_visible()) |
10638 return; | 10621 return; |
10639 #endif | |
10640 | 10622 |
10641 #ifdef FEAT_STL_OPT | 10623 #ifdef FEAT_STL_OPT |
10642 if (*p_ruf) | 10624 if (*p_ruf) |
10643 { | 10625 { |
10644 int save_called_emsg = called_emsg; | 10626 int save_called_emsg = called_emsg; |