treat color syntax names case sensitively, for consistency with how

their filename regexes are treated


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2960 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-08-01 04:34:27 +00:00
parent 179b1bad87
commit 5a584ccda3
3 changed files with 17 additions and 15 deletions

View File

@ -59,16 +59,17 @@ CVS code -
thanks_for_all_the_fish(), nregcomp(), parse_syntax(), and thanks_for_all_the_fish(), nregcomp(), parse_syntax(), and
parse_colors(). (Brand Huntsman and DLR) parse_colors(). (Brand Huntsman and DLR)
- Various other color fixes. Handle unspecified foreground - Various other color fixes. Handle unspecified foreground
colors properly, flag duplicate syntax names as errors, don't colors properly, treat syntax names case sensitively, flag
automatically reinitialize the displayed colors every time we duplicate syntax names as errors, don't automatically
update the current buffer's colors (since the buffer may not reinitialize the displayed colors every time we update the
be displayed immediately), don't bother doing complete current buffer's colors (since the buffer may not be displayed
refreshes of the screen when color support is enabled if immediately), don't bother doing complete refreshes of the
there's no regex associated with the current file, and rename screen when color support is enabled if there's no regex
variable exttype->val to exttype->ext, for consistency. associated with the current file, and rename variable
Changes to do_colorinit() (renamed color_init()), exttype->val to exttype->ext, for consistency. Changes to
update_color() (renamed color_update()), write_file(), do_colorinit() (renamed color_init()), update_color() (renamed
do_input(), do_output(), and parse_syntax(). (DLR) color_update()), write_file(), do_input(), do_output(), and
parse_syntax(). (DLR)
- Simplify get_totals() to only get the total number of - Simplify get_totals() to only get the total number of
characters, and eliminate dependence on its old ability to get characters, and eliminate dependence on its old ability to get
the total number of lines by renumber()ing when necessary and the total number of lines by renumber()ing when necessary and
@ -131,7 +132,7 @@ CVS code -
titlebar(), statusbar(), bottombars(), edit_refresh(), titlebar(), statusbar(), bottombars(), edit_refresh(),
do_yesno(), and do_help(). (DLR) do_yesno(), and do_help(). (DLR)
- color.c: - color.c:
- Remove unneeded string.h and fcntl.h includes. (DLR) - Remove unneeded fcntl.h include. (DLR)
- chars.c: - chars.c:
mbrep() mbrep()
- New function, the equivalent of control_mbrep() for non-control - New function, the equivalent of control_mbrep() for non-control

View File

@ -25,6 +25,7 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "proto.h" #include "proto.h"
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
@ -118,7 +119,7 @@ void color_update(void)
if (syntaxstr != NULL) { if (syntaxstr != NULL) {
for (tmpsyntax = syntaxes; tmpsyntax != NULL; for (tmpsyntax = syntaxes; tmpsyntax != NULL;
tmpsyntax = tmpsyntax->next) { tmpsyntax = tmpsyntax->next) {
if (mbstrcasecmp(tmpsyntax->desc, syntaxstr) == 0) if (strcmp(tmpsyntax->desc, syntaxstr) == 0)
openfile->colorstrings = tmpsyntax->color; openfile->colorstrings = tmpsyntax->color;
if (openfile->colorstrings != NULL) if (openfile->colorstrings != NULL)
@ -138,7 +139,7 @@ void color_update(void)
* extensions. (We've checked for this and for duplicate * extensions. (We've checked for this and for duplicate
* syntax names elsewhere.) Skip over it here, but keep * syntax names elsewhere.) Skip over it here, but keep
* track of its color regexes. */ * track of its color regexes. */
if (mbstrcasecmp(tmpsyntax->desc, "default") == 0) { if (strcmp(tmpsyntax->desc, "default") == 0) {
defcolor = syntaxes->color; defcolor = syntaxes->color;
continue; continue;
} }

View File

@ -295,7 +295,7 @@ void parse_syntax(char *ptr)
for (tmpsyntax = syntaxes; tmpsyntax != NULL; for (tmpsyntax = syntaxes; tmpsyntax != NULL;
tmpsyntax = tmpsyntax->next) { tmpsyntax = tmpsyntax->next) {
if (mbstrcasecmp(nameptr, tmpsyntax->desc) == 0) { if (strcmp(nameptr, tmpsyntax->desc) == 0) {
rcfile_error(N_("Duplicate syntax name %s"), nameptr); rcfile_error(N_("Duplicate syntax name %s"), nameptr);
return; return;
} }
@ -323,7 +323,7 @@ void parse_syntax(char *ptr)
#endif #endif
/* The default syntax should have no associated extensions. */ /* The default syntax should have no associated extensions. */
if (mbstrcasecmp(endsyntax->desc, "default") == 0 && *ptr != '\0') { if (strcmp(endsyntax->desc, "default") == 0 && *ptr != '\0') {
rcfile_error(N_("The default syntax must take no extensions")); rcfile_error(N_("The default syntax must take no extensions"));
return; return;
} }