diff --git a/ChangeLog b/ChangeLog index 7280b16be6c30dd7bf89bfd33bf794b3549d947d..ae4328a2522c2f92f9149ff0703a4a5fffa6e605 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,7 @@ 2009-02-16 Chris Allegretta <chrisa@asty.org> * Add new argument to reset_multis for force redraws without attempting to - guess whether we need to, force updates when running a non-viewok function. - New utility function color.c:reset_multis_for_id(). Fixes e.g. incorrect - highlighting when cutting text. + guess whether we need to, for functions that we don't have good info about + the text state. New utility function color.c:reset_multis_for_id(). 2009-02-15 Chris Allegretta <chrisa@asty.org> * configure.ac, doc/man/Makefile.am - Add check for HTML output support in GNU diff --git a/src/color.c b/src/color.c index e93d1aaca043cde5bccd35a907cfa121c082c661..a8393a4da9a64de9dd2a5a7914de468eb7b6844c 100644 --- a/src/color.c +++ b/src/color.c @@ -344,7 +344,10 @@ void reset_multis(filestruct *fileptr, bool force) if (fileptr->multidata[tmpcolor->id] == CWHOLELINE) { if (nobegin && noend) continue; - } else if (fileptr->multidata[tmpcolor->id] & CBEGINBEFORE && !noend + } else if (fileptr->multidata[tmpcolor->id] == CNONE) { + if (nobegin && noend) + continue; + } else if (fileptr->multidata[tmpcolor->id] & CBEGINBEFORE && !noend && (nobegin || endmatch.rm_eo > startmatch.rm_eo)) { reset_multis_after(fileptr, tmpcolor->id); continue; diff --git a/src/cut.c b/src/cut.c index d4cc7c14e1594248979746226db9010457d2fcf7..f65efd8cdd11589542940d80b0152706fcda0a78 100644 --- a/src/cut.c +++ b/src/cut.c @@ -214,6 +214,10 @@ void do_cut_text( /* Update the screen. */ edit_refresh_needed = TRUE; +#ifdef ENABLE_COLOR + reset_multis(openfile->current, FALSE); +#endif + #ifdef DEBUG dump_filestruct(cutbuffer); #endif @@ -277,6 +281,10 @@ void do_uncut_text(void) /* Update the screen. */ edit_refresh_needed = TRUE; +#ifdef ENABLE_COLOR + reset_multis(openfile->current, FALSE); +#endif + #ifdef DEBUG dump_filestruct_reverse(); #endif diff --git a/src/global.c b/src/global.c index 0c8e282a2cd2ed30de683c0c37f18bba06b45cc8..54b337d688a480c88b0fee83cd88d5152132a40f 100644 --- a/src/global.c +++ b/src/global.c @@ -1715,9 +1715,11 @@ void thanks_for_all_the_fish(void) if (jusbuffer != NULL) free_filestruct(jusbuffer); #endif +#ifdef DEBUG /* Free the memory associated with each open file buffer. */ if (openfile != NULL) free_openfilestruct(openfile); +#endif #ifdef ENABLE_COLOR if (syntaxstr != NULL) free(syntaxstr); diff --git a/src/nano.c b/src/nano.c index 87c370514eaa9e39d34fec407666a3199f8ee382..c61b11ccc058bde7f659e30695fc4137b44c89e6 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1590,24 +1590,31 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool *ran_func = TRUE; if (ISSET(VIEW_MODE) && f && !f->viewok) print_view_warning(); - else + else { #ifndef NANO_TINY if (s->scfunc == DO_TOGGLE) do_toggle(s->toggle); else { +#else + { #endif iso_me_harder_funcmap(s->scfunc); #ifdef ENABLE_COLOR if (!f->viewok && openfile->syntax != NULL && openfile->syntax->nmultis > 0) { - reset_multis(openfile->current, TRUE); + reset_multis(openfile->current, FALSE); } if (edit_refresh_needed) { +#ifdef DEBUG + fprintf(stderr, "running edit_refresh() as edit_refresh_needed is true\n"); +#endif edit_refresh(); edit_refresh_needed = FALSE; } + #endif } + } #ifndef NANO_TINY } #endif diff --git a/src/text.c b/src/text.c index 83ef8e057196c1d19a6da3f11c21040b8135e3c4..6f954b128a92aa37de52f49684395dc51721e3ae 100644 --- a/src/text.c +++ b/src/text.c @@ -140,13 +140,6 @@ void do_delete(void) set_modified(); -#ifdef ENABLE_COLOR - /* If color syntaxes are available and turned on, we need to call - * edit_refresh(). */ - if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) - do_refresh = TRUE; -#endif - if (do_refresh) edit_refresh_needed = TRUE; else