Commit 1dd0bc98 authored by Chris Allegretta's avatar Chris Allegretta
Browse files

Remove malloc.h completely and add color synatx highlighting toggle

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1300 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 23 additions and 7 deletions
+23 -7
CVS code -
- General:
- Translation updates (see po/ChangeLog for details).
- Remove malloc.h, as it's unneeded and just causes annoyances on
*BSD systems. Added stdlib.h to global.c
- Added Meta-Y toggle to disable/enable color syntax highlighting
completely. This may eventually be per-buffer, but that's too
complicated for a feature freeze.
GNU nano 1.1.11 - 10/01/2002
- General:
......
......@@ -15,7 +15,7 @@ AC_SYS_LARGEFILE
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h regex.h)
AC_CHECK_HEADERS(fcntl.h unistd.h termios.h termio.h limits.h getopt.h regex.h)
dnl options
AC_ARG_ENABLE(debug,
......
......@@ -21,6 +21,7 @@
#include "config.h"
#include <stdlib.h>
#include <assert.h>
#include <sys/stat.h>
#include "proto.h"
......@@ -222,6 +223,9 @@ void toggle_init(void)
#ifdef ENABLE_MULTIBUFFER
char *toggle_load_msg;
#endif
#ifdef ENABLE_COLOR
char *toggle_syntax_msg;
#endif
/* There is no need to reinitialize the toggles. They can't
change. In fact, reinitializing them causes a segfault in
......@@ -242,6 +246,9 @@ void toggle_init(void)
toggle_mac_msg = _("Writing file in Mac format");
toggle_backup_msg = _("Backing up file");
toggle_smooth_msg = _("Smooth scrolling");
#ifdef ENABLE_COLOR
toggle_syntax_msg = _("Color syntax highlighting");
#endif
#ifndef DISABLE_WRAPPING
toggle_wrap_msg = _("Auto wrap");
#endif
......@@ -267,6 +274,9 @@ void toggle_init(void)
toggle_init_one(TOGGLE_MAC_KEY, toggle_mac_msg, MAC_FILE);
toggle_init_one(TOGGLE_BACKUP_KEY, toggle_backup_msg, BACKUP_FILE);
toggle_init_one(TOGGLE_SMOOTH_KEY, toggle_smooth_msg, SMOOTHSCROLL);
#ifdef ENABLE_COLOR
toggle_init_one(TOGGLE_SYNTAX_KEY, toggle_syntax_msg, COLOR_SYNTAX);
#endif
}
#ifdef DEBUG
......
......@@ -2838,6 +2838,9 @@ void do_toggle(const toggle *which)
case TOGGLE_MAC_KEY:
UNSET(DOS_FILE);
break;
case TOGGLE_SYNTAX_KEY:
edit_refresh();
break;
}
/* We are assuming here that shortcut_init() above didn't free and
......
......@@ -19,10 +19,6 @@
* *
**************************************************************************/
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
......@@ -174,7 +170,6 @@ typedef struct syntaxtype {
exttype *extensions; /* List of extensions that this applies to */
colortype *color; /* color struct for this syntax */
struct syntaxtype *next;
} syntaxtype;
#endif /* ENABLE_COLOR */
......@@ -211,6 +206,7 @@ typedef struct syntaxtype {
#define NO_CONVERT (1<<26)
#define BACKUP_FILE (1<<27)
#define NO_RCFILE (1<<28)
#define COLOR_SYNTAX (1<<28)
/* Control key sequences, changing these would be very very bad */
......@@ -364,6 +360,7 @@ know what you're doing */
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
#define TOGGLE_NOCONVERT_KEY NANO_ALT_N
#define TOGGLE_BACKUP_KEY NANO_ALT_B
#define TOGGLE_SYNTAX_KEY NANO_ALT_Y
#endif /* !NANO_SMALL */
#define MAIN_VISIBLE 12
......
......@@ -275,6 +275,7 @@ void parse_syntax(char *ptr)
if (syntaxes == NULL) {
syntaxes = (syntaxtype *)nmalloc(sizeof(syntaxtype));
tmpsyntax = syntaxes;
SET(COLOR_SYNTAX);
} else {
for (tmpsyntax = syntaxes; tmpsyntax->next != NULL;
tmpsyntax = tmpsyntax->next)
......
......@@ -614,7 +614,7 @@ void edit_add(const filestruct *fileptr, int yval, int start
mvwaddnstr(edit, yval, 0, &fileptr->data[start], COLS);
#ifdef ENABLE_COLOR
if (colorstrings != NULL) {
if (colorstrings != NULL && ISSET(COLOR_SYNTAX)) {
const colortype *tmpcolor = colorstrings;
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment