tweaks: remove several unneeded bad-state checks and their messages

No one ever reported seeing any of them, and each of these checks
has been there for at least a year.
This commit is contained in:
Benno Schulenberg 2019-04-14 19:28:15 +02:00
parent 145bb6e01a
commit c039aaad9d
4 changed files with 6 additions and 43 deletions

View File

@ -556,9 +556,6 @@ void help_init(void)
}
}
#endif /* !NANO_TINY */
if (strlen(help_text) > allocsize)
statusline(ALERT, "Help text spilled over -- please report a bug");
}
/* Return the function that is bound to the given key, accepting certain

View File

@ -551,10 +551,6 @@ void do_undo(void)
goto_line_posx(u->lineno, u->begin);
break;
case ENTER:
if (f->next == NULL) {
statusline(ALERT, "Missing break line -- please report a bug");
break;
}
undidmsg = _("line break");
from_x = (u->begin == 0) ? 0 : u->mark_begin_x;
to_x = (u->begin == 0) ? u->mark_begin_x : u->begin;
@ -672,7 +668,6 @@ void do_undo(void)
break;
#endif
default:
statusline(ALERT, "Wrong undo type -- please report a bug");
break;
}
@ -752,10 +747,6 @@ void do_redo(void)
goto_line_posx(u->lineno, u->begin);
break;
case JOIN:
if (f->next == NULL) {
statusline(ALERT, "Missing join line -- please report a bug");
break;
}
redidmsg = _("line join");
/* When the join was done by a Backspace at the tail of the file,
* and the nonewlines flag isn't set, do not join anything, as
@ -838,7 +829,6 @@ void do_redo(void)
break;
#endif
default:
statusline(ALERT, "Wrong redo type -- please report a bug");
break;
}
@ -1264,7 +1254,6 @@ void add_undo(undo_type action)
break;
#endif
default:
statusline(ALERT, "Wrong undo adding type -- please report a bug");
break;
}
@ -1417,7 +1406,6 @@ void update_undo(undo_type action)
u->begin = openfile->current_x;
break;
default:
statusline(ALERT, "Wrong undo update type -- please report a bug");
break;
}
}

View File

@ -329,10 +329,6 @@ char *mallocstrncpy(char *dest, const char *src, size_t n)
if (src == NULL)
src = "";
#ifndef NANO_TINY
if (src == dest)
fprintf(stderr, "\r*** Copying a string to itself -- please report a bug ***");
#endif
dest = charealloc(dest, n);
strncpy(dest, src, n);
@ -512,12 +508,10 @@ linestruct *fsfromline(ssize_t lineno)
while (f->lineno != lineno && f->next != NULL)
f = f->next;
if (f->lineno != lineno) {
statusline(ALERT, "Gone undo line -- please report a bug");
if (f->lineno == lineno)
return f;
else
return NULL;
}
return f;
}
#endif /* !NANO_TINY */

View File

@ -2793,15 +2793,6 @@ int update_line(linestruct *fileptr, size_t index)
row = fileptr->lineno - openfile->edittop->lineno;
/* If the line is offscreen, don't even try to display it. */
if (row < 0 || row >= editwinrows) {
#ifndef NANO_TINY
statusline(ALERT, "Badness: tried to display a line on row %i"
" -- please report a bug", row);
#endif
return 0;
}
/* First, blank out the row. */
blank_row(edit, row, 0, COLS);
@ -3017,20 +3008,13 @@ void edit_scroll(bool direction)
{
linestruct *line;
size_t leftedge;
int remainder = 0, nrows = 1;
int nrows = 1;
/* Move the top line of the edit window one row up or down. */
if (direction == BACKWARD)
remainder = go_back_chunks(1, &openfile->edittop, &openfile->firstcolumn);
go_back_chunks(1, &openfile->edittop, &openfile->firstcolumn);
else
remainder = go_forward_chunks(1, &openfile->edittop, &openfile->firstcolumn);
if (remainder > 0) {
#ifndef NANO_TINY
statusline(ALERT, "Could not scroll -- please report a bug");
#endif
return;
}
go_forward_chunks(1, &openfile->edittop, &openfile->firstcolumn);
/* Actually scroll the text of the edit window one row up or down. */
scrollok(edit, TRUE);