X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=edit.c;h=2e773c39a201b86b3f1776094c862fe238413339;hb=d3c55f5a5fcd740475ae9a3195986b455465be69;hp=12028f8722d1191e4cc8bb91f6672e608afa0300;hpb=208968222b63ab08f95b0ad6d882cfc4ab22dda5;p=pkg%2Fabook.git diff --git a/edit.c b/edit.c index 12028f8..2e773c3 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,8 @@ print_editor_header(int item) else snprintf(header, EDITW_COLS, "%s", database[item][NAME]); - mvwaddstr(editw, 0, (EDITW_COLS - strlen(header)) / 2, + fprintf(stderr, "%d\n", strwidth(header)); + mvwaddstr(editw, 0, (EDITW_COLS - strwidth(header)) / 2, header); free(header); @@ -371,6 +373,8 @@ edit_undo(int item, int mode) my_free(backup); } break; + default: + assert(0); } } @@ -396,6 +400,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;