comparison src/usercmd.c @ 30904:8c7495056f35 v9.0.0786

patch 9.0.0786: user command does not get number from :tab modifier Commit: https://github.com/vim/vim/commit/208567e9d744ef7b89bed1f62e951ae4ee2f6f5f Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Oct 18 13:11:21 2022 +0100 patch 9.0.0786: user command does not get number from :tab modifier Problem: User command does not get number from :tab modifier. Solution: Include the number. (closes https://github.com/vim/vim/issues/11393, closes https://github.com/vim/vim/issues/6801)
author Bram Moolenaar <Bram@vim.org>
date Tue, 18 Oct 2022 14:15:08 +0200
parents 578e71f924fe
children 360f286b5869
comparison
equal deleted inserted replaced
30903:82279571d16f 30904:8c7495056f35
1434 if (cmod->cmod_split & WSP_BOT) 1434 if (cmod->cmod_split & WSP_BOT)
1435 result += add_cmd_modifier(buf, "botright", multi_mods); 1435 result += add_cmd_modifier(buf, "botright", multi_mods);
1436 1436
1437 // :tab 1437 // :tab
1438 if (cmod->cmod_tab > 0) 1438 if (cmod->cmod_tab > 0)
1439 result += add_cmd_modifier(buf, "tab", multi_mods); 1439 {
1440 int tabnr = cmod->cmod_tab - 1;
1441
1442 if (tabnr == tabpage_index(curtab))
1443 {
1444 // For compatibility, don't add a tabpage number if it is the same
1445 // as the default number for :tab.
1446 result += add_cmd_modifier(buf, "tab", multi_mods);
1447 }
1448 else
1449 {
1450 char tab_buf[NUMBUFLEN + 3];
1451
1452 sprintf(tab_buf, "%dtab", tabnr);
1453 result += add_cmd_modifier(buf, tab_buf, multi_mods);
1454 }
1455 }
1456
1440 // :topleft 1457 // :topleft
1441 if (cmod->cmod_split & WSP_TOP) 1458 if (cmod->cmod_split & WSP_TOP)
1442 result += add_cmd_modifier(buf, "topleft", multi_mods); 1459 result += add_cmd_modifier(buf, "topleft", multi_mods);
1443 // :vertical 1460 // :vertical
1444 if (cmod->cmod_split & WSP_VERT) 1461 if (cmod->cmod_split & WSP_VERT)