NeoMutt  2021-10-29-225-gb9986f
Teaching an old dog new tricks
mutt_curses.c File Reference

Define wrapper functions around Curses. More...

#include "config.h"
#include "mutt_curses.h"
#include "color/lib.h"
+ Include dependency graph for mutt_curses.c:

Go to the source code of this file.


void mutt_curses_set_attr (int attr)
 Set the attributes for text. More...
void mutt_curses_set_color_by_id (enum ColorId cid)
 Set the current colour for text. More...
void mutt_curses_set_cursor (enum MuttCursorState state)
 Set the cursor state. More...

Detailed Description

Define wrapper functions around Curses.

  • Michael R. Elkins
  • g10 Code GmbH
  • 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 mutt_curses.c.

Function Documentation

◆ mutt_curses_set_attr()

void mutt_curses_set_attr ( int  attr)

Set the attributes for text.

attrAttributes to set, e.g. A_UNDERLINE

Definition at line 39 of file mutt_curses.c.

40 {
41  bkgdset(attr | ' ');
42 }
+ Here is the caller graph for this function:

◆ mutt_curses_set_color_by_id()

void mutt_curses_set_color_by_id ( enum ColorId  cid)

Set the current colour for text.

cidColour to set, e.g. MT_COLOR_HEADER

If the system has bkgdset() use it rather than attrset() so that the clr*() functions will properly set the background attributes all the way to the right column.

Definition at line 52 of file mutt_curses.c.

53 {
54  const int chosen = simple_color_get(cid);
55  const int normal = simple_color_get(MT_COLOR_NORMAL);
56  bkgdset((chosen ? chosen : normal) | ' ');
57 }
int simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition: simple.c:68
Plain text.
Definition: color.h:53
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_curses_set_cursor()

void mutt_curses_set_cursor ( enum MuttCursorState  state)

Set the cursor state.

stateState to set, e.g. MUTT_CURSOR_INVISIBLE

Definition at line 63 of file mutt_curses.c.

64 {
65  static int SavedCursor = MUTT_CURSOR_VISIBLE;
67  if (state == MUTT_CURSOR_RESTORE_LAST)
68  state = SavedCursor;
69  else
70  SavedCursor = state;
72  if (curs_set(state) == ERR)
73  {
74  if (state == MUTT_CURSOR_VISIBLE)
76  }
77 }
Restore the previous cursor state.
Definition: mutt_curses.h:53
Display a normal cursor.
Definition: mutt_curses.h:55
Display a very visible cursor.
Definition: mutt_curses.h:56
+ Here is the caller graph for this function: