Mercurial > vim
comparison src/popupmenu.c @ 19934:3ff714d765ba v8.2.0523
patch 8.2.0523: loops are repeated
Commit: https://github.com/vim/vim/commit/00d253e2b2f435a5386582c3f857008e7ac355c2
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 6 22:13:01 2020 +0200
patch 8.2.0523: loops are repeated
Problem: Loops are repeated.
Solution: Use FOR_ALL_ macros. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5882)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 06 Apr 2020 22:15:39 +0200 |
parents | 62ea983a9cb4 |
children | aadd1cae2ff5 |
comparison
equal
deleted
inserted
replaced
19933:005e707a7988 | 19934:3ff714d765ba |
---|---|
1377 { | 1377 { |
1378 vimmenu_T *mp; | 1378 vimmenu_T *mp; |
1379 int idx = 0; | 1379 int idx = 0; |
1380 exarg_T ea; | 1380 exarg_T ea; |
1381 | 1381 |
1382 for (mp = menu->children; mp != NULL; mp = mp->next) | 1382 FOR_ALL_CHILD_MENUS(menu, mp) |
1383 if ((mp->modes & mp->enabled & mode) && idx++ == pum_selected) | 1383 if ((mp->modes & mp->enabled & mode) && idx++ == pum_selected) |
1384 { | 1384 { |
1385 vim_memset(&ea, 0, sizeof(ea)); | 1385 vim_memset(&ea, 0, sizeof(ea)); |
1386 execute_menu(&ea, mp, -1); | 1386 execute_menu(&ea, mp, -1); |
1387 break; | 1387 break; |
1405 | 1405 |
1406 pum_undisplay(); | 1406 pum_undisplay(); |
1407 pum_size = 0; | 1407 pum_size = 0; |
1408 mode = get_menu_mode_flag(); | 1408 mode = get_menu_mode_flag(); |
1409 | 1409 |
1410 for (mp = menu->children; mp != NULL; mp = mp->next) | 1410 FOR_ALL_CHILD_MENUS(menu, mp) |
1411 if (menu_is_separator(mp->dname) | 1411 if (menu_is_separator(mp->dname) |
1412 || (mp->modes & mp->enabled & mode)) | 1412 || (mp->modes & mp->enabled & mode)) |
1413 ++pum_size; | 1413 ++pum_size; |
1414 | 1414 |
1415 // When there are only Terminal mode menus, using "popup Edit" results in | 1415 // When there are only Terminal mode menus, using "popup Edit" results in |
1422 | 1422 |
1423 array = ALLOC_CLEAR_MULT(pumitem_T, pum_size); | 1423 array = ALLOC_CLEAR_MULT(pumitem_T, pum_size); |
1424 if (array == NULL) | 1424 if (array == NULL) |
1425 return; | 1425 return; |
1426 | 1426 |
1427 for (mp = menu->children; mp != NULL; mp = mp->next) | 1427 FOR_ALL_CHILD_MENUS(menu, mp) |
1428 if (menu_is_separator(mp->dname)) | 1428 if (menu_is_separator(mp->dname)) |
1429 array[idx++].pum_text = (char_u *)""; | 1429 array[idx++].pum_text = (char_u *)""; |
1430 else if (mp->modes & mp->enabled & mode) | 1430 else if (mp->modes & mp->enabled & mode) |
1431 array[idx++].pum_text = mp->dname; | 1431 array[idx++].pum_text = mp->dname; |
1432 | 1432 |