NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
repaint()

Repaint the Window. More...

+ Collaboration diagram for repaint():

Functions

static int cbar_repaint (struct MuttWindow *win)
 Repaint the Window - Implements MuttWindow::repaint() -.
 
static int preview_repaint (struct MuttWindow *win)
 Repaint the Window - Implements MuttWindow::repaint() -.
 
static int enter_repaint (struct MuttWindow *win)
 Repaint the Window - Implements MuttWindow::repaint() -.
 
static int env_repaint (struct MuttWindow *win)
 Repaint the Window - Implements MuttWindow::repaint() -.
 
static int msgwin_repaint (struct MuttWindow *win)
 Redraw the Message Window - Implements MuttWindow::repaint() -.
 
static int sbar_repaint (struct MuttWindow *win)
 Repaint the Window - Implements MuttWindow::repaint() -.
 
static int utilwin_repaint (struct MuttWindow *win)
 Repaint the Utility Window - Implements MuttWindow::repaint() -.
 
static int helpbar_repaint (struct MuttWindow *win)
 Redraw the Help Bar - Implements MuttWindow::repaint() -.
 
static int ibar_repaint (struct MuttWindow *win)
 Repaint the Window - Implements MuttWindow::repaint() -.
 
static int index_repaint (struct MuttWindow *win)
 Repaint the Index display - Implements MuttWindow::repaint() -.
 
static int menu_repaint (struct MuttWindow *win)
 Repaint the Window - Implements MuttWindow::repaint() -.
 
static int pager_repaint (struct MuttWindow *win)
 Repaint the Pager display - Implements MuttWindow::repaint() -.
 
static int pbar_repaint (struct MuttWindow *win)
 Repaint the Window - Implements MuttWindow::repaint() -.
 
static int progress_window_repaint (struct MuttWindow *win)
 Repaint the Progress Bar - Implements MuttWindow::repaint() -.
 
int sb_repaint (struct MuttWindow *win)
 Repaint the Sidebar display - Implements MuttWindow::repaint() -.
 

Detailed Description

Repaint the Window.

Parameters
winWindow
Return values
0Success
-1Error
Precondition
win is not NULL
win is visible

Function Documentation

◆ cbar_repaint()

static int cbar_repaint ( struct MuttWindow * win)
static

Repaint the Window - Implements MuttWindow::repaint() -.

Definition at line 105 of file cbar.c.

106{
107 struct ComposeBarData *cbar_data = win->wdata;
108
109 mutt_window_move(win, 0, 0);
112
113 mutt_window_move(win, 0, 0);
114 mutt_draw_statusline(win, win->state.cols, cbar_data->compose_format,
115 mutt_str_len(cbar_data->compose_format));
117 mutt_debug(LL_DEBUG5, "repaint done\n");
118
119 return 0;
120}
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition color.h:78
@ MT_COLOR_NORMAL
Plain text.
Definition color.h:53
void mutt_draw_statusline(struct MuttWindow *win, int max_cols, const char *buf, size_t buflen)
Draw a highlighted status bar.
Definition dlg_index.c:980
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
@ LL_DEBUG5
Log at debug level 5.
Definition logging2.h:49
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition string.c:503
const struct AttrColor * mutt_curses_set_normal_backed_color_by_id(enum ColorId cid)
Set the colour and attributes by the Colour ID.
Definition mutt_curses.c:63
const struct AttrColor * mutt_curses_set_color_by_id(enum ColorId cid)
Set the colour and attributes by the Colour ID.
Definition mutt_curses.c:79
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Data to fill the Compose Bar Window.
Definition cbar_data.h:33
char * compose_format
Cached status string.
Definition cbar_data.h:34
struct WindowState state
Current state of the Window.
void * wdata
Private data.
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition mutt_window.h:60
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ preview_repaint()

static int preview_repaint ( struct MuttWindow * win)
static

Repaint the Window - Implements MuttWindow::repaint() -.

Definition at line 332 of file preview.c.

333{
334 struct PreviewWindowData *wdata = win->wdata;
335 draw_preview(win, wdata);
336
337 mutt_debug(LL_DEBUG5, "repaint done\n");
338 return 0;
339}
static void draw_preview(struct MuttWindow *win, struct PreviewWindowData *wdata)
Write the message preview to the compose window.
Definition preview.c:139
Data to fill the Preview Window.
Definition preview.c:78
struct MuttWindow * win
Window holding the message preview.
Definition preview.c:81
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enter_repaint()

