Mercurial > vim
comparison src/ex_getln.c @ 3316:7b17a38eb223 v7.3.425
updated for version 7.3.425
Problem: Search history lines are duplicated. (Edwin Steiner)
Solution: Convert separator character from space to NUL.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sat, 04 Feb 2012 22:44:32 +0100 |
parents | 821c8be2e9d6 |
children | 9ccdc4a69d8f |
comparison
equal
deleted
inserted
replaced
3315:bd2542a2faa2 | 3316:7b17a38eb223 |
---|---|
6025 if (viminfo_hisidx[type] < viminfo_hislen[type]) | 6025 if (viminfo_hisidx[type] < viminfo_hislen[type]) |
6026 { | 6026 { |
6027 val = viminfo_readstring(virp, 1, TRUE); | 6027 val = viminfo_readstring(virp, 1, TRUE); |
6028 if (val != NULL && *val != NUL) | 6028 if (val != NULL && *val != NUL) |
6029 { | 6029 { |
6030 int sep = (*val == ' ' ? NUL : *val); | |
6031 | |
6030 if (!in_history(type, val + (type == HIST_SEARCH), | 6032 if (!in_history(type, val + (type == HIST_SEARCH), |
6031 viminfo_add_at_front, *val)) | 6033 viminfo_add_at_front, sep)) |
6032 { | 6034 { |
6033 /* Need to re-allocate to append the separator byte. */ | 6035 /* Need to re-allocate to append the separator byte. */ |
6034 len = STRLEN(val); | 6036 len = STRLEN(val); |
6035 p = lalloc(len + 2, TRUE); | 6037 p = lalloc(len + 2, TRUE); |
6036 if (p != NULL) | 6038 if (p != NULL) |
6038 if (type == HIST_SEARCH) | 6040 if (type == HIST_SEARCH) |
6039 { | 6041 { |
6040 /* Search entry: Move the separator from the first | 6042 /* Search entry: Move the separator from the first |
6041 * column to after the NUL. */ | 6043 * column to after the NUL. */ |
6042 mch_memmove(p, val + 1, (size_t)len); | 6044 mch_memmove(p, val + 1, (size_t)len); |
6043 p[len] = (*val == ' ' ? NUL : *val); | 6045 p[len] = sep; |
6044 } | 6046 } |
6045 else | 6047 else |
6046 { | 6048 { |
6047 /* Not a search entry: No separator in the viminfo | 6049 /* Not a search entry: No separator in the viminfo |
6048 * file, add a NUL separator. */ | 6050 * file, add a NUL separator. */ |