Mercurial > vim
comparison src/usercmd.c @ 20043:d13f8ae3b1de v8.2.0577
patch 8.2.0577: not all modifiers supported for :options
Commit: https://github.com/vim/vim/commit/7a1637f4c00ac3d0cbf894803ada1586a1717470
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 13 21:16:21 2020 +0200
patch 8.2.0577: not all modifiers supported for :options
Problem: Not all modifiers supported for :options.
Solution: Use all cmdmod.split flags. (closes https://github.com/vim/vim/issues/4401)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 13 Apr 2020 21:30:36 +0200 |
parents | 847cc7932c42 |
children | 336483164ca6 |
comparison
equal
deleted
inserted
replaced
20042:7573d650a983 | 20043:d13f8ae3b1de |
---|---|
1232 | 1232 |
1233 return result; | 1233 return result; |
1234 } | 1234 } |
1235 | 1235 |
1236 /* | 1236 /* |
1237 * Add modifiers from "cmdmod.split" to "buf". Set "multi_mods" when one was | |
1238 * added. Return the number of bytes added. | |
1239 */ | |
1240 size_t | |
1241 add_win_cmd_modifers(char_u *buf, int *multi_mods) | |
1242 { | |
1243 size_t result = 0; | |
1244 | |
1245 // :aboveleft and :leftabove | |
1246 if (cmdmod.split & WSP_ABOVE) | |
1247 result += add_cmd_modifier(buf, "aboveleft", multi_mods); | |
1248 // :belowright and :rightbelow | |
1249 if (cmdmod.split & WSP_BELOW) | |
1250 result += add_cmd_modifier(buf, "belowright", multi_mods); | |
1251 // :botright | |
1252 if (cmdmod.split & WSP_BOT) | |
1253 result += add_cmd_modifier(buf, "botright", multi_mods); | |
1254 | |
1255 // :tab | |
1256 if (cmdmod.tab > 0) | |
1257 result += add_cmd_modifier(buf, "tab", multi_mods); | |
1258 // :topleft | |
1259 if (cmdmod.split & WSP_TOP) | |
1260 result += add_cmd_modifier(buf, "topleft", multi_mods); | |
1261 // :vertical | |
1262 if (cmdmod.split & WSP_VERT) | |
1263 result += add_cmd_modifier(buf, "vertical", multi_mods); | |
1264 return result; | |
1265 } | |
1266 | |
1267 /* | |
1237 * Check for a <> code in a user command. | 1268 * Check for a <> code in a user command. |
1238 * "code" points to the '<'. "len" the length of the <> (inclusive). | 1269 * "code" points to the '<'. "len" the length of the <> (inclusive). |
1239 * "buf" is where the result is to be added. | 1270 * "buf" is where the result is to be added. |
1240 * "split_buf" points to a buffer used for splitting, caller should free it. | 1271 * "split_buf" points to a buffer used for splitting, caller should free it. |
1241 * "split_len" is the length of what "split_buf" contains. | 1272 * "split_len" is the length of what "split_buf" contains. |
1449 if (quote) | 1480 if (quote) |
1450 *buf++ = '"'; | 1481 *buf++ = '"'; |
1451 *buf = '\0'; | 1482 *buf = '\0'; |
1452 } | 1483 } |
1453 | 1484 |
1454 // :aboveleft and :leftabove | |
1455 if (cmdmod.split & WSP_ABOVE) | |
1456 result += add_cmd_modifier(buf, "aboveleft", &multi_mods); | |
1457 // :belowright and :rightbelow | |
1458 if (cmdmod.split & WSP_BELOW) | |
1459 result += add_cmd_modifier(buf, "belowright", &multi_mods); | |
1460 // :botright | |
1461 if (cmdmod.split & WSP_BOT) | |
1462 result += add_cmd_modifier(buf, "botright", &multi_mods); | |
1463 | |
1464 // the modifiers that are simple flags | 1485 // the modifiers that are simple flags |
1465 for (i = 0; mod_entries[i].varp != NULL; ++i) | 1486 for (i = 0; mod_entries[i].varp != NULL; ++i) |
1466 if (*mod_entries[i].varp) | 1487 if (*mod_entries[i].varp) |
1467 result += add_cmd_modifier(buf, mod_entries[i].name, | 1488 result += add_cmd_modifier(buf, mod_entries[i].name, |
1468 &multi_mods); | 1489 &multi_mods); |
1473 #endif | 1494 #endif |
1474 // :silent | 1495 // :silent |
1475 if (msg_silent > 0) | 1496 if (msg_silent > 0) |
1476 result += add_cmd_modifier(buf, | 1497 result += add_cmd_modifier(buf, |
1477 emsg_silent > 0 ? "silent!" : "silent", &multi_mods); | 1498 emsg_silent > 0 ? "silent!" : "silent", &multi_mods); |
1478 // :tab | |
1479 if (cmdmod.tab > 0) | |
1480 result += add_cmd_modifier(buf, "tab", &multi_mods); | |
1481 // :topleft | |
1482 if (cmdmod.split & WSP_TOP) | |
1483 result += add_cmd_modifier(buf, "topleft", &multi_mods); | |
1484 // TODO: How to support :unsilent? | 1499 // TODO: How to support :unsilent? |
1485 // :verbose | 1500 // :verbose |
1486 if (p_verbose > 0) | 1501 if (p_verbose > 0) |
1487 result += add_cmd_modifier(buf, "verbose", &multi_mods); | 1502 result += add_cmd_modifier(buf, "verbose", &multi_mods); |
1488 // :vertical | 1503 // flags from cmdmod.split |
1489 if (cmdmod.split & WSP_VERT) | 1504 result += add_win_cmd_modifers(buf, &multi_mods); |
1490 result += add_cmd_modifier(buf, "vertical", &multi_mods); | |
1491 if (quote && buf != NULL) | 1505 if (quote && buf != NULL) |
1492 { | 1506 { |
1493 buf += result - 2; | 1507 buf += result - 2; |
1494 *buf = '"'; | 1508 *buf = '"'; |
1495 } | 1509 } |