X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=edit.c;h=352ae49bd5630ec1c414ea0b048e0aa0cca0d5dd;hb=978de1f80f0d0ac1dfee83a8f6cb4cb89220e32a;hp=0d14512d789706b68c7075adcaba717af230711c;hpb=878783c290ace81f4b86ba2d2d5406d69f367421;p=pkg%2Fabook.git diff --git a/edit.c b/edit.c index 0d14512..352ae49 100644 --- a/edit.c +++ b/edit.c @@ -130,7 +130,7 @@ print_editor_header(int item) if( *database[item][EMAIL] ) snprintf(header, EDITW_COLS, "%s <%s>", database[item][NAME], - database[item][EMAIL]); + email); else snprintf(header, EDITW_COLS, "%s", database[item][NAME]); @@ -146,8 +146,9 @@ static void editor_print_data(int tab, int item) { const int pos_x = EDITW_COLS > 70 ? 8:4; - const int start_y = 4; + const int start_y = 5; int i, j; + int y, x; for(i = 0, j = 1; i < ITEM_FIELDS; i++) { if(abook_fields[i].tab != tab) @@ -157,18 +158,26 @@ editor_print_data(int tab, int item) int k; char emails[MAX_EMAILS][MAX_EMAIL_LEN]; split_emailstr(item, emails); - mvwaddstr(editw, 6, pos_x, "E-mail addresses:"); - for(k=0; k < MAX_EMAILS; k++) - mvwprintw(editw, 7 + k, pos_x, + getyx(editw, y, x); + mvwaddstr(editw, y+1, pos_x, "E-mail addresses:"); + for(k = 0; k < MAX_EMAILS; k++) { + getyx(editw, y, x); + mvwprintw(editw, y+1, pos_x, "%c -\t\t%s", '2' + k, emails[k] ); + } continue; } - mvwprintw(editw, start_y + j, pos_x, "%d - %s", + if(j > 1) { + getyx(editw, y, x); y++; + } else + y = start_y; + + mvwprintw(editw, y, pos_x, "%d - %s", j, abook_fields[i].name); - mvwaddch(editw, start_y + j, 28, ':'); - mvwaddstr(editw, start_y + j, 30, safe_str(database[item][i])); + mvwaddch(editw, y, 28, ':'); + mvwaddstr(editw, y, 30, safe_str(database[item][i])); j++; } @@ -381,8 +390,8 @@ edit_loop(int item) case 'r': roll_emails(item); break; case '?': display_help(HELP_EDITOR); break; case 'u': edit_undo(item, RESTORE_ITEM); break; - case 'm': launch_mutt(item); break; - case 'v': launch_wwwbrowser(item); break; + case 'm': launch_mutt(item); clearok(stdscr, 1); break; + case 'v': launch_wwwbrowser(item); clearok(stdscr, 1); break; case 12 : clearok(stdscr, 1); break; /* ^L (refresh screen) */ default: return edit_field(tab, c, item) ? item : -1; }