Mercurial > vim
comparison src/ex_getln.c @ 13244:ac42c4b11dbc v8.0.1496
patch 8.0.1496: clearing a pointer takes two lines
commit https://github.com/vim/vim/commit/d23a823669d93fb2a570a039173eefe4856ac806
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 10 18:45:26 2018 +0100
patch 8.0.1496: clearing a pointer takes two lines
Problem: Clearing a pointer takes two lines.
Solution: Add VIM_CLEAR() and replace vim_clear(). (Hirohito Higashi,
closes #2629)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 10 Feb 2018 19:00:07 +0100 |
parents | 59a16624400a |
children | 69e86e6e5703 |
comparison
equal
deleted
inserted
replaced
13243:899b19739188 | 13244:ac42c4b11dbc |
---|---|
162 * Abandon the command line. | 162 * Abandon the command line. |
163 */ | 163 */ |
164 static void | 164 static void |
165 abandon_cmdline(void) | 165 abandon_cmdline(void) |
166 { | 166 { |
167 vim_free(ccline.cmdbuff); | 167 VIM_CLEAR(ccline.cmdbuff); |
168 ccline.cmdbuff = NULL; | |
169 if (msg_scrolled == 0) | 168 if (msg_scrolled == 0) |
170 compute_cmdrow(); | 169 compute_cmdrow(); |
171 MSG(""); | 170 MSG(""); |
172 redraw_cmdline = TRUE; | 171 redraw_cmdline = TRUE; |
173 } | 172 } |
498 && c != K_DOWN && c != K_UP | 497 && c != K_DOWN && c != K_UP |
499 && c != K_PAGEDOWN && c != K_PAGEUP | 498 && c != K_PAGEDOWN && c != K_PAGEUP |
500 && c != K_KPAGEDOWN && c != K_KPAGEUP | 499 && c != K_KPAGEDOWN && c != K_KPAGEUP |
501 && c != K_LEFT && c != K_RIGHT | 500 && c != K_LEFT && c != K_RIGHT |
502 && (xpc.xp_numfiles > 0 || (c != Ctrl_P && c != Ctrl_N))) | 501 && (xpc.xp_numfiles > 0 || (c != Ctrl_P && c != Ctrl_N))) |
503 { | 502 VIM_CLEAR(lookfor); |
504 vim_free(lookfor); | |
505 lookfor = NULL; | |
506 } | |
507 #endif | 503 #endif |
508 | 504 |
509 /* | 505 /* |
510 * When there are matching completions to select <S-Tab> works like | 506 * When there are matching completions to select <S-Tab> works like |
511 * CTRL-P (unless 'wc' is <S-Tab>). | 507 * CTRL-P (unless 'wc' is <S-Tab>). |
1094 || ccline.cmdfirstc == '>' | 1090 || ccline.cmdfirstc == '>' |
1095 #endif | 1091 #endif |
1096 ) | 1092 ) |
1097 goto cmdline_not_changed; | 1093 goto cmdline_not_changed; |
1098 | 1094 |
1099 vim_free(ccline.cmdbuff); /* no commandline to return */ | 1095 VIM_CLEAR(ccline.cmdbuff); /* no commandline to return */ |
1100 ccline.cmdbuff = NULL; | |
1101 if (!cmd_silent) | 1096 if (!cmd_silent) |
1102 { | 1097 { |
1103 #ifdef FEAT_RIGHTLEFT | 1098 #ifdef FEAT_RIGHTLEFT |
1104 if (cmdmsg_rl) | 1099 if (cmdmsg_rl) |
1105 msg_col = Columns; | 1100 msg_col = Columns; |
3681 for (j = 0; j < xp->xp_pattern_len; ++j) | 3676 for (j = 0; j < xp->xp_pattern_len; ++j) |
3682 if (ccline.cmdbuff[i + j] == '*' | 3677 if (ccline.cmdbuff[i + j] == '*' |
3683 || ccline.cmdbuff[i + j] == '?') | 3678 || ccline.cmdbuff[i + j] == '?') |
3684 break; | 3679 break; |
3685 if ((int)STRLEN(p2) < j) | 3680 if ((int)STRLEN(p2) < j) |
3686 { | 3681 VIM_CLEAR(p2); |
3687 vim_free(p2); | |
3688 p2 = NULL; | |
3689 } | |
3690 } | 3682 } |
3691 } | 3683 } |
3692 } | 3684 } |
3693 | 3685 |
3694 if (p2 != NULL && !got_int) | 3686 if (p2 != NULL && !got_int) |
3830 /* free old names */ | 3822 /* free old names */ |
3831 if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST) | 3823 if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST) |
3832 { | 3824 { |
3833 FreeWild(xp->xp_numfiles, xp->xp_files); | 3825 FreeWild(xp->xp_numfiles, xp->xp_files); |
3834 xp->xp_numfiles = -1; | 3826 xp->xp_numfiles = -1; |
3835 vim_free(orig_save); | 3827 VIM_CLEAR(orig_save); |
3836 orig_save = NULL; | |
3837 } | 3828 } |
3838 findex = 0; | 3829 findex = 0; |
3839 | 3830 |
3840 if (mode == WILD_FREE) /* only release file name */ | 3831 if (mode == WILD_FREE) /* only release file name */ |
3841 return NULL; | 3832 return NULL; |
6735 if (merge) | 6726 if (merge) |
6736 merge_history(type); | 6727 merge_history(type); |
6737 else | 6728 else |
6738 concat_history(type); | 6729 concat_history(type); |
6739 | 6730 |
6740 vim_free(viminfo_history[type]); | 6731 VIM_CLEAR(viminfo_history[type]); |
6741 viminfo_history[type] = NULL; | |
6742 viminfo_hisidx[type] = 0; | 6732 viminfo_hisidx[type] = 0; |
6743 } | 6733 } |
6744 } | 6734 } |
6745 | 6735 |
6746 /* | 6736 /* |
6860 } | 6850 } |
6861 } | 6851 } |
6862 for (i = 0; i < viminfo_hisidx[type]; ++i) | 6852 for (i = 0; i < viminfo_hisidx[type]; ++i) |
6863 if (viminfo_history[type] != NULL) | 6853 if (viminfo_history[type] != NULL) |
6864 vim_free(viminfo_history[type][i].hisstr); | 6854 vim_free(viminfo_history[type][i].hisstr); |
6865 vim_free(viminfo_history[type]); | 6855 VIM_CLEAR(viminfo_history[type]); |
6866 viminfo_history[type] = NULL; | |
6867 viminfo_hisidx[type] = 0; | 6856 viminfo_hisidx[type] = 0; |
6868 } | 6857 } |
6869 } | 6858 } |
6870 #endif /* FEAT_VIMINFO */ | 6859 #endif /* FEAT_VIMINFO */ |
6871 | 6860 |