NeoMutt  2021-10-29-43-g6b8931
Teaching an old dog new tricks
functions.h File Reference

Pager functions. More...

#include <stdbool.h>
+ Include dependency graph for functions.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PagerFunction
 A NeoMutt function. More...


typedef int(* pager_function_t) (struct IndexSharedData *shared, struct PagerPrivateData *priv, int op)


int pager_function_dispatcher (struct MuttWindow *win_index, int op)
 Perform a Pager function. More...
bool jump_to_bottom (struct PagerPrivateData *priv, struct PagerView *pview)
 Make sure the bottom line is displayed. More...


struct PagerFunction PagerFunctions []
 All the NeoMutt functions that the Pager supports. More...

Detailed Description

Pager functions.

  • 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 functions.h.

Typedef Documentation

◆ pager_function_t

typedef int(* pager_function_t) (struct IndexSharedData *shared, struct PagerPrivateData *priv, int op)

Definition at line 43 of file functions.h.

Function Documentation

◆ pager_function_dispatcher()

int pager_function_dispatcher ( struct MuttWindow win_pager,
int  op 

Perform a Pager function.

win_pagerWindow for the Index
opOperation to perform, e.g. OP_MAIN_LIMIT
Return values
numIndexRetval, e.g. IR_SUCCESS

Definition at line 1911 of file functions.c.

1912 {
1913  if (!win_pager)
1914  {
1916  return IR_ERROR;
1917  }
1919  struct PagerPrivateData *priv = win_pager->parent->wdata;
1920  if (!priv)
1921  return IR_ERROR;
1923  struct MuttWindow *dlg = dialog_find(win_pager);
1924  if (!dlg || !dlg->wdata)
1925  return IR_ERROR;
1927  int rc = IR_UNKNOWN;
1928  for (size_t i = 0; PagerFunctions[i].op != OP_NULL; i++)
1929  {
1930  const struct PagerFunction *fn = &PagerFunctions[i];
1931  if (fn->op == op)
1932  {
1933  struct IndexSharedData *shared = dlg->wdata;
1934  rc = fn->function(shared, priv, op);
1935  break;
1936  }
1937  }
1939  return rc;
1940 }
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: dialog.c:83
#define mutt_error(...)
Definition: logging.h:87
Unknown key.
Definition: functions.h:35
Valid function - error occurred.
Definition: functions.h:40
#define _(a)
Definition: message.h:28
static const char * Not_available_in_this_menu
Definition: functions.c:77
struct PagerFunction PagerFunctions[]
All the NeoMutt functions that the Pager supports.
Definition: functions.c:1812
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:37
void * wdata
Private data.
Definition: mutt_window.h:145
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:135
A NeoMutt function.
Definition: functions.h:49
pager_function_t function
Function to call.
Definition: functions.h:51
int op
Op code, e.g. OP_MAIN_LIMIT.
Definition: functions.h:50
Private state data for the Pager.
Definition: private_data.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ jump_to_bottom()

bool jump_to_bottom ( struct PagerPrivateData priv,
struct PagerView pview 

Make sure the bottom line is displayed.

privPrivate Pager data
Return values
trueSomething changed
falseBottom was already displayed

Definition at line 194 of file functions.c.

195 {
196  if (!(priv->lines[priv->cur_line].offset < (priv->st.st_size - 1)))
197  {
198  return false;
199  }
201  int line_num = priv->cur_line;
202  /* make sure the types are defined to the end of file */
203  while (display_line(priv->fp, &priv->bytes_read, &priv->lines, line_num,
204  &priv->lines_used, &priv->lines_max,
205  priv->has_types | (pview->flags & MUTT_PAGER_NOWRAP),
206  &priv->quote_list, &priv->q_level, &priv->force_redraw,
207  &priv->search_re, priv->pview->win_pager) == 0)
208  {
209  line_num++;
210  }
211  priv->top_line = up_n_lines(priv->pview->win_pager->state.rows, priv->lines,
212  priv->lines_used, priv->hide_quoted);
213  notify_send(priv->notify, NT_PAGER, NT_PAGER_VIEW, priv);
214  return true;
215 }
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)
Print a line on screen.
Definition: display.c:1038
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:171
Pager data has changed, NotifyPager, PagerPrivateData.
Definition: notify_type.h:50
static int up_n_lines(int nlines, struct Line *info, int cur, bool hiding)
Reposition the pager's view up by n lines.
Definition: functions.c:175
Pager View has changed.
Definition: lib.h:174
Format for term width, ignore $wrap.
Definition: lib.h:72
LOFF_T offset
Offset into Email file (PagerPrivateData->fp)
Definition: display.h:72
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
PagerFlags hide_quoted
Set to MUTT_HIDE when quoted email is hidden <toggle-quoted>
Definition: private_data.h:62
int q_level
Number of unique quoting levels.
Definition: private_data.h:61
int cur_line
Current line (last line visible on screen)
Definition: private_data.h:53
int lines_used
Size of lines array (used entries)
Definition: private_data.h:51
int lines_max
Capacity of lines array (total entries)
Definition: private_data.h:52
bool force_redraw
Repaint is needed.
Definition: private_data.h:73
struct Line * lines
Array of text lines in pager.
Definition: private_data.h:50
int has_types
Definition: private_data.h:58
struct Notify * notify
Notifications: NotifyPager, PagerPrivateData.
Definition: private_data.h:75
LOFF_T bytes_read
Number of bytes read from file.
Definition: private_data.h:48
int top_line
First visible line on screen.
Definition: private_data.h:57
struct stat st
Stats about Email file.
Definition: private_data.h:47
struct QuoteStyle * quote_list
Tree of quoting levels.
Definition: private_data.h:60
struct PagerView * pview
Object to view in the pager.
Definition: private_data.h:44
regex_t search_re
Compiled search string.
Definition: private_data.h:67
FILE * fp
File containing decrypted/decoded/weeded Email.
Definition: private_data.h:46
PagerFlags flags
Additional settings to tweak pager's function.
Definition: lib.h:163
struct MuttWindow * win_pager
Pager Window.
Definition: lib.h:168
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:

Variable Documentation

◆ PagerFunctions

struct PagerFunction PagerFunctions[]

All the NeoMutt functions that the Pager supports.

Definition at line 1797 of file functions.c.