static int enter_repaint ( struct MuttWindow * win)
static

Repaint the Window - Implements MuttWindow::repaint() -.

Definition at line 181 of file window.c.

182{
183 if (!mutt_window_is_visible(win))
184 return 0;
185
186 struct EnterWindowData *wdata = win->wdata;
187
188 mutt_window_clearline(win, 0);
190 mutt_window_addstr(win, wdata->prompt);
192
193 int prompt_length = 0;
194 mutt_window_get_coords(win, NULL, &prompt_length);
195
196 int width = win->state.cols - prompt_length - 1;
197 if (width < 1)
198 width = 1;
199
200 if (!wdata->pass)
201 {
202 if (wdata->redraw == ENTER_REDRAW_INIT)
203 {
204 /* Go to end of line */
205 wdata->state->curpos = wdata->state->lastchar;
207 wdata->state->wbuf, wdata->state->lastchar,
208 mutt_mb_wcswidth(wdata->state->wbuf, wdata->state->lastchar) - width + 1);
209 }
210 if ((wdata->state->curpos < wdata->state->begin) ||
211 (mutt_mb_wcswidth(wdata->state->wbuf + wdata->state->begin,
212 wdata->state->curpos - wdata->state->begin) >= width))
213 {
215 wdata->state->wbuf, wdata->state->lastchar,
216 mutt_mb_wcswidth(wdata->state->wbuf, wdata->state->curpos) - (width / 2));
217 }
218 mutt_window_move(win, 0, prompt_length);
219 int w = 0;
220 for (size_t i = wdata->state->begin; i < wdata->state->lastchar; i++)
221 {
222 w += mutt_mb_wcwidth(wdata->state->wbuf[i]);
223 if (w > width)
224 break;
225 my_addwch(win, wdata->state->wbuf[i]);
226 }
228 mutt_window_move(win, 0,
229 prompt_length +
230 mutt_mb_wcswidth(wdata->state->wbuf + wdata->state->begin,
231 wdata->state->curpos - wdata->state->begin));
232 }
233
234 mutt_window_get_coords(win, &wdata->row, &wdata->col);
235 mutt_debug(LL_DEBUG5, "repaint done\n");
236
237 return 0;
238}
@ MT_COLOR_PROMPT
Question/user input.
Definition color.h:56
@ ENTER_REDRAW_INIT
Go to end of line and redraw.
Definition wdata.h:37
static int my_addwch(struct MuttWindow *win, wchar_t wc)
Display one wide character on screen.
Definition window.c:70
size_t mutt_mb_width_ceiling(const wchar_t *s, size_t n, int w1)
Keep the end of the string on-screen.
Definition mbyte.c:238
int mutt_mb_wcswidth(const wchar_t *s, size_t n)
Measure the screen width of a string.
Definition mbyte.c:217
int mutt_mb_wcwidth(wchar_t wc)
Measure the screen width of a character.
Definition mbyte.c:199
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
void mutt_window_get_coords(struct MuttWindow *win, int *row, int *col)
Get the cursor position in the Window.
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
int mutt_window_addstr(struct MuttWindow *win, const char *str)
Write a string to a Window.
size_t curpos
Position of the cursor.
Definition state.h:36
size_t begin
Position of the start.
Definition state.h:37
wchar_t * wbuf
Buffer for the string being entered.
Definition state.h:33
size_t lastchar
Position of the last character.
Definition state.h:35
Data to fill the Enter Window.
Definition wdata.h:57
bool pass
Password mode, conceal characters.
Definition wdata.h:69
int row
Cursor row.
Definition wdata.h:80
int col
Cursor column.
Definition wdata.h:81
const char * prompt
Prompt.
Definition wdata.h:67
struct EnterState * state
Current state of text entry.
Definition wdata.h:61
enum EnterRedrawFlags redraw
What needs redrawing? See EnterRedrawFlags.
Definition wdata.h:68
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ env_repaint()

static int env_repaint ( struct MuttWindow * win)
static

Repaint the Window - Implements MuttWindow::repaint() -.

Definition at line 752 of file window.c.

753{
754 struct EnvelopeWindowData *wdata = win->wdata;
755
756 draw_envelope(win, wdata);
757 mutt_debug(LL_DEBUG5, "repaint done\n");
758 return 0;
759}
static void draw_envelope(struct MuttWindow *win, struct EnvelopeWindowData *wdata)
Write the email headers to the compose window.
Definition window.c:678
Data to fill the Envelope Window.
Definition wdata.h:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ msgwin_repaint()

static int msgwin_repaint ( struct MuttWindow * win)
static

Redraw the Message Window - Implements MuttWindow::repaint() -.

Definition at line 255 of file msgwin.c.

256{
257 struct MsgWinWindowData *wdata = win->wdata;
258
259 const char *str = buf_string(wdata->text);
260 const int max_rows = MIN(MSGWIN_MAX_ROWS, win->state.rows);
261 for (int i = 0; i < max_rows; i++)
262 {
263 mutt_window_move(win, i, 0);
264 if (ARRAY_EMPTY(&wdata->rows[i]))
265 {
268 break;
269 }
270
271 struct MwChunk *chunk = NULL;
272 ARRAY_FOREACH(chunk, &wdata->rows[i])
273 {
275 mutt_window_addnstr(win, str + chunk->offset, chunk->bytes);
276 }
279 }
280
281 mutt_window_get_coords(win, &wdata->row, &wdata->col);
282
283 mutt_debug(LL_DEBUG5, "msgwin repaint done\n");
284 return 0;
285}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition array.h:223
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition array.h:74
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
#define MIN(a, b)
Return the minimum of two values.
Definition memory.h:40
#define MSGWIN_MAX_ROWS
Maximum number of rows to show in the message window.
void mutt_curses_set_color(const struct AttrColor *ac)
Set the colour and attributes for text.
Definition mutt_curses.c:38
int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
Write a partial string to a Window.
Message Window private Window data.
struct Buffer * text
Cached display string.
struct MwChunkArray rows[MSGWIN_MAX_ROWS]
String byte counts for each row.
int row
Cursor row.
int col
Cursor column.
A block of characters of one colour.
unsigned short bytes
Number of bytes in the row.
unsigned short offset
Offset into MsgWinWindowData.text.
const struct AttrColor * ac_color
Colour to use.
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition mutt_window.h:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sbar_repaint()

static int sbar_repaint ( struct MuttWindow * win)
static

Repaint the Window - Implements MuttWindow::repaint() -.

Definition at line 95 of file sbar.c.

96{
97 struct SBarPrivateData *priv = win->wdata;
98
99 mutt_window_move(win, 0, 0);
100
102 mutt_window_move(win, 0, 0);
103 mutt_paddstr(win, win->state.cols, priv->display);
105
106 mutt_debug(LL_DEBUG5, "repaint done\n");
107 return 0;
108}
void mutt_paddstr(struct MuttWindow *win, int n, const char *s)
Display a string on screen, padded if necessary.
Definition curs_lib.c:344
Private data for the Simple Bar.
Definition sbar.c:75
char * display
Cached display string.
Definition sbar.c:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ utilwin_repaint()

static int utilwin_repaint ( struct MuttWindow * win)
static

Repaint the Utility Window - Implements MuttWindow::repaint() -.

Draw the text on the bottom row of the window, so that it aligns with the last line of a multi-line Message Window.

Definition at line 97 of file utilwin.c.

98{
99 struct UtilWinData *priv = win->wdata;
100
102
103 // Blank any extra rows above the bottom line
104 for (int r = 0; r < (win->state.rows - 1); r++)
105 {
106 mutt_window_move(win, r, 0);
108 }
109
110 int row = win->state.rows - 1;
111 mutt_window_move(win, row, 0);
112
113 if (priv->text)
114 mutt_window_addstr(win, priv->text);
115
117
118 mutt_debug(LL_DEBUG5, "utilwin repaint done\n");
119 return 0;
120}
Utility Window private data.
Definition utilwin.c:77
char * text
Cached display string.
Definition utilwin.c:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ helpbar_repaint()

static int helpbar_repaint ( struct MuttWindow * win)
static

Redraw the Help Bar - Implements MuttWindow::repaint() -.

The Help Bar is drawn from the data cached in the HelpbarWindowData. No calculation is performed.

Definition at line 164 of file helpbar.c.

165{
167 if (!wdata)
168 return 0;
169
171 mutt_window_move(win, 0, 0);
172 mutt_paddstr(win, win->state.cols, wdata->help_str);
174
175 mutt_debug(LL_DEBUG5, "repaint done\n");
176 return 0;
177}
struct HelpbarWindowData * helpbar_wdata_get(struct MuttWindow *win)
Get the Helpbar data for this window.
Definition wdata.c:64
Help Bar Window data -.
Definition private.h:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ibar_repaint()

static int ibar_repaint ( struct MuttWindow * win)
static

Repaint the Window - Implements MuttWindow::repaint() -.

Definition at line 142 of file ibar.c.

143{
144 struct IBarPrivateData *ibar_data = win->wdata;
145 struct IndexSharedData *shared = ibar_data->shared;
146
147 mutt_window_move(win, 0, 0);
150
151 mutt_window_move(win, 0, 0);
152 mutt_draw_statusline(win, win->state.cols, ibar_data->status_format,
153 mutt_str_len(ibar_data->status_format));
155
156 const bool c_ts_enabled = cs_subset_bool(shared->sub, "ts_enabled");
158 if (c_ts_enabled && mod_data && mod_data->ts_supported)
159 {
161 mutt_ts_icon(ibar_data->ts_icon_format);
162 }
163
164 mutt_debug(LL_DEBUG5, "repaint done\n");
165 return 0;
166}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
@ MODULE_ID_GUI
ModuleGui, Graphical code
Definition module_api.h:45
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
Gui private Module data.
Definition module_data.h:32
bool ts_supported
Terminal Setting is supported.
Definition module_data.h:43
Data to draw the Index Bar.
Definition ibar.c:81
char * ts_icon_format
Cached terminal icon string.
Definition ibar.c:86
struct IndexSharedData * shared
Shared Index data.
Definition ibar.c:82
char * ts_status_format
Cached terminal status string.
Definition ibar.c:85
char * status_format
Cached screen status string.
Definition ibar.c:84
Data shared between Index, Pager and Sidebar.
Definition shared_data.h:37
struct ConfigSubset * sub
Config set to use.
Definition shared_data.h:38
Container for Accounts, Notifications.
Definition neomutt.h:41
void mutt_ts_icon(char *str)
Set the icon in the terminal title bar.
Definition terminal.c:142
void mutt_ts_status(char *str)
Set the text of the terminal title bar.
Definition terminal.c:128
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_repaint()

static int index_repaint ( struct MuttWindow * win)
static

Repaint the Index display - Implements MuttWindow::repaint() -.

Definition at line 604 of file index.c.

605{
606 struct Menu *menu = win->wdata;
607
608 if (menu->redraw & MENU_REDRAW_FULL)
609 menu_redraw_full(menu);
610
611 // If we don't have the focus, then this is a mini-Index ($pager_index_lines)
612 if (!window_is_focused(menu->win))
613 {
614 int indicator = menu->page_len / 3;
615
616 /* some fudge to work out whereabouts the indicator should go */
617 const int index = menu_get_index(menu);
618 if ((index - indicator) < 0)
619 menu->top = 0;
620 else if ((menu->max - index) < (menu->page_len - indicator))
621 menu->top = menu->max - menu->page_len;
622 else
623 menu->top = index - indicator;
624 }
625 menu_adjust(menu);
627
628 struct IndexPrivateData *priv = menu->mdata;
629 struct IndexSharedData *shared = priv->shared;
630 struct Mailbox *m = shared->mailbox;
631 const int index = menu_get_index(menu);
632 if (m && m->emails && (index < m->vcount))
633 {
634 if (menu->redraw & MENU_REDRAW_INDEX)
635 {
636 menu_redraw_index(menu);
637 }
638 else if (menu->redraw & MENU_REDRAW_MOTION)
639 {
640 menu_redraw_motion(menu);
641 }
642 else if (menu->redraw & MENU_REDRAW_CURRENT)
643 {
645 }
646 }
647
648 menu->redraw = MENU_REDRAW_NONE;
649 mutt_debug(LL_DEBUG5, "repaint done\n");
650 return 0;
651}
void menu_redraw_current(struct Menu *menu)
Redraw the current menu.
Definition draw.c:464
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition draw.c:341
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition draw.c:327
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition draw.c:405
void menu_adjust(struct Menu *menu)
Reapply the config to the Menu.
Definition move.c:325
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition menu.c:155
@ MENU_REDRAW_INDEX
Redraw the index.
Definition lib.h:61
@ MENU_REDRAW_FULL
Redraw everything.
Definition lib.h:64
@ MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition lib.h:63
@ MENU_REDRAW_NONE
No flags are set.
Definition lib.h:60
@ MENU_REDRAW_MOTION
Redraw after moving the menu list.
Definition lib.h:62
bool window_is_focused(const struct MuttWindow *win)
Does the given Window have the focus?
Private state data for the Index.
struct IndexSharedData * shared
Shared Index data.
struct Menu * menu
Menu controlling the index.
struct Mailbox * mailbox
Current Mailbox.
Definition shared_data.h:41
A mailbox.
Definition mailbox.h:81
int vcount
The number of virtual messages.
Definition mailbox.h:101
struct Email ** emails
Array of Emails.
Definition mailbox.h:98
Definition lib.h:86
struct MuttWindow * win
Window holding the Menu.
Definition lib.h:94
MenuRedrawFlags redraw
When to redraw the screen.
Definition lib.h:89
int top
Entry that is the top of the current page.
Definition lib.h:98
void * mdata
Private data.
Definition lib.h:155
int max
Number of entries in the menu.
Definition lib.h:88
int page_len
Number of entries per screen.
Definition lib.h:91
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_repaint()

