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.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4378 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Chris Allegretta 2009-02-16 21:04:00 +00:00
parent 7aec392993
commit 9555e1d118
5 changed files with 30 additions and 13 deletions

View File

@ -1,3 +1,9 @@
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.
2009-02-15 Chris Allegretta <chrisa@asty.org>
* configure.ac, doc/man/Makefile.am - Add check for HTML output support in GNU
groff. Fixes Savannah bug #24461: build traps on groff. Also, add installation

View File

@ -305,9 +305,18 @@ void reset_multis_before(filestruct *fileptr, int mindex)
edit_refresh_needed = TRUE;
}
/* Reset one multiline regex info */
void reset_multis_for_id(filestruct *fileptr, int num)
{
reset_multis_before(fileptr, num);
reset_multis_after(fileptr, num);
fileptr->multidata[num] = -1;
}
/* Reset multi line strings around a filestruct ptr, trying to be smart about stopping */
void reset_multis(filestruct *fileptr)
/* Reset multi line strings around a filestruct ptr, trying to be smart about stopping
force = reset everything regardless, useful when we don't know how much screen state
has changed */
void reset_multis(filestruct *fileptr, bool force)
{
int nobegin, noend;
regmatch_t startmatch, endmatch;
@ -323,6 +332,11 @@ void reset_multis(filestruct *fileptr)
continue;
alloc_multidata_if_needed(fileptr);
if (force == TRUE) {
reset_multis_for_id(fileptr, tmpcolor->id);
continue;
}
/* Figure out where the first begin and end are to determine if
things changed drastically for the precalculated multi values */
nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
@ -337,9 +351,7 @@ void reset_multis(filestruct *fileptr)
}
/* If we got here assume the worst */
reset_multis_before(fileptr, tmpcolor->id);
reset_multis_after(fileptr, tmpcolor->id);
fileptr->multidata[tmpcolor->id] = -1;
reset_multis_for_id(fileptr, tmpcolor->id);
}
}
#endif /* ENABLE_COLOR */

View File

@ -211,9 +211,8 @@ void do_cut_text(
* modified. */
set_modified();
/* Update the screen. */
edit_refresh();
edit_refresh_needed = TRUE;
#ifdef DEBUG
dump_filestruct(cutbuffer);
@ -276,7 +275,7 @@ void do_uncut_text(void)
set_modified();
/* Update the screen. */
edit_refresh();
edit_refresh_needed = TRUE;
#ifdef DEBUG
dump_filestruct_reverse();

View File

@ -1598,9 +1598,9 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
#endif
iso_me_harder_funcmap(s->scfunc);
#ifdef ENABLE_COLOR
if (!f->viewok && openfile->syntax != NULL
&& openfile->current->multidata && openfile->syntax->nmultis > 0) {
reset_multis(openfile->current);
if (!f->viewok && openfile->syntax != NULL
&& openfile->syntax->nmultis > 0) {
reset_multis(openfile->current, TRUE);
}
if (edit_refresh_needed) {
edit_refresh();
@ -1927,7 +1927,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#ifdef ENABLE_COLOR
reset_multis(openfile->current);
reset_multis(openfile->current, FALSE);
#endif
if (do_refresh) {
edit_refresh();

View File

@ -543,7 +543,7 @@ void parse_syntax(char *ptr);
void parse_include(char *ptr);
short color_to_short(const char *colorname, bool *bright);
void parse_colors(char *ptr, bool icase);
void reset_multis(filestruct *fileptr);
void reset_multis(filestruct *fileptr, bool force);
void alloc_multidata_if_needed(filestruct *fileptr);
#endif
void parse_rcfile(FILE *rcstream