tweaks: drop some checks that were made redundant by the previous commit

And move one to a better place.
This commit is contained in:
Benno Schulenberg 2019-05-29 11:42:23 +02:00
parent 3eab405e7b
commit 821445d284
2 changed files with 5 additions and 9 deletions

View File

@ -421,7 +421,7 @@ bool open_buffer(const char *filename, bool new_buffer)
as_an_at = FALSE; as_an_at = FALSE;
#ifdef ENABLE_OPERATINGDIR #ifdef ENABLE_OPERATINGDIR
if (!inhelp && outside_of_confinement(filename, FALSE)) { if (outside_of_confinement(filename, FALSE)) {
statusline(ALERT, _("Can't read file from outside of %s"), statusline(ALERT, _("Can't read file from outside of %s"),
operating_dir); operating_dir);
return FALSE; return FALSE;
@ -456,7 +456,7 @@ bool open_buffer(const char *filename, bool new_buffer)
if (new_buffer) { if (new_buffer) {
make_new_buffer(); make_new_buffer();
if (!inhelp && has_valid_path(realname)) { if (has_valid_path(realname)) {
#ifndef NANO_TINY #ifndef NANO_TINY
if (ISSET(LOCKING) && filename[0] != '\0') { if (ISSET(LOCKING) && filename[0] != '\0') {
/* When not overriding an existing lock, discard the buffer. */ /* When not overriding an existing lock, discard the buffer. */
@ -655,7 +655,7 @@ bool close_buffer(void)
return FALSE; return FALSE;
#ifdef ENABLE_HISTORIES #ifdef ENABLE_HISTORIES
if (ISSET(POSITIONLOG)) if (ISSET(POSITIONLOG) && !inhelp)
update_poshistory(openfile->filename, update_poshistory(openfile->filename,
openfile->current->lineno, xplustabs() + 1); openfile->current->lineno, xplustabs() + 1);
#endif #endif
@ -886,10 +886,6 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
/* Set the desired x position at the end of what was inserted. */ /* Set the desired x position at the end of what was inserted. */
openfile->placewewant = xplustabs(); openfile->placewewant = xplustabs();
/* If we've read a help file, don't give any feedback. */
if (inhelp)
return;
if (!writable) if (!writable)
statusline(ALERT, _("File '%s' is unwritable"), filename); statusline(ALERT, _("File '%s' is unwritable"), filename);
#ifndef NANO_TINY #ifndef NANO_TINY
@ -984,7 +980,7 @@ int open_file(const char *filename, bool newfie, FILE **f)
statusline(ALERT, _("Error reading %s: %s"), filename, strerror(errno)); statusline(ALERT, _("Error reading %s: %s"), filename, strerror(errno));
close(fd); close(fd);
fd = -1; fd = -1;
} else if (!inhelp) } else
statusbar(_("Reading...")); statusbar(_("Reading..."));
} }

View File

@ -528,7 +528,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
poshiststruct *posptr, *theone, *posprev = NULL; poshiststruct *posptr, *theone, *posprev = NULL;
char *fullpath = get_full_path(filename); char *fullpath = get_full_path(filename);
if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/' || inhelp) { if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/') {
free(fullpath); free(fullpath);
return; return;
} }