Mercurial > vim
comparison src/menu.c @ 928:03c4ceec6bec v7.0.054
updated for version 7.0-054
author | vimboss |
---|---|
date | Wed, 16 Aug 2006 13:55:16 +0000 |
parents | 2fe516aa3710 |
children | 77f8a648d2e6 |
comparison
equal
deleted
inserted
replaced
927:6632670ff6fc | 928:03c4ceec6bec |
---|---|
509 { | 509 { |
510 /* Get name of this element in the menu hierarchy, and the simplified | 510 /* Get name of this element in the menu hierarchy, and the simplified |
511 * name (without mnemonic and accelerator text). */ | 511 * name (without mnemonic and accelerator text). */ |
512 next_name = menu_name_skip(name); | 512 next_name = menu_name_skip(name); |
513 dname = menu_text(name, NULL, NULL); | 513 dname = menu_text(name, NULL, NULL); |
514 if (dname == NULL) | |
515 goto erret; | |
516 if (*dname == NUL) | |
517 { | |
518 /* Only a mnemonic or accelerator is not valid. */ | |
519 EMSG(_("E792: Empty menu name")); | |
520 goto erret; | |
521 } | |
514 | 522 |
515 /* See if it's already there */ | 523 /* See if it's already there */ |
516 lower_pri = menup; | 524 lower_pri = menup; |
517 #ifdef FEAT_GUI | 525 #ifdef FEAT_GUI |
518 idx = 0; | 526 idx = 0; |
702 | 710 |
703 menup = &menu->children; | 711 menup = &menu->children; |
704 parent = menu; | 712 parent = menu; |
705 name = next_name; | 713 name = next_name; |
706 vim_free(dname); | 714 vim_free(dname); |
715 dname = NULL; | |
707 if (pri_tab[pri_idx + 1] != -1) | 716 if (pri_tab[pri_idx + 1] != -1) |
708 ++pri_idx; | 717 ++pri_idx; |
709 } | 718 } |
710 vim_free(path_name); | 719 vim_free(path_name); |
711 | 720 |
791 return OK; | 800 return OK; |
792 | 801 |
793 erret: | 802 erret: |
794 vim_free(path_name); | 803 vim_free(path_name); |
795 vim_free(dname); | 804 vim_free(dname); |
805 | |
806 /* Delete any empty submenu we added before discovering the error. Repeat | |
807 * for higher levels. */ | |
808 while (parent != NULL && parent->children == NULL) | |
809 { | |
810 if (parent->parent == NULL) | |
811 menup = &root_menu; | |
812 else | |
813 menup = &parent->parent->children; | |
814 for ( ; *menup != NULL && *menup != parent; menup = &((*menup)->next)) | |
815 ; | |
816 if (*menup == NULL) /* safety check */ | |
817 break; | |
818 parent = parent->parent; | |
819 free_menu(menup); | |
820 } | |
796 return FAIL; | 821 return FAIL; |
797 } | 822 } |
798 | 823 |
799 /* | 824 /* |
800 * Set the (sub)menu with the given name to enabled or disabled. | 825 * Set the (sub)menu with the given name to enabled or disabled. |