+2015-07-18 Benno Schulenberg <bensberg@justemail.net>
+ * src/winio.c (edit_draw): When looking for multiline-regex matches,
+ look for a new start only after an end, instead of right after the
+ last start. This fixes bug #45525 and bug #41313 on Savannah.
+
+2015-07-17 Benno Schulenberg <bensberg@justemail.net>
+ * src/files.c (open_buffer): Verify that a named and existing file
+ is a normal file, to avoid opening an empty buffer when the name of
+ a directory is specified. This fixes Savannah bug #45383 reported
+ by Mike Frysinger, and also Savannah bug #27839 (which is an echo
+ from Debian bug #551717 reported by Paul Wise).
+
+
+2015-07-13 Benno Schulenberg <bensberg@justemail.net>
+ * src/files.c (replace_buffer): Prevent a segfault when spellchecking
+ a marked region and nonewlines isn't set.
+
2015-07-10 Benno Schulenberg <bensberg@justemail.net>
- * src/nano.c (delete_opennode): Plug a small memory leak.
+ * src/nano.c (delete_opennode): Plug a small memory leak.
2015-06-28 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (add_to_sclist), src/help.c (help_init), src/nano.h,
}
#endif
+ /* When the specified filename is not empty, and the thing exists,
+ * verify that it is a normal file. */
+ if (strcmp(filename, "") != 0) {
+ struct stat fileinfo;
+
+ if (stat(filename, &fileinfo) == 0 && !S_ISREG(fileinfo.st_mode)) {
+ if (S_ISDIR(fileinfo.st_mode))
+ statusbar(_("\"%s\" is a directory"), filename);
+ else
+ statusbar(_("\"%s\" is not a normal file"), filename);
+ beep();
+ return;
+ }
+ }
+
/* If we're loading into a new buffer, add a new entry to
* openfile. */
if (new_buffer) {
/* If opening the file succeeded, read it in. */
if (descriptor > 0)
read_file(f, descriptor, filename, FALSE, TRUE);
+
+ /* Put current at a place that is certain to exist. */
+ openfile->current = openfile->fileage;
}
#endif /* !DISABLE_SPELLER */
/* If the 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 &&
- start_line->multidata[tmpcolor->id] == CBEGINBEFORE)
+ (start_line->multidata[tmpcolor->id] == CBEGINBEFORE ||
+ start_line->multidata[tmpcolor->id] == CSTARTENDHERE))
goto step_two;
/* Skip over a zero-length regex match. */
if (paintlen < 0)
goto end_of_loop;
step_two:
- /* Second step, we look for starts on this line. */
- start_col = 0;
+ /* Second step: look for starts on this line, but start
+ * looking only after an end match, if there is one. */
+ start_col = (paintlen == 0) ? 0 : endmatch.rm_eo;
while (start_col < endpos) {
if (regexec(tmpcolor->start, fileptr->data +
#endif
}
}
+ start_col = endmatch.rm_eo;
} else {
/* There is no end on this line. But we
* haven't yet looked for one on later
fileptr->multidata[tmpcolor->id] = CENDAFTER;
break;
}
+ start_col = startmatch.rm_so + 1;
}
- start_col = startmatch.rm_so + 1;
}
}
}