diff --git a/ChangeLog b/ChangeLog index 3d44b671688517ec61e0deb5af9efa43d3f5579c..e8ff7e00409cfdeeeb3a70e22fa79f3e1e23283b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ actually something was inserted. This fixes Savannah bug #45409. * src/files.c (do_insertfile): Rename two variables for clarity. * src/text.c (redo_cut): Delete two redundant assignments. + * src/winio.c (edit_draw): Move a check to a better place. 2015-11-30 Benno Schulenberg <bensberg@justemail.net> * src/text.c (redo_cut, update_undo): When cutting reaches the EOF, diff --git a/src/winio.c b/src/winio.c index e83c353de99e9e5f77e1e8d2ffd8e8bac8f398e5..0aa567132fba93b8117beb7d957feff7036fbe36 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2596,20 +2596,21 @@ void edit_draw(filestruct *fileptr, const char *converted, int start_line = start_line->prev; } + /* If no start was found, skip to the next step. */ + if (start_line == NULL) + goto step_two; + /* If a found start has been qualified as an end earlier, * believe it and skip to the next step. */ - if (start_line != NULL && start_line->multidata != NULL && + if (start_line->multidata != NULL && (start_line->multidata[tmpcolor->id] == CBEGINBEFORE || start_line->multidata[tmpcolor->id] == CSTARTENDHERE)) goto step_two; /* Skip over a zero-length regex match. */ - if (start_line != NULL && startmatch.rm_so == startmatch.rm_eo) + if (startmatch.rm_so == startmatch.rm_eo) startmatch.rm_eo++; else { - /* If no start was found, skip to the next step. */ - if (start_line == NULL) - goto step_two; /* Now start_line is the first line before fileptr * containing a start match. Is there a start on * this line not followed by an end on this line? */