Print a line on screen.
979 unsigned char *buf = NULL, *fmt = NULL;
981 unsigned char *buf_ptr = NULL;
982 int ch, vch, col, cnt, b_read;
984 bool change_last =
false;
991 regmatch_t pmatch[1];
993 if (line_num == *lines_used)
999 if (*lines_used == *lines_max)
1002 for (ch = *lines_used; ch < *lines_max; ch++)
1004 memset(&((*lines)[ch]), 0,
sizeof(
struct Line));
1005 (*lines)[ch].cid = -1;
1006 (*lines)[ch].search_arr_size = -1;
1008 ((*lines)[ch].syntax)[0].first = -1;
1009 ((*lines)[ch].syntax)[0].last = -1;
1013 struct Line *
const cur_line = &(*lines)[line_num];
1018 if (
fill_buffer(fp, bytes_read, cur_line->
offset, &buf, &fmt, &buflen, &buf_ready) < 0)
1028 else if (buf[11] ==
'W')
1030 else if (buf[11] ==
'E')
1039 if (cur_line->
cid == -1)
1042 if (
fill_buffer(fp, bytes_read, cur_line->
offset, &buf, &fmt, &buflen, &buf_ready) < 0)
1049 resolve_types(win_pager, (
char *) fmt, (
char *) buf, *lines, line_num, *lines_used,
1053 for (m = line_num + 1;
1054 m < *lines_used && (*lines)[m].offset && (*lines)[m].cont_line; m++)
1056 (*lines)[m].cid = cur_line->
cid;
1063 ((cur_line->
quote == NULL) || (cur_line->
quote->
quote_n >= c_toggle_quoted_show_levels)))
1077 if (
fill_buffer(fp, bytes_read, cur_line->
offset, &buf, &fmt, &buflen, &buf_ready) < 0)
1088 pmatch[0].rm_eo - pmatch[0].rm_so,
1089 force_redraw, q_level);
1099 if (
fill_buffer(fp, bytes_read, cur_line->
offset, &buf, &fmt, &buflen, &buf_ready) < 0)
1108 while (regexec(search_re, (
char *) fmt + offset, 1, pmatch,
1109 (offset ? REG_NOTBOL : 0)) == 0)
1118 memset(ts, 0,
sizeof(*ts));
1124 pmatch[0].rm_so += offset;
1125 pmatch[0].rm_eo += offset;
1129 if (pmatch[0].rm_eo == pmatch[0].rm_so)
1132 offset = pmatch[0].rm_eo;
1138 if (!(flags &
MUTT_SHOW) && ((*lines)[line_num + 1].offset > 0))
1144 if ((flags &
MUTT_SHOWCOLOR) && *force_redraw && ((*lines)[line_num + 1].offset > 0))
1151 b_read =
fill_buffer(fp, bytes_read, cur_line->
offset, &buf, &fmt, &buflen, &buf_ready);
1160 cnt =
format_line(win_pager, lines, line_num, buf, flags, NULL, b_read, &ch,
1161 &vch, &col, &special, win_pager->
state.
cols, ansi_list);
1162 buf_ptr = buf + cnt;
1168 if ((cnt < b_read) && (ch != -1) &&
1173 while (ch && ((buf[ch] ==
' ') || (buf[ch] ==
'\t') || (buf[ch] ==
'\r')))
1181 buf_ptr = buf + cnt;
1188 while ((*buf_ptr ==
' ') || (*buf_ptr ==
'\t'))
1193 if (*buf_ptr ==
'\r')
1195 if (*buf_ptr ==
'\n')
1198 if (((
int) (buf_ptr - buf) < b_read) && !(*lines)[line_num + 1].cont_line)
1199 append_line(*lines, line_num, (
int) (buf_ptr - buf));
1200 (*lines)[line_num + 1].offset = cur_line->
offset + (long) (buf_ptr - buf);
1210 format_line(win_pager, lines, line_num, buf, flags, &ansi, cnt, &ch, &vch,
1211 &col, &special, win_pager->
state.
cols, ansi_list);
1222 resolve_color(win_pager, *lines, line_num, vch, flags, 0, &ansi);
1231 def_color = ((*lines)[m].syntax)[0].
attr_color;
1245 if (col < win_pager->state.cols)
@ MT_COLOR_MESSAGE
Informational message.
@ MT_COLOR_ERROR
Error message.
@ MT_COLOR_MESSAGE_LOG
Menu showing log messages.
@ MT_COLOR_WARNING
Warning messages.
static int format_line(struct MuttWindow *win, struct Line **lines, int line_num, unsigned char *buf, PagerFlags flags, struct AnsiColor *ansi, int cnt, int *pspace, int *pvch, int *pcol, int *pspecial, int width, struct AttrColorList *ansi_list)
Display a line of text in the pager.
static int fill_buffer(FILE *fp, LOFF_T *bytes_read, LOFF_T offset, unsigned char **buf, unsigned char **fmt, size_t *blen, int *buf_ready)
Fill a buffer from a file.
static void resolve_types(struct MuttWindow *win, char *buf, char *raw, struct Line *lines, int line_num, int lines_used, struct QuoteStyle **quote_list, int *q_level, bool *force_redraw, bool q_classify)
Determine the style for a line of text.
static void append_line(struct Line *lines, int line_num, int cnt)
Add a new Line to the array.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
A line of text in the pager.
short search_arr_size
Number of items in search array.
struct TextSyntax * search
Array of search text in the line.
LOFF_T offset
Offset into Email file (PagerPrivateData->fp)
struct WindowState state
Current state of the Window.
int quote_n
The quoteN colour index for this level.
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.