in files.c, and replace them with a static file_format enum.
Change the openfilestruct structure accordingly in order to
handle this. (DLR)
+ - Convert some ints with predefined boundaries to enums. (DLR)
- cut.c:
- - Make marked_line a static enum instead of a static int. (DLR)
+ do_uncut_text()
+ - Maintain current_y's value when uncutting blocks so that
+ smooth scrolling works correctly. (DLR)
- files.c:
read_file()
- Rename variable fileformat to format, to avoid confusion with
if (marked_cut != CUT_MARKED && current->next != filebot) {
filestruct *junk = make_new_node(current);
- junk->data = charalloc(1);
- junk->data[0] = '\0';
+ junk->data = mallocstrcpy(NULL, "");
add_to_cutbuffer(junk, TRUE);
#ifdef DEBUG
dump_buffer(cutbuffer);
new_magicline();
}
- /* Now why don't we update the totsize also? */
- for (tmp = current->next; tmp != newend; tmp = tmp->next)
+ /* Recalculate current_y and totsize. */
+ for (tmp = current->next; tmp != newend; tmp = tmp->next) {
+ current_y++;
totsize += strlen(tmp->data) + 1;
+ }
current = newend;
}
totlines++;
totsize++;
}
+
/* Renumber from BEFORE where we pasted ;) */
renumber(hold);
newbuf->prev = tmp;
} else
fileage = newbuf;
+
totlines++; /* Unmarked uncuts don't split lines. */
/* This is so uncutting at the top of the buffer will work => */
newend->next = current;
current->prev = newend;
- /* Recalculate size *sigh* */
- for (tmp = newbuf; tmp != current; tmp = tmp->next)
+ /* Recalculate current_y and totsize. */
+ for (tmp = newbuf; tmp != current; tmp = tmp->next) {
+ current_y++;
totsize += strlen(tmp->data) + 1;
+ }
renumber(newbuf);
edit_refresh();