From: Chris Allegretta Date: Sun, 17 Mar 2013 22:09:38 +0000 (+0000) Subject: 2013-03-17 Chris Allegretta X-Git-Tag: v2.3.2~1 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=22c83ec7afb37b1052ffe809676435d2004e03dc;p=nano.git 2013-03-17 Chris Allegretta * Revert r4547 as we should have a new release and the overlap code is not yet ready for public consumption. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4569 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 927f01fe..e032ca70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-03-17 Chris Allegretta + * Revert r4547 as we should have a new release and the overlap code is not yet + ready for public consumption. + 2013-01-20 Chris Allegretta * src/text.c (do_histify): Don't allow sigwinch to be received while justifying as that puts us into a wacky state. Fixess crash on justify by Joshua Rogers. diff --git a/src/nano.h b/src/nano.h index bb737943..4339f881 100644 --- a/src/nano.h +++ b/src/nano.h @@ -192,11 +192,10 @@ typedef enum { } undo_type; #ifdef ENABLE_COLOR -#define COLORWIDTH short typedef struct colortype { - COLORWIDTH fg; + short fg; /* This syntax's foreground color. */ - COLORWIDTH bg; + short bg; /* This syntax's background color. */ bool bright; /* Is this color A_BOLD? */ @@ -215,9 +214,7 @@ typedef struct colortype { /* The compiled end (if any) of the regex string. */ struct colortype *next; /* Next set of colors. */ - bool overlap; - /* Is it acceptable for other regexes to overlap this one? */ - int id; + int id; /* basic id for assigning to lines later */ } colortype; diff --git a/src/proto.h b/src/proto.h index 94e592c4..3b002a4b 100644 --- a/src/proto.h +++ b/src/proto.h @@ -556,7 +556,7 @@ char *parse_next_word(char *ptr); char *parse_argument(char *ptr); #ifdef ENABLE_COLOR char *parse_next_regex(char *ptr); -bool nregcomp(const char *regex, int cflags); +bool nregcomp(const char *regex, int eflags); void parse_syntax(char *ptr); void parse_magic_syntax(char *ptr); void parse_include(char *ptr); diff --git a/src/rcfile.c b/src/rcfile.c index 991eba93..e4b2d286 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -228,11 +228,11 @@ char *parse_next_regex(char *ptr) /* Compile the regular expression regex to see if it's valid. Return * TRUE if it is, or FALSE otherwise. */ -bool nregcomp(const char *regex, int cflags) +bool nregcomp(const char *regex, int eflags) { regex_t preg; const char *r = fixbounds(regex); - int rc = regcomp(&preg, r, REG_EXTENDED | cflags); + int rc = regcomp(&preg, r, REG_EXTENDED | eflags); if (rc != 0) { size_t len = regerror(rc, &preg, NULL, 0); @@ -680,9 +680,9 @@ void parse_include(char *ptr) /* Return the short value corresponding to the color named in colorname, * and set bright to TRUE if that color is bright. */ -COLORWIDTH color_to_short(const char *colorname, bool *bright) +short color_to_short(const char *colorname, bool *bright) { - COLORWIDTH mcolor = -1; + short mcolor = -1; assert(colorname != NULL && bright != NULL); @@ -722,7 +722,7 @@ COLORWIDTH color_to_short(const char *colorname, bool *bright) * as case insensitive. */ void parse_colors(char *ptr, bool icase) { - COLORWIDTH fg, bg; + short fg, bg; bool bright = FALSE, no_fgcolor = FALSE; char *fgstr; @@ -872,7 +872,7 @@ void parse_colors(char *ptr, bool icase) 0)) ? mallocstrcpy(NULL, fgstr) : NULL; /* Lame way to skip another static counter */ - newcolor->id = endsyntax->nmultis; + newcolor->id = endsyntax->nmultis; endsyntax->nmultis++; } } diff --git a/src/winio.c b/src/winio.c index bc7c4044..b032c050 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2501,29 +2501,14 @@ void edit_draw(filestruct *fileptr, const char *converted, int * them. */ if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) { const colortype *tmpcolor = openfile->colorstrings; - int i, coloruid = 0; /* We need a unique color ID now */ - static filestruct *lastptr = NULL; - static COLORWIDTH *slmatcharray = NULL; - /* Array to track how much we've painted of the line for single line matches */ - - if (lastptr != fileptr || start == 0) { - if (slmatcharray != NULL) - free(slmatcharray); - slmatcharray = (COLORWIDTH *)nmalloc(strlenpt(fileptr->data) * sizeof(COLORWIDTH)); - - /* Init slmatcharray */ - for (i = 0; i < strlenpt(fileptr->data); i++) - slmatcharray[i] = -1; - } - /* Set up multi-line color data for this line if it's not yet calculated */ if (fileptr->multidata == NULL && openfile->syntax && openfile->syntax->nmultis > 0) { + int i; fileptr->multidata = (short *) nmalloc(openfile->syntax->nmultis * sizeof(short)); - for (i = 0; i < openfile->syntax->nmultis; i++) + for (i = 0; i < openfile->syntax->nmultis; i++) fileptr->multidata[i] = -1; /* Assue this applies until we know otherwise */ - } for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) { int x_start; @@ -2538,7 +2523,6 @@ void edit_draw(filestruct *fileptr, const char *converted, int regmatch_t endmatch; /* Match position for end_regex. */ - coloruid++; if (tmpcolor->bright) wattron(edit, A_BOLD); wattron(edit, COLOR_PAIR(tmpcolor->pairnum)); @@ -2546,7 +2530,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int * that there is a match. Also, rm_eo is the first * non-matching character after the match. */ - /* First case,tmpcolor is a single-line expression. */ + /* First case, tmpcolor is a single-line expression. */ if (tmpcolor->end == NULL) { size_t k = 0; @@ -2555,8 +2539,6 @@ void edit_draw(filestruct *fileptr, const char *converted, int * want to ignore them, so that we can highlight e.g. C * strings correctly. */ while (k < endpos) { - bool paintok = TRUE; - /* Note the fifth parameter to regexec(). It says * not to match the beginning-of-line character * unless k is zero. If regexec() returns @@ -2566,8 +2548,6 @@ void edit_draw(filestruct *fileptr, const char *converted, int &startmatch, (k == 0) ? 0 : REG_NOTBOL) == REG_NOMATCH) break; - - /* Translate the match to the beginning of the * line. */ startmatch.rm_so += k; @@ -2578,8 +2558,6 @@ void edit_draw(filestruct *fileptr, const char *converted, int startmatch.rm_eo++; else if (startmatch.rm_so < endpos && startmatch.rm_eo > startpos) { - size_t pbegin = strnlenpt(fileptr->data, startmatch.rm_so); - x_start = (startmatch.rm_so <= startpos) ? 0 : strnlenpt(fileptr->data, startmatch.rm_so) - start; @@ -2592,25 +2570,10 @@ void edit_draw(filestruct *fileptr, const char *converted, int assert(0 <= x_start && 0 <= paintlen); - /* Check that the match is not preceeded by another previous - (single line) match before proceeding to paint it */ - if (slmatcharray[pbegin] != -1 && slmatcharray[pbegin] != coloruid) - paintok = FALSE; - - if (paintok == TRUE) { - int p; - - mvwaddnstr(edit, line, x_start, converted + + mvwaddnstr(edit, line, x_start, converted + index, paintlen); - for (p = pbegin; p < pbegin + (startmatch.rm_eo - startmatch.rm_so); p++) { - slmatcharray[p] = coloruid; /* Add to our match array for the proper length */ - } - } } - if (paintok) - k = startmatch.rm_eo; - else - k = startmatch.rm_so + 1; + k = startmatch.rm_eo; } } else if (fileptr->multidata != NULL && fileptr->multidata[tmpcolor->id] != CNONE) { /* This is a multi-line regex. There are two steps. @@ -2797,7 +2760,6 @@ void edit_draw(filestruct *fileptr, const char *converted, int wattroff(edit, A_BOLD); wattroff(edit, COLOR_PAIR(tmpcolor->pairnum)); } - lastptr = fileptr; } #endif /* ENABLE_COLOR */