X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=estr.c;h=93c2290d94c3ebd21d038386c485ff06bcd10832;hb=b8966ec4ee3c9d035850ff49aaf5485081fe0d20;hp=2b3a1ef57b8b97d4a42d32a64860ed0c8d058de1;hpb=a4dcb3a047fd723dd279d5cfd6095c3705af79fa;p=pkg%2Fabook.git diff --git a/estr.c b/estr.c index 2b3a1ef..93c2290 100644 --- a/estr.c +++ b/estr.c @@ -81,13 +81,13 @@ wenter_string(WINDOW *win, const int maxlen, const int flags) str = MALLOC(size); for( ;; ) { /* main loop */ - if(flags & ESTR_DONT_WRAP && x+i>COLS-2) { + if(flags & ESTR_DONT_WRAP && x+i > COLS-2) { mvwaddnstr(win, y, x, str+(1+x+i-COLS), COLS-x-1); wmove(win, y, COLS-1); - wclrtoeol(win); } else wmove(win, y, x + i); + wclrtoeol(win); wrefresh(win); switch( (ch = getch()) ) { @@ -103,6 +103,9 @@ wenter_string(WINDOW *win, const int maxlen, const int flags) case CANCEL_KEY: free(str); return NULL; + case XCTRL('u'): + i = 0; + break; #ifdef USE_FILESEL case TAB_KEY: if( ! (flags & ESTR_USE_FILESEL) ) @@ -118,10 +121,8 @@ wenter_string(WINDOW *win, const int maxlen, const int flags) continue; str[i++] = ch; waddch(win,ch); - if( i + 1 > size ) + if( i + 1 >= size ) str = REALLOC( str, size *= 2 ); - if( maxlen > 0 && i > maxlen) - break; } out: if( i >= 0 && str != NULL ) @@ -356,8 +357,12 @@ filesel_highlight_line(WINDOW *win, int line) static void filesel_print_list_line(int i, int line) { - if( lst[i].type == FLSL_TYPE_DIR ) + if( lst[i].type == FLSL_TYPE_DIR ) { + mvwaddch(filesel_list, line, 3, 'd'); +#ifdef A_BOLD wattron(filesel_list, A_BOLD); +#endif + } mvwaddnstr(filesel_list, line, 5, lst[i].filename, COLS - 5); }