static int menu_repaint ( struct MuttWindow * win)
static

Repaint the Window - Implements MuttWindow::repaint() -.

Definition at line 94 of file window.c.

95{
96 if (win->type != WT_MENU)
97 return 0;
98
99 struct Menu *menu = win->wdata;
100 menu_redraw(menu);
101 menu->redraw = MENU_REDRAW_NONE;
102
103 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
104 const bool c_braille_friendly = cs_subset_bool(menu->sub, "braille_friendly");
105
106 /* move the cursor out of the way */
107 if (c_arrow_cursor)
108 {
109 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
110 const int arrow_width = mutt_strwidth(c_arrow_string);
111 mutt_window_move(menu->win, menu->current - menu->top, arrow_width);
112 }
113 else if (c_braille_friendly)
114 {
115 mutt_window_move(menu->win, menu->current - menu->top, 0);
116 }
117 else
118 {
119 mutt_window_move(menu->win, menu->current - menu->top, menu->win->state.cols - 1);
120 }
121
122 mutt_debug(LL_DEBUG5, "repaint done\n");
123 return 0;
124}
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition helpers.c:291
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition curs_lib.c:446
int menu_redraw(struct Menu *menu)
Redraw the parts of the screen that have been flagged to be redrawn.
Definition draw.c:499
@ WT_MENU
An Window containing a Menu.
Definition mutt_window.h:98
int current
Current entry.
Definition lib.h:87
struct ConfigSubset * sub
Inherited config items.
Definition lib.h:95
enum WindowType type
Window type, e.g. WT_SIDEBAR.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pager_repaint()

static int pager_repaint ( struct MuttWindow * win)
static

Repaint the Pager display - Implements MuttWindow::repaint() -.

Definition at line 135 of file pager.c.

136{
137 struct PagerPrivateData *priv = win->wdata;
138 if (!priv || !priv->pview || !priv->pview->pdata)
139 return 0;
140
141 dump_pager(priv);
142
143 /* Phase 1: Reflow the content if the window was resized or needs repopulating.
144 * Reset all line metadata and re-display lines up to the current position. */
145 const bool repopulate = (priv->cur_line > priv->lines_used);
146 if ((priv->redraw & PAGER_REDRAW_FLOW) || repopulate)
147 {
148 priv->win_height = -1;
149 for (int i = 0; i <= priv->top_line; i++)
150 if (!priv->lines[i].cont_line)
151 priv->win_height++;
152 for (int i = 0; i < priv->lines_max; i++)
153 {
154 priv->lines[i].offset = 0;
155 priv->lines[i].cid = -1;
156 priv->lines[i].cont_line = false;
157 priv->lines[i].syntax_arr_size = 0;
158 priv->lines[i].search_arr_size = -1;
159 priv->lines[i].quote = NULL;
160
161 MUTT_MEM_REALLOC(&(priv->lines[i].syntax), 1, struct TextSyntax);
162 priv->lines[i].syntax[0].attr_color = NULL;
163 priv->lines[i].syntax[0].first = -1;
164 priv->lines[i].syntax[0].last = -1;
165
166 if (priv->search_compiled && priv->lines[i].search)
167 FREE(&(priv->lines[i].search));
168 }
169
170 if (!repopulate)
171 {
172 priv->lines_used = 0;
173 priv->top_line = 0;
174 }
175
176 int i = -1;
177 int j = -1;
178 const PagerFlags flags = priv->has_types | priv->search_flag |
179 (priv->pview->flags & MUTT_PAGER_NOWRAP) |
180 (priv->pview->flags & MUTT_PAGER_STRIPES);
181
182 while (display_line(priv->fp, &priv->bytes_read, &priv->lines, ++i,
183 &priv->lines_used, &priv->lines_max, flags, &priv->quote_list,
184 &priv->q_level, &priv->force_redraw, &priv->search_re,
185 priv->pview->win_pager, &priv->ansi_list) == 0)
186 {
187 if (!priv->lines[i].cont_line && (++j == priv->win_height))
188 {
189 if (!repopulate)
190 priv->top_line = i;
191 if (!priv->search_flag)
192 break;
193 }
194 }
195 }
196
197 /* Phase 2: Repaint visible lines from top_line downward. Repeatedly
198 * calls display_line() for each row in the pager window. */
199 if ((priv->redraw & PAGER_REDRAW_PAGER) || (priv->top_line != priv->old_top_line))
200 {
201 do
202 {
203 mutt_window_move(priv->pview->win_pager, 0, 0);
204 priv->cur_line = priv->top_line;
205 priv->old_top_line = priv->top_line;
206 priv->win_height = 0;
207 priv->force_redraw = false;
208
209 while ((priv->win_height < priv->pview->win_pager->state.rows) &&
210 (priv->lines[priv->cur_line].offset <= priv->st.st_size - 1))
211 {
212 const PagerFlags flags = (priv->pview->flags & MUTT_DISPLAYFLAGS) |
213 priv->hide_quoted | priv->search_flag |
214 (priv->pview->flags & MUTT_PAGER_NOWRAP) |
215 (priv->pview->flags & MUTT_PAGER_STRIPES);
216
217 if (display_line(priv->fp, &priv->bytes_read, &priv->lines, priv->cur_line,
218 &priv->lines_used, &priv->lines_max, flags, &priv->quote_list,
219 &priv->q_level, &priv->force_redraw, &priv->search_re,
220 priv->pview->win_pager, &priv->ansi_list) > 0)
221 {
222 priv->win_height++;
223 }
224 priv->cur_line++;
225 mutt_window_move(priv->pview->win_pager, priv->win_height, 0);
226 }
227 } while (priv->force_redraw);
228
229 /* Fill remaining rows with tilde characters (like vi) */
230 const bool c_tilde = cs_subset_bool(NeoMutt->sub, "tilde");
232 while (priv->win_height < priv->pview->win_pager->state.rows)
233 {
235 if (c_tilde)
236 mutt_window_addch(priv->pview->win_pager, '~');
237 priv->win_height++;
238 mutt_window_move(priv->pview->win_pager, priv->win_height, 0);
239 }
241 }
242
244 mutt_debug(LL_DEBUG5, "repaint done\n");
245 return 0;
246}
@ MT_COLOR_TILDE
Pager: empty lines after message.
Definition color.h:81
void dump_pager(struct PagerPrivateData *priv)
Dump pager state.
Definition pager.c:146
int display_line(FILE *fp, LOFF_T *bytes_read, struct Line **lines, int line_num, int *lines_used, int *lines_max, PagerFlags flags, struct QuoteStyle **quote_list, int *q_level, bool *force_redraw, regex_t *search_re, struct MuttWindow *win_pager, struct AttrColorList *ansi_list)
Print a line on screen.
Definition display.c:1058
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define MUTT_MEM_REALLOC(pptr, n, type)
Definition memory.h:55
int mutt_window_addch(struct MuttWindow *win, int ch)
Write one character to a Window.
@ PAGER_REDRAW_FLOW
Reflow the pager.
Definition lib.h:203
@ PAGER_REDRAW_PAGER
Redraw the pager.
Definition lib.h:202
@ PAGER_REDRAW_NONE
No flags are set.
Definition lib.h:201
#define MUTT_PAGER_NOWRAP
Format for term width, ignore $wrap.
Definition lib.h:74
#define MUTT_DISPLAYFLAGS
Definition lib.h:80
uint16_t PagerFlags
Flags for dlg_pager(), e.g. MUTT_SHOWFLAT.
Definition lib.h:62
#define MUTT_PAGER_STRIPES
Striped highlighting.
Definition lib.h:77
short search_arr_size
Number of items in search array.
Definition display.h:59
struct TextSyntax * search
Array of search text in the line.
Definition display.h:60
bool cont_line
Continuation of a previous line (wrapped by NeoMutt)
Definition display.h:53
short cid
Default line colour, e.g. MT_COLOR_SIGNATURE.
Definition display.h:52
struct QuoteStyle * quote
Quoting style for this line (pointer into PagerPrivateData->quote_list)
Definition display.h:62
LOFF_T offset
Offset into Email file (PagerPrivateData->fp)
Definition display.h:51
short syntax_arr_size
Number of items in syntax array.
Definition display.h:56
struct TextSyntax * syntax
Array of coloured text in the line.
Definition display.h:57
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Private state data for the Pager.
PagerFlags hide_quoted
Set to MUTT_HIDE when quoted email is hidden <toggle-quoted>
int q_level
Number of unique quoting levels.
int cur_line
Current line (last line visible on screen)
int lines_used
Size of lines array (used entries)
int lines_max
Capacity of lines array (total entries)
bool force_redraw
Repaint is needed.
struct Line * lines
Array of text lines in pager.
PagerRedrawFlags redraw
When to redraw the screen.
int has_types
Set to MUTT_TYPES for PAGER_MODE_EMAIL or MUTT_SHOWCOLOR.
LOFF_T bytes_read
Number of bytes read from file.
int top_line
First visible line on screen.
struct stat st
Stats about Email file.
struct QuoteStyle * quote_list
Tree of quoting levels.
struct PagerView * pview
Object to view in the pager.
struct AttrColorList ansi_list
List of ANSI colours used in the Pager.
regex_t search_re
Compiled search string.
int win_height
Number of lines in the Window.
int old_top_line
Old top line, used for repainting.
FILE * fp
File containing decrypted/decoded/weeded Email.
PagerFlags search_flag
Set to MUTT_SEARCH when search results are visible <search-toggle>
bool search_compiled
Search regex is in use.
struct PagerData * pdata
Data that pager displays. NOTNULL.
Definition lib.h:174
PagerFlags flags
Additional settings to tweak pager's function.
Definition lib.h:176
struct MuttWindow * win_pager
Pager Window.
Definition lib.h:181
Highlighting for a piece of text.
Definition display.h:39
const struct AttrColor * attr_color
Curses colour of text.
Definition display.h:40
int last
Last character in line to be coloured (not included)
Definition display.h:42
int first
First character in line to be coloured.
Definition display.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pbar_repaint()

