NeoMutt  2024-04-25-89-g194907
Teaching an old dog new tricks
No Matches
pager.c File Reference

Pager Debugging. More...

#include "config.h"
#include <stdio.h>
#include "mutt/lib.h"
#include "color/lib.h"
#include "pager/lib.h"
#include "pager/display.h"
#include "pager/private_data.h"
+ Include dependency graph for pager.c:

Go to the source code of this file.


void dump_text_syntax (struct TextSyntax *ts, int num)
void dump_line (int i, struct Line *line)
void dump_pager (struct PagerPrivateData *priv)

Detailed Description

Pager Debugging.

  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see

Definition in file pager.c.

Function Documentation

◆ dump_text_syntax()

void dump_text_syntax ( struct TextSyntax ts,
int  num 

Definition at line 37 of file pager.c.

39 if (!ts || (num == 0))
40 return;
42 for (int i = 0; i < num; i++)
43 {
44 int index = -1;
45 const char *swatch = "";
46 if (!ts[i].attr_color)
47 continue;
48 struct CursesColor *cc = ts[i].attr_color->curses_color;
49 if (cc)
50 {
51 index = cc->index;
52 swatch = color_log_color(cc->fg, cc->bg);
53 }
54 mutt_debug(LL_DEBUG1, "\t\t%3d %4d %4d %s\n", index, ts[i].first, ts[i].last, swatch);
55 }
const char * color_log_color(color_t fg, color_t bg)
Get a colourful string to represent a colour in the log.
Definition: debug.c:51
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
Log at debug level 1.
Definition: logging2.h:43
struct CursesColor * curses_color
Underlying Curses colour.
Definition: attr.h:70
Colour in the ncurses palette.
Definition: curses2.h:41
color_t fg
Foreground colour.
Definition: curses2.h:42
color_t bg
Background colour.
Definition: curses2.h:43
short index
Index number.
Definition: curses2.h:44
const struct AttrColor * attr_color
Curses colour of text.
Definition: display.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_line()

void dump_line ( int  i,
struct Line line 

Definition at line 58 of file pager.c.

60 mutt_debug(LL_DEBUG1, "Line: %d (offset: %ld)\n", i, line->offset);
61 // mutt_debug(LL_DEBUG1, "\toffset: %ld\n", line->offset);
62 if ((line->cid > 0) && (line->cid != MT_COLOR_NORMAL))
63 {
64 struct Buffer *buf = buf_pool_get();
65 get_colorid_name(line->cid, buf);
67 const char *swatch = "";
68 struct AttrColor *ac = simple_color_get(line->cid);
69 if (ac && ac->curses_color)
70 {
71 struct CursesColor *cc = ac->curses_color;
72 swatch = color_log_color(cc->fg, cc->bg);
73 }
75 mutt_debug(LL_DEBUG1, "\tcolor: %d %s (%s)\n", line->cid, swatch, buf_string(buf));
76 buf_pool_release(&buf);
77 }
78 if (line->cont_line)
79 {
80 mutt_debug(LL_DEBUG1, "\tcont_line: %s\n",
81 line->cont_line ? "\033[1;32myes\033[0m" : "\033[31mno\033[0m");
82 }
83 if (line->cont_header)
84 {
85 mutt_debug(LL_DEBUG1, "\tcont_header: %s\n",
86 line->cont_header ? "\033[1;32myes\033[0m" : "\033[31mno\033[0m");
87 }
89 if (line->syntax_arr_size > 0)
90 {
91 mutt_debug(LL_DEBUG1, "\tsyntax: %d\n", line->syntax_arr_size);
93 }
94 if (line->search_arr_size > 0)
95 {
96 mutt_debug(LL_DEBUG1, "\t\033[1;36msearch\033[0m: %d\n", line->search_arr_size);
98 }
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:96
void get_colorid_name(unsigned int cid, struct Buffer *buf)
Get the name of a color id.
Definition: command.c:127
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition: simple.c:88
Plain text.
Definition: color.h:59
void dump_text_syntax(struct TextSyntax *ts, int num)
Definition: pager.c:37
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:81
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:94
A curses colour and its attributes.
Definition: attr.h:66
String manipulation buffer.
Definition: buffer.h:36
short search_arr_size
Number of items in search array.
Definition: display.h:60
struct TextSyntax * search
Array of search text in the line.
Definition: display.h:61
bool cont_line
Continuation of a previous line (wrapped by NeoMutt)
Definition: display.h:54
short cid
Default line colour, e.g. MT_COLOR_QUOTED.
Definition: display.h:53
LOFF_T offset
Offset into Email file (PagerPrivateData->fp)
Definition: display.h:52
bool cont_header
Continuation of a header line (wrapped by MTA)
Definition: display.h:55
short syntax_arr_size
Number of items in syntax array.
Definition: display.h:57
struct TextSyntax * syntax
Array of coloured text in the line.
Definition: display.h:58
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_pager()

void dump_pager ( struct PagerPrivateData priv)

Definition at line 101 of file pager.c.

103 if (!priv)
104 return;
106 mutt_debug(LL_DEBUG1, "----------------------------------------------\n");
107 mutt_debug(LL_DEBUG1, "Pager: %d lines (fd %d)\n", priv->lines_used, fileno(priv->fp));
108 for (int i = 0; i < priv->lines_used; i++)
109 {
110 dump_line(i, &priv->lines[i]);
111 }
void dump_line(int i, struct Line *line)
Definition: pager.c:58
int lines_used
Size of lines array (used entries)
Definition: private_data.h:49
struct Line * lines
Array of text lines in pager.
Definition: private_data.h:48
FILE * fp
File containing decrypted/decoded/weeded Email.
Definition: private_data.h:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function: