NeoMutt  2021-02-05
Teaching an old dog new tricks
mutt_curses.c File Reference

Define wrapper functions around Curses/Slang. More...

#include "config.h"
#include "mutt_curses.h"
#include "color.h"
#include "mutt_globals.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 (enum ColorId color)
 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/Slang.

  • 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 40 of file mutt_curses.c.

41 {
42 #ifdef HAVE_BKGDSET
43  bkgdset(attr | ' ');
44 #else
45  attrset(attr);
46 #endif
47 }
+ Here is the caller graph for this function:

◆ mutt_curses_set_color()

void mutt_curses_set_color ( enum ColorId  color)

Set the current colour for text.

colorColour 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 57 of file mutt_curses.c.

58 {
59  if (!Colors)
60  return;
61 #ifdef HAVE_BKGDSET
62  if (Colors->defs[color] != 0)
63  bkgdset(Colors->defs[color] | ' ');
64  else
65  bkgdset(Colors->defs[MT_COLOR_NORMAL] | ' ');
66 #else
67  if (Colors->defs[color] != 0)
68  attrset(Colors->defs[color]);
69  else
70  attrset(Colors->defs[MT_COLOR_NORMAL]);
71 #endif
72 }
int * defs
Array of all fixed colours, see enum ColorId.
Definition: color.h:131
Plain text.
Definition: color.h:77
Definition: color.h:129
+ 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 78 of file mutt_curses.c.

79 {
80 #if (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET))
81  static int SavedCursor = MUTT_CURSOR_VISIBLE;
83  if (state == MUTT_CURSOR_RESTORE_LAST)
84  state = SavedCursor;
85  else
86  SavedCursor = state;
88  if (curs_set(state) == ERR)
89  {
90  if (state == MUTT_CURSOR_VISIBLE)
92  }
93 #endif
94 }
Display a very visible cursor.
Definition: mutt_curses.h:82
Display a normal cursor.
Definition: mutt_curses.h:81
Restore the previous cursor state.
Definition: mutt_curses.h:79
+ Here is the caller graph for this function: