X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=edit.c;h=8a2e1e98f247f28fbd1068fc7f99cbbedb8cfaa8;hb=64990eb83b3bab7df8784b6ac1ef540016070e49;hp=12028f8722d1191e4cc8bb91f6672e608afa0300;hpb=208968222b63ab08f95b0ad6d882cfc4ab22dda5;p=pkg%2Fabook.git diff --git a/edit.c b/edit.c index 12028f8..8a2e1e9 100644 --- a/edit.c +++ b/edit.c @@ -9,6 +9,7 @@ #include #include +#include #include "abook_curses.h" #include "ui.h" #include "abook.h" @@ -33,11 +34,11 @@ extern int items; WINDOW *editw; static void -editor_tab(int tab) +editor_tab(const int tab) { int i; - int spacing = 12; - char *tab_names[] = { + const int spacing = 12; + static char *tab_names[] = { "CONTACT", "ADDRESS", " PHONE ", @@ -146,7 +147,7 @@ print_editor_header(int item) else snprintf(header, EDITW_COLS, "%s", database[item][NAME]); - mvwaddstr(editw, 0, (EDITW_COLS - strlen(header)) / 2, + mvwaddstr(editw, 0, (EDITW_COLS - strwidth(header)) / 2, header); free(header); @@ -371,6 +372,8 @@ edit_undo(int item, int mode) my_free(backup); } break; + default: + assert(0); } } @@ -396,6 +399,7 @@ edit_loop(int item) case 'a': tab = TAB_ADDRESS; break; case 'p': tab = TAB_PHONE; break; case 'o': tab = TAB_OTHER; break; + case 'C': tab = TAB_CUSTOM; break; case 'h': case KEY_LEFT: tab = tab == 0 ? MAX_TAB : tab - 1; break;