Mercurial > vim
comparison src/register.c @ 18436:6ec1bfb4690b v8.1.2212
patch 8.1.2212: cannot see the selection type in :reg output
Commit: https://github.com/vim/vim/commit/3691f1ee72b68a47e6dcc75927bfa46565cf3614
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 24 20:17:00 2019 +0200
patch 8.1.2212: cannot see the selection type in :reg output
Problem: Cannot see the selection type in :reg output. (Ayberk Ayd?n)
Solution: Add c/l/b. (Christian Brabandt, closes https://github.com/vim/vim/issues/5110, closes https://github.com/vim/vim/issues/4546)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 24 Oct 2019 20:30:03 +0200 |
parents | 9f51d0cef8da |
children | b912277e3877 |
comparison
equal
deleted
inserted
replaced
18435:bdaf40503e2a | 18436:6ec1bfb4690b |
---|---|
2159 yankreg_T *yb; | 2159 yankreg_T *yb; |
2160 int name; | 2160 int name; |
2161 int attr; | 2161 int attr; |
2162 char_u *arg = eap->arg; | 2162 char_u *arg = eap->arg; |
2163 int clen; | 2163 int clen; |
2164 char_u type[2]; | |
2164 | 2165 |
2165 if (arg != NULL && *arg == NUL) | 2166 if (arg != NULL && *arg == NUL) |
2166 arg = NULL; | 2167 arg = NULL; |
2167 attr = HL_ATTR(HLF_8); | 2168 attr = HL_ATTR(HLF_8); |
2168 | 2169 |
2169 // Highlight title | 2170 // Highlight title |
2170 msg_puts_title(_("\n--- Registers ---")); | 2171 msg_puts_title(_("\nType Name Content")); |
2171 for (i = -1; i < NUM_REGISTERS && !got_int; ++i) | 2172 for (i = -1; i < NUM_REGISTERS && !got_int; ++i) |
2172 { | 2173 { |
2173 name = get_register_name(i); | 2174 name = get_register_name(i); |
2175 switch (get_reg_type(name, NULL)) | |
2176 { | |
2177 case MLINE: type[0] = 'l'; break; | |
2178 case MCHAR: type[0] = 'c'; break; | |
2179 default: type[0] = 'b'; break; | |
2180 } | |
2174 if (arg != NULL && vim_strchr(arg, name) == NULL | 2181 if (arg != NULL && vim_strchr(arg, name) == NULL |
2175 #ifdef ONE_CLIPBOARD | 2182 #ifdef ONE_CLIPBOARD |
2176 // Star register and plus register contain the same thing. | 2183 // Star register and plus register contain the same thing. |
2177 && (name != '*' || vim_strchr(arg, '+') == NULL) | 2184 && (name != '*' || vim_strchr(arg, '+') == NULL) |
2178 #endif | 2185 #endif |
2205 #endif | 2212 #endif |
2206 | 2213 |
2207 if (yb->y_array != NULL) | 2214 if (yb->y_array != NULL) |
2208 { | 2215 { |
2209 msg_putchar('\n'); | 2216 msg_putchar('\n'); |
2217 msg_puts(" "); | |
2218 msg_putchar(type[0]); | |
2219 msg_puts(" "); | |
2210 msg_putchar('"'); | 2220 msg_putchar('"'); |
2211 msg_putchar(name); | 2221 msg_putchar(name); |
2212 msg_puts(" "); | 2222 msg_puts(" "); |
2213 | 2223 |
2214 n = (int)Columns - 6; | 2224 n = (int)Columns - 11; |
2215 for (j = 0; j < yb->y_size && n > 1; ++j) | 2225 for (j = 0; j < yb->y_size && n > 1; ++j) |
2216 { | 2226 { |
2217 if (j) | 2227 if (j) |
2218 { | 2228 { |
2219 msg_puts_attr("^J", attr); | 2229 msg_puts_attr("^J", attr); |
2235 | 2245 |
2236 // display last inserted text | 2246 // display last inserted text |
2237 if ((p = get_last_insert()) != NULL | 2247 if ((p = get_last_insert()) != NULL |
2238 && (arg == NULL || vim_strchr(arg, '.') != NULL) && !got_int) | 2248 && (arg == NULL || vim_strchr(arg, '.') != NULL) && !got_int) |
2239 { | 2249 { |
2240 msg_puts("\n\". "); | 2250 msg_puts("\n c \". "); |
2241 dis_msg(p, TRUE); | 2251 dis_msg(p, TRUE); |
2242 } | 2252 } |
2243 | 2253 |
2244 // display last command line | 2254 // display last command line |
2245 if (last_cmdline != NULL && (arg == NULL || vim_strchr(arg, ':') != NULL) | 2255 if (last_cmdline != NULL && (arg == NULL || vim_strchr(arg, ':') != NULL) |
2246 && !got_int) | 2256 && !got_int) |
2247 { | 2257 { |
2248 msg_puts("\n\": "); | 2258 msg_puts("\n c \": "); |
2249 dis_msg(last_cmdline, FALSE); | 2259 dis_msg(last_cmdline, FALSE); |
2250 } | 2260 } |
2251 | 2261 |
2252 // display current file name | 2262 // display current file name |
2253 if (curbuf->b_fname != NULL | 2263 if (curbuf->b_fname != NULL |
2254 && (arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int) | 2264 && (arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int) |
2255 { | 2265 { |
2256 msg_puts("\n\"% "); | 2266 msg_puts("\n c \"% "); |
2257 dis_msg(curbuf->b_fname, FALSE); | 2267 dis_msg(curbuf->b_fname, FALSE); |
2258 } | 2268 } |
2259 | 2269 |
2260 // display alternate file name | 2270 // display alternate file name |
2261 if ((arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int) | 2271 if ((arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int) |
2263 char_u *fname; | 2273 char_u *fname; |
2264 linenr_T dummy; | 2274 linenr_T dummy; |
2265 | 2275 |
2266 if (buflist_name_nr(0, &fname, &dummy) != FAIL) | 2276 if (buflist_name_nr(0, &fname, &dummy) != FAIL) |
2267 { | 2277 { |
2268 msg_puts("\n\"# "); | 2278 msg_puts("\n c \"# "); |
2269 dis_msg(fname, FALSE); | 2279 dis_msg(fname, FALSE); |
2270 } | 2280 } |
2271 } | 2281 } |
2272 | 2282 |
2273 // display last search pattern | 2283 // display last search pattern |
2274 if (last_search_pat() != NULL | 2284 if (last_search_pat() != NULL |
2275 && (arg == NULL || vim_strchr(arg, '/') != NULL) && !got_int) | 2285 && (arg == NULL || vim_strchr(arg, '/') != NULL) && !got_int) |
2276 { | 2286 { |
2277 msg_puts("\n\"/ "); | 2287 msg_puts("\n c \"/ "); |
2278 dis_msg(last_search_pat(), FALSE); | 2288 dis_msg(last_search_pat(), FALSE); |
2279 } | 2289 } |
2280 | 2290 |
2281 #ifdef FEAT_EVAL | 2291 #ifdef FEAT_EVAL |
2282 // display last used expression | 2292 // display last used expression |
2283 if (expr_line != NULL && (arg == NULL || vim_strchr(arg, '=') != NULL) | 2293 if (expr_line != NULL && (arg == NULL || vim_strchr(arg, '=') != NULL) |
2284 && !got_int) | 2294 && !got_int) |
2285 { | 2295 { |
2286 msg_puts("\n\"= "); | 2296 msg_puts("\n c \"= "); |
2287 dis_msg(expr_line, FALSE); | 2297 dis_msg(expr_line, FALSE); |
2288 } | 2298 } |
2289 #endif | 2299 #endif |
2290 } | 2300 } |
2291 | 2301 |
2513 y_current = curr; | 2523 y_current = curr; |
2514 } | 2524 } |
2515 #endif | 2525 #endif |
2516 | 2526 |
2517 | 2527 |
2518 #if defined(FEAT_EVAL) || defined(PROTO) | |
2519 /* | 2528 /* |
2520 * Return the type of a register. | 2529 * Return the type of a register. |
2521 * Used for getregtype() | 2530 * Used for getregtype() |
2522 * Returns MAUTO for error. | 2531 * Returns MAUTO for error. |
2523 */ | 2532 */ |
2558 return y_current->y_type; | 2567 return y_current->y_type; |
2559 } | 2568 } |
2560 return MAUTO; | 2569 return MAUTO; |
2561 } | 2570 } |
2562 | 2571 |
2572 #if defined(FEAT_EVAL) || defined(PROTO) | |
2563 /* | 2573 /* |
2564 * When "flags" has GREG_LIST return a list with text "s". | 2574 * When "flags" has GREG_LIST return a list with text "s". |
2565 * Otherwise just return "s". | 2575 * Otherwise just return "s". |
2566 */ | 2576 */ |
2567 static char_u * | 2577 static char_u * |