in do_uncut_text(), maintain current_y's value when uncutting blocks so

that smooth scrolling works correctly; also add a few miscellaneous
cleanups


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2075 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2004-11-06 20:33:43 +00:00
parent 8c16bacbbf
commit 00cca05ebb
2 changed files with 15 additions and 7 deletions

View File

@ -112,8 +112,11 @@ CVS code -
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

View File

@ -240,8 +240,7 @@ void do_cut_text(void)
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);
@ -403,9 +402,11 @@ void do_uncut_text(void)
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;
}
@ -426,6 +427,7 @@ void do_uncut_text(void)
totlines++;
totsize++;
}
/* Renumber from BEFORE where we pasted ;) */
renumber(hold);
@ -444,6 +446,7 @@ void do_uncut_text(void)
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 => */
@ -454,9 +457,11 @@ void do_uncut_text(void)
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();