Encapsulate a curses function to reduce dependencies.
{
// we have a single letter within parentheses
mutt_curses_set_color(MT_COLOR_OPTIONS);
- addch(cur[1]);
+ mutt_window_addch(cur[1]);
prompt = cur + 3;
}
else
{
// we have a parenthesis followed by something else
- addch(cur[0]);
+ mutt_window_addch(cur[0]);
prompt = cur + 1;
}
}
addstr(prompt);
mutt_curses_set_color(MT_COLOR_NORMAL);
- addch(' ');
+ mutt_window_addch(' ');
mutt_window_clrtoeol(MuttMessageWindow);
}
}
}
while (n-- > 0)
- addch(' ');
+ mutt_window_addch(' ');
}
/**
if (!fp)
{
addstr(strerror(errno));
- addch('\n');
+ mutt_window_addch('\n');
return -1;
}
for (int i = 0; i < buflen; i++)
tmp[0] = '\0';
mutt_addrlist_write(tmp, sizeof(tmp), &env->to, true);
addstr(tmp);
- addch('\n');
+ mutt_window_addch('\n');
}
if (!TAILQ_EMPTY(&env->cc))
{
tmp[0] = '\0';
mutt_addrlist_write(tmp, sizeof(tmp), &env->cc, true);
addstr(tmp);
- addch('\n');
+ mutt_window_addch('\n');
}
if (!TAILQ_EMPTY(&env->bcc))
{
tmp[0] = '\0';
mutt_addrlist_write(tmp, sizeof(tmp), &env->bcc, true);
addstr(tmp);
- addch('\n');
+ mutt_window_addch('\n');
}
if (env->subject)
{
addstr("Subject: ");
addstr(env->subject);
- addch('\n');
+ mutt_window_addch('\n');
}
- addch('\n');
+ mutt_window_addch('\n');
}
/**
mutt_addrlist_to_intl(&e->to, NULL); /* XXX - IDNA error reporting? */
addstr(tmp);
}
- addch('\n');
+ mutt_window_addch('\n');
if (!e->subject || force)
{
mutt_str_strfcpy(tmp, e->subject ? e->subject : "", sizeof(tmp));
if (mutt_enter_string(tmp, sizeof(tmp), 9, MUTT_COMP_NO_FLAGS) == 0)
mutt_str_replace(&e->subject, tmp);
- addch('\n');
+ mutt_window_addch('\n');
}
if ((TAILQ_EMPTY(&e->cc) && C_Askcc) || force)
}
else
mutt_addrlist_to_intl(&e->cc, NULL);
- addch('\n');
+ mutt_window_addch('\n');
}
if (C_Askbcc || force)
}
else
mutt_addrlist_to_intl(&e->bcc, NULL);
- addch('\n');
+ mutt_window_addch('\n');
}
}
tmp[0] = '\0';
continue;
}
- addch('\n');
+ mutt_window_addch('\n');
if (C_Escape && (tmp[0] == C_Escape[0]) && (tmp[1] != C_Escape[0]))
{
{
case MUTT_TREE_LLCORNER:
if (C_AsciiChars)
- addch('`');
+ mutt_window_addch('`');
#ifdef WACS_LLCORNER
else
add_wch(WACS_LLCORNER);
else if (CharsetIsUtf8)
addstr("\342\224\224"); /* WACS_LLCORNER */
else
- addch(ACS_LLCORNER);
+ mutt_window_addch(ACS_LLCORNER);
#endif
break;
case MUTT_TREE_ULCORNER:
if (C_AsciiChars)
- addch(',');
+ mutt_window_addch(',');
#ifdef WACS_ULCORNER
else
add_wch(WACS_ULCORNER);
else if (CharsetIsUtf8)
addstr("\342\224\214"); /* WACS_ULCORNER */
else
- addch(ACS_ULCORNER);
+ mutt_window_addch(ACS_ULCORNER);
#endif
break;
case MUTT_TREE_LTEE:
if (C_AsciiChars)
- addch('|');
+ mutt_window_addch('|');
#ifdef WACS_LTEE
else
add_wch(WACS_LTEE);
else if (CharsetIsUtf8)
addstr("\342\224\234"); /* WACS_LTEE */
else
- addch(ACS_LTEE);
+ mutt_window_addch(ACS_LTEE);
#endif
break;
case MUTT_TREE_HLINE:
if (C_AsciiChars)
- addch('-');
+ mutt_window_addch('-');
#ifdef WACS_HLINE
else
add_wch(WACS_HLINE);
else if (CharsetIsUtf8)
addstr("\342\224\200"); /* WACS_HLINE */
else
- addch(ACS_HLINE);
+ mutt_window_addch(ACS_HLINE);
#endif
break;
case MUTT_TREE_VLINE:
if (C_AsciiChars)
- addch('|');
+ mutt_window_addch('|');
#ifdef WACS_VLINE
else
add_wch(WACS_VLINE);
else if (CharsetIsUtf8)
addstr("\342\224\202"); /* WACS_VLINE */
else
- addch(ACS_VLINE);
+ mutt_window_addch(ACS_VLINE);
#endif
break;
case MUTT_TREE_TTEE:
if (C_AsciiChars)
- addch('-');
+ mutt_window_addch('-');
#ifdef WACS_TTEE
else
add_wch(WACS_TTEE);
else if (CharsetIsUtf8)
addstr("\342\224\254"); /* WACS_TTEE */
else
- addch(ACS_TTEE);
+ mutt_window_addch(ACS_TTEE);
#endif
break;
case MUTT_TREE_BTEE:
if (C_AsciiChars)
- addch('-');
+ mutt_window_addch('-');
#ifdef WACS_BTEE
else
add_wch(WACS_BTEE);
else if (CharsetIsUtf8)
addstr("\342\224\264"); /* WACS_BTEE */
else
- addch(ACS_BTEE);
+ mutt_window_addch(ACS_BTEE);
#endif
break;
case MUTT_TREE_SPACE:
- addch(' ');
+ mutt_window_addch(' ');
break;
case MUTT_TREE_RARROW:
- addch('>');
+ mutt_window_addch('>');
break;
case MUTT_TREE_STAR:
- addch('*'); /* fake thread indicator */
+ mutt_window_addch('*'); /* fake thread indicator */
break;
case MUTT_TREE_HIDDEN:
- addch('&');
+ mutt_window_addch('&');
break;
case MUTT_TREE_EQUALS:
- addch('=');
+ mutt_window_addch('=');
break;
case MUTT_TREE_MISSING:
- addch('?');
+ mutt_window_addch('?');
break;
}
s++;
{
addstr("->");
mutt_curses_set_attr(attr);
- addch(' ');
+ mutt_window_addch(' ');
}
else
do_color = false;
{
addstr("->");
mutt_curses_set_attr(attr);
- addch(' ');
+ mutt_window_addch(' ');
menu_pad_string(menu, buf, sizeof(buf));
print_enriched_string(menu->current, attr, (unsigned char *) buf, true);
}
else
return width;
}
+
+/**
+ * mutt_window_addch - Write one character to a Window
+ * @param ch Character to write
+ * @retval 0 Success
+ * @retval -1 Error
+ */
+int mutt_window_addch(int ch)
+{
+ return addch(ch);
+}
#endif
extern struct MuttWindow *MuttStatusWindow;
-void mutt_window_clearline (struct MuttWindow *win, int row);
-void mutt_window_clrtoeol (struct MuttWindow *win);
+// Functions that deal with the Window
void mutt_window_copy_size (const struct MuttWindow *win_src, struct MuttWindow *win_dst);
void mutt_window_free (struct MuttWindow **ptr);
void mutt_window_free_all (void);
void mutt_window_getxy (struct MuttWindow *win, int *x, int *y);
void mutt_window_init (void);
-int mutt_window_move (struct MuttWindow *win, int row, int col);
-int mutt_window_mvaddstr (struct MuttWindow *win, int row, int col, const char *str);
-int mutt_window_mvprintw (struct MuttWindow *win, int row, int col, const char *fmt, ...);
struct MuttWindow *mutt_window_new (void);
void mutt_window_reflow (void);
void mutt_window_reflow_message_rows(int mw_rows);
int mutt_window_wrap_cols (int width, short wrap);
+// Functions for drawing on the Window
+int mutt_window_addch (int ch);
+void mutt_window_clearline(struct MuttWindow *win, int row);
+void mutt_window_clrtoeol (struct MuttWindow *win);
+int mutt_window_move (struct MuttWindow *win, int row, int col);
+int mutt_window_mvaddstr (struct MuttWindow *win, int row, int col, const char *str);
+int mutt_window_mvprintw (struct MuttWindow *win, int row, int col, const char *fmt, ...);
+
#endif /* MUTT_MUTT_WINDOW_H */
if (!cnt && C_Markers)
{
mutt_curses_set_color(MT_COLOR_MARKERS);
- addch('+');
+ mutt_window_addch('+');
last_color = ColorDefs[MT_COLOR_MARKERS];
}
m = (line_info[n].syntax)[0].first;
break;
if (pa)
for (; col < t; col++)
- addch(' ');
+ mutt_window_addch(' ');
else
col = t;
}
break;
col += k;
if (pa)
- addch(ReplacementChar);
+ mutt_window_addch(ReplacementChar);
}
}
*pspace = space;
if (col == 0)
{
mutt_curses_set_color(MT_COLOR_NORMAL);
- addch(' ');
+ mutt_window_addch(' ');
}
#endif
resolve_color(*line_info, n, vch, flags, 0, &a);
/* Fill the blank space at the end of the line with the prevailing color.
- * ncurses does an implicit clrtoeol() when you do addch('\n') so we have
+ * ncurses does an implicit clrtoeol() when you do mutt_window_addch('\n') so we have
* to make sure to reset the color *after* that */
if (flags & MUTT_SHOWCOLOR)
{
{
mutt_window_clrtoeol(rd->pager_window);
if (C_Tilde)
- addch('~');
+ mutt_window_addch('~');
rd->lines++;
mutt_window_move(rd->pager_window, rd->lines, 0);
}
#include "curs_lib.h"
#include "mutt_curses.h"
#include "mutt_logging.h"
+#include "mutt_window.h"
#include "muttlib.h"
#include "options.h"
w -= l;
while (w-- > 0)
{
- addch(' ');
+ mutt_window_addch(' ');
}
mutt_curses_set_color(MT_COLOR_NORMAL);
}
addstr(NONULL(C_SidebarDividerChar));
break;
case SB_DIV_ASCII:
- addch('|');
+ mutt_window_addch('|');
break;
case SB_DIV_UTF8:
- addch(ACS_VLINE);
+ mutt_window_addch(ACS_VLINE);
break;
}
}
mutt_window_move(MuttSidebarWindow, first_row + r, div_width);
for (int i = 0; i < num_cols; i++)
- addch(' ');
+ mutt_window_addch(' ');
}
}