until a pageup/down occurs (22).
- edit_refresh() and update_line() (and related functions), have
trouble when a tab is the character that is the boundry at COLS (23)
+- there is an off-by-one error in keeping track of totsize. It is caused
+ by the fact that we count the newline at the end when we read in a file
+ but we do not, in fact, display this newline. This should go away
+ implicitly when the "Magic Line" returns, but it is noted here for
+ documentation's sake. (24)
inptr->data);
#endif
- totsize -= strlen(inptr->data) + 1;
+ totsize -= strlen(inptr->data);
tmp = cutbuffer;
if (cutbuffer == NULL) {
cutbuffer = inptr;
next = tmp->next;
add_to_cutbuffer(tmp);
totlines--;
+ totsize--; /* newline (add_to_cutbuffer doesn't count newlines) */
tmp = next;
}
while (next != bot && next != NULL);
next = bot->next;
/* We explicitly don't decrement totlines here because we don't snarf
- * up a newline when we're grabbing the last line of the mark */
+ * up a newline when we're grabbing the last line of the mark. For
+ * the same reason we don't do an extra totsize decrement */
add_to_cutbuffer(bot);
top->next = next;
UNSET(MARK_ISSET);
marked_cut = 1;
set_modified();
- edit_update_top(edittop);
+ edit_update(current);
return 1;
#else
if (0) {
current = fileptr;
} else {
add_to_cutbuffer(fileptr);
- totlines--;
fileage = make_new_node(NULL);
fileage->data = nmalloc(1);
- strcpy(fileage->data, "");
+ fileage->data[0] = '\0';
current = fileage;
}
} else {
for (fileptr = current->next; fileptr != NULL; fileptr = fileptr->next)
tot += strlen(fileptr->data) + 1;
- /* FIXME - This is gardly elegant */
-/* if (current == fileage && strlen(current->data) == 0)
- i = 0;
-*/
-
if (totlines > 0)
linepct = 100 * current->lineno / totlines;
else