static int pbar_repaint ( struct MuttWindow * win)
static

Repaint the Window - Implements MuttWindow::repaint() -.

Definition at line 151 of file pbar.c.

152{
153 struct PBarPrivateData *pbar_data = win->wdata;
154
155 mutt_window_move(win, 0, 0);
158
159 mutt_window_move(win, 0, 0);
160 mutt_draw_statusline(win, win->state.cols, pbar_data->pager_format,
161 mutt_str_len(pbar_data->pager_format));
163
164 mutt_debug(LL_DEBUG5, "repaint done\n");
165 return 0;
166}
Data to draw the Pager Bar.
Definition pbar.c:81
char * pager_format
Cached status string.
Definition pbar.c:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ progress_window_repaint()

static int progress_window_repaint ( struct MuttWindow * win)
static

Repaint the Progress Bar - Implements MuttWindow::repaint() -.

Definition at line 164 of file window.c.

165{
166 if (!win || !win->wdata)
167 return -1;
168
169 struct ProgressWindowData *wdata = win->wdata;
170 if (wdata->msg[0] == '\0')
171 return 0;
172
173 if (wdata->size == 0)
174 {
175 if (wdata->display_percent >= 0)
176 {
177 if (wdata->is_bytes)
178 {
179 /* L10N: Progress bar: `%s` loading text, `%s` pretty size (e.g. 4.6K),
180 `%d` is the number, `%%` is the percent symbol.
181 `%d` and `%%` may be reordered, or space inserted, if you wish. */
182 message_bar(wdata->win, wdata->display_percent, _("%s %s (%d%%)"),
183 wdata->msg, wdata->pretty_pos, wdata->display_percent);
184 }
185 else
186 {
187 /* L10N: Progress bar: `%s` loading text, `%zu` position,
188 `%d` is the number, `%%` is the percent symbol.
189 `%d` and `%%` may be reordered, or space inserted, if you wish. */
190 message_bar(wdata->win, wdata->display_percent, _("%s %zu (%d%%)"),
191 wdata->msg, wdata->display_pos, wdata->display_percent);
192 }
193 }
194 else
195 {
196 if (wdata->is_bytes)
197 {
198 /* L10N: Progress bar: `%s` loading text, `%s` position/size */
199 message_bar(wdata->win, -1, _("%s %s"), wdata->msg, wdata->pretty_pos);
200 }
201 else
202 {
203 /* L10N: Progress bar: `%s` loading text, `%zu` position */
204 message_bar(wdata->win, -1, _("%s %zu"), wdata->msg, wdata->display_pos);
205 }
206 }
207 }
208 else
209 {
210 if (wdata->is_bytes)
211 {
212 /* L10N: Progress bar: `%s` loading text, `%s/%s` position/size,
213 `%d` is the number, `%%` is the percent symbol.
214 `%d` and `%%` may be reordered, or space inserted, if you wish. */
215 message_bar(wdata->win, wdata->display_percent, _("%s %s/%s (%d%%)"),
216 wdata->msg, wdata->pretty_pos, wdata->pretty_size, wdata->display_percent);
217 }
218 else
219 {
220 /* L10N: Progress bar: `%s` loading text, `%zu/%zu` position/size,
221 `%d` is the number, `%%` is the percent symbol.
222 `%d` and `%%` may be reordered, or space inserted, if you wish. */
223 message_bar(wdata->win, wdata->display_percent, _("%s %zu/%zu (%d%%)"),
224 wdata->msg, wdata->display_pos, wdata->size, wdata->display_percent);
225 }
226 }
227
228 return 0;
229}
#define _(a)
Definition message.h:28
static void message_bar(struct MuttWindow *win, int percent, const char *fmt,...)
Draw a colourful progress bar.
Definition window.c:75
Progress Bar Window Data.
Definition wdata.h:36
char msg[1024]
Message to display.
Definition wdata.h:40
size_t size
Total expected size.
Definition wdata.h:42
char pretty_pos[24]
Pretty string for the position.
Definition wdata.h:51
int display_percent
Displayed percentage complete.
Definition wdata.h:49
size_t display_pos
Displayed position.
Definition wdata.h:48
bool is_bytes
true if measuring bytes
Definition wdata.h:45
struct MuttWindow * win
Window to draw on.
Definition wdata.h:37
char pretty_size[24]
Pretty string for size.
Definition wdata.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_repaint()

int sb_repaint ( struct MuttWindow * win)

Repaint the Sidebar display - Implements MuttWindow::repaint() -.

Definition at line 712 of file window.c.

713{
715 const bool c_sidebar_on_right = cs_subset_bool(NeoMutt->sub, "sidebar_on_right");
716
717 int row = 0;
718 int num_rows = win->state.rows;
719 int num_cols = win->state.cols;
720
721 if (wdata->top_index >= 0)
722 {
723 int col = 0;
724 if (c_sidebar_on_right)
725 col = wdata->divider_width;
726
727 struct SbEntry **sbep = NULL;
728 ARRAY_FOREACH_FROM(sbep, &wdata->entries, wdata->top_index)
729 {
730 if (row >= num_rows)
731 break;
732
733 if ((*sbep)->is_hidden)
734 continue;
735
736 struct SbEntry *entry = (*sbep);
737 mutt_window_move(win, row, col);
739 mutt_window_printf(win, "%s", entry->display);
740 mutt_refresh();
741 row++;
742 }
743 }
744
745 fill_empty_space(win, row, num_rows - row, wdata->divider_width,
746 num_cols - wdata->divider_width);
747 draw_divider(wdata, win, num_rows, num_cols);
748
749 mutt_debug(LL_DEBUG5, "repaint done\n");
750 return 0;
751}
#define ARRAY_FOREACH_FROM(elem, head, from)
Iterate from an index to the end.
Definition array.h:235
void mutt_refresh(void)
Force a refresh of the screen.
Definition curs_lib.c:79
int mutt_window_printf(struct MuttWindow *win, const char *fmt,...)
Write a formatted string to a Window.
struct SidebarWindowData * sb_wdata_get(struct MuttWindow *win)
Get the Sidebar data for this window.
Definition wdata.c:77
static void fill_empty_space(struct MuttWindow *win, int first_row, int num_rows, int div_width, int num_cols)
Wipe the remaining Sidebar space.
Definition window.c:688
static int draw_divider(struct SidebarWindowData *wdata, struct MuttWindow *win, int num_rows, int num_cols)
Draw a line between the sidebar and the rest of neomutt.
Definition window.c:644
Info about folders in the sidebar.
Definition private.h:40
const struct AttrColor * color
Colour to use.
Definition private.h:46
char display[256]
Formatted string to display.
Definition private.h:42
Sidebar private Window data -.
Definition private.h:89
int top_index
First mailbox visible in sidebar.
Definition private.h:94
short divider_width
Width of the divider in screen columns.
Definition private.h:103
struct MuttWindow * win
Sidebar Window.
Definition private.h:90
struct SbEntryArray entries
Items to display in the sidebar.
Definition private.h:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function: