Mercurial > vim
comparison src/evalvars.c @ 20721:70d561931721 v8.2.0913
patch 8.2.0913: code for resetting v:register is duplicated
Commit: https://github.com/vim/vim/commit/439c036ed062de1c87cc7e3fe050a9569fb12089
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 6 15:58:03 2020 +0200
patch 8.2.0913: code for resetting v:register is duplicated
Problem: Code for resetting v:register is duplicated.
Solution: Add reset_reg_var().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 06 Jun 2020 16:00:04 +0200 |
parents | 8fa783f2c69c |
children | f4455c71a8aa |
comparison
equal
deleted
inserted
replaced
20720:9160c85995fc | 20721:70d561931721 |
---|---|
242 set_vim_var_nr(VV_TYPE_CHANNEL, VAR_TYPE_CHANNEL); | 242 set_vim_var_nr(VV_TYPE_CHANNEL, VAR_TYPE_CHANNEL); |
243 set_vim_var_nr(VV_TYPE_BLOB, VAR_TYPE_BLOB); | 243 set_vim_var_nr(VV_TYPE_BLOB, VAR_TYPE_BLOB); |
244 | 244 |
245 set_vim_var_nr(VV_ECHOSPACE, sc_col - 1); | 245 set_vim_var_nr(VV_ECHOSPACE, sc_col - 1); |
246 | 246 |
247 set_reg_var(0); // default for v:register is not 0 but '"' | 247 // Default for v:register is not 0 but '"'. This is adjusted once the |
248 // clipboard has been setup by calling reset_reg_var(). | |
249 set_reg_var(0); | |
248 } | 250 } |
249 | 251 |
250 #if defined(EXITFREE) || defined(PROTO) | 252 #if defined(EXITFREE) || defined(PROTO) |
251 /* | 253 /* |
252 * Free all vim variables information on exit | 254 * Free all vim variables information on exit |
2190 } | 2192 } |
2191 set_vim_var_list(VV_ARGV, l); | 2193 set_vim_var_list(VV_ARGV, l); |
2192 } | 2194 } |
2193 | 2195 |
2194 /* | 2196 /* |
2197 * Reset v:register, taking the 'clipboard' setting into account. | |
2198 */ | |
2199 void | |
2200 reset_reg_var(void) | |
2201 { | |
2202 int regname = 0; | |
2203 | |
2204 // Adjust the register according to 'clipboard', so that when | |
2205 // "unnamed" is present it becomes '*' or '+' instead of '"'. | |
2206 #ifdef FEAT_CLIPBOARD | |
2207 adjust_clip_reg(®name); | |
2208 #endif | |
2209 set_reg_var(regname); | |
2210 } | |
2211 | |
2212 /* | |
2195 * Set v:register if needed. | 2213 * Set v:register if needed. |
2196 */ | 2214 */ |
2197 void | 2215 void |
2198 set_reg_var(int c) | 2216 set_reg_var(int c) |
2199 { | 2217 { |