X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-ui%2Fenter.c;h=7fb61cc20320bc1a05d6c9c56837f0cbc414528d;hp=3eb1f134f9723425939b6d80f12c9f2eb6fbd928;hb=16be8d10413bbcf822577afd4019d65aba7459e0;hpb=4a0b020a3048f079979bea43c04f9fe388f9354d diff --git a/lib-ui/enter.c b/lib-ui/enter.c index 3eb1f13..7fb61cc 100644 --- a/lib-ui/enter.c +++ b/lib-ui/enter.c @@ -8,24 +8,17 @@ * please see the file GPL in the top level source directory. */ -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include +#include -#include "curses.h" #include "enter.h" #include "menu.h" #include "mutt.h" +#include "alias.h" #include "keymap.h" #include "history.h" #include "buffy.h" - -#include - /* redraw flags for mutt_enter_string() */ enum { M_REDRAW_INIT = 1, /* go to end of line and redraw */ @@ -36,7 +29,7 @@ static int my_wcwidth (wchar_t wc) { int n = wcwidth (wc); - if (IsWPrint (wc) && n > 0) + if (iswprint(wc) && n > 0) return n; if (!(wc & ~0x7f)) return 2; @@ -46,7 +39,7 @@ static int my_wcwidth (wchar_t wc) } /* combining mark / non-spacing character */ -#define COMB_CHAR(wc) (IsWPrint (wc) && !wcwidth (wc)) +#define COMB_CHAR(wc) (iswprint(wc) && !wcwidth(wc)) static int my_wcswidth (const wchar_t * s, size_t n) { @@ -61,13 +54,13 @@ static int my_addwch (wchar_t wc) { int n = wcwidth (wc); - if (IsWPrint (wc) && n > 0) - return mutt_addwch (wc); + if (iswprint(wc) && n > 0) + return waddwch(stdscr, wc); if (!(wc & ~0x7f)) - return printw ("^%c", ((int) wc + 0x40) & 0x7f); + return wprintw (stdscr, "^%c", ((int) wc + 0x40) & 0x7f); if (!(wc & ~0xffff)) - return printw ("\\u%04x", (int) wc); - return printw ("\\u%08x", (int) wc); + return wprintw (stdscr, "\\u%04x", (int) wc); + return wprintw (stdscr, "\\u%08x", (int) wc); } static size_t width_ceiling (const wchar_t * s, size_t n, int w1) @@ -121,7 +114,7 @@ static void my_wcstombs (char *dest, ssize_t dlen, const wchar_t * src, } } -size_t my_mbstowcs (wchar_t ** pwbuf, size_t * pwbuflen, size_t i, const char *buf) +static size_t my_mbstowcs (wchar_t ** pwbuf, size_t * pwbuflen, size_t i, const char *buf) { wchar_t wc; mbstate_t st; @@ -183,7 +176,7 @@ int mutt_enter_string (char *buf, size_t buflen, int y, int x, int flags) int rv; ENTER_STATE *es = mutt_new_enter_state (); - rv = _mutt_enter_string (buf, buflen, y, x, flags, 0, NULL, NULL, es); + rv = _mutt_enter_string(buf, buflen, y, x, flags, 0, NULL, NULL, es); mutt_free_enter_state (&es); return rv; } @@ -249,7 +242,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, width_ceiling (state->wbuf, state->lastchar, my_wcswidth (state->wbuf, state->curpos) - width / 2); - move (y, x); + wmove (stdscr, y, x); w = 0; for (i = state->begin; i < state->lastchar; i++) { w += my_wcwidth (state->wbuf[i]); @@ -257,10 +250,10 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, break; my_addwch (state->wbuf[i]); } - clrtoeol (); - move (y, - x + my_wcswidth (state->wbuf + state->begin, - state->curpos - state->begin)); + wclrtoeol (stdscr); + wmove (stdscr, y, + x + my_wcswidth (state->wbuf + state->begin, + state->curpos - state->begin)); } mutt_refresh (); @@ -461,8 +454,8 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, if (tempbuf && templen == state->lastchar - i && !memcmp (tempbuf, state->wbuf + i, (state->lastchar - i) * sizeof (wchar_t))) { - mutt_select_file (buf, buflen, - (flags & M_EFILE) ? M_SEL_FOLDER : 0); + mutt_select_file(buf, buflen, flags & M_EFILE ? M_SEL_FOLDER : 0, + NULL, NULL); set_option (OPTNEEDREDRAW); if (*buf) replace_part (state, i, buf); @@ -520,9 +513,9 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, || (tempbuf && templen == state->lastchar && !memcmp (tempbuf, state->wbuf, state->lastchar * sizeof (wchar_t)))) { - _mutt_select_file (buf, buflen, - ((flags & M_EFILE) ? M_SEL_FOLDER : 0) | - (multiple ? M_SEL_MULTI : 0), files, numfiles); + mutt_select_file(buf, buflen, + ((flags & M_EFILE) ? M_SEL_FOLDER : 0) | + (multiple ? M_SEL_MULTI : 0), files, numfiles); set_option (OPTNEEDREDRAW); if (*buf) { mutt_pretty_mailbox (buf); @@ -624,7 +617,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, if (first && (flags & M_CLEAR)) { first = 0; - if (IsWPrint (wc)) /* why? */ + if (iswprint(wc)) /* why? */ state->curpos = state->lastchar = 0; } @@ -646,7 +639,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, rv = 0; goto bye; } - else if (wc && (wc < ' ' || IsWPrint (wc))) { /* why? */ + else if (wc && (wc < ' ' || iswprint(wc))) { /* why? */ if (state->lastchar >= state->wbuflen) { state->wbuflen = state->lastchar + 20; p_realloc(&state->wbuf, state->wbuflen);