Backported 1.1 fixes for edit_refresh instead of edit_update when cut/uncut text can fit on screen

git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_1_0_branch/nano@885 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Chris Allegretta 2001-10-25 14:35:27 +00:00
parent 5beded351c
commit f5fd540f44
2 changed files with 39 additions and 8 deletions

View File

@ -7,6 +7,12 @@ CVS code -
1" as the COPYING file is actually version 2 of the GPL (bug 1" as the COPYING file is actually version 2 of the GPL (bug
noticed by Jordi Mallach). noticed by Jordi Mallach).
- cut.c: - cut.c:
do_cut_text()
- Backported 1.1 fixes for just doing edit_update when we cut
text instead of edit_update.
do_uncut_text()
- Backported David Lawrence Ramsey's fixes for doing refresh
instead of edit_update when uncutting text.
cut_marked_segment() cut_marked_segment()
- Fix off-by one in mem allocation. - Fix off-by one in mem allocation.
- nano.c: - nano.c:

41
cut.c
View File

@ -142,7 +142,7 @@ int do_cut_text(void)
#ifndef NANO_SMALL #ifndef NANO_SMALL
char *tmpstr; char *tmpstr;
int newsize, cuttingtoend = 0; int newsize, cuttingtoend = 0;
int cuttingpartialline = 0; int dontupdate = 0;
#endif #endif
@ -201,7 +201,7 @@ int do_cut_text(void)
} }
if (ISSET(MARK_ISSET)) { if (ISSET(MARK_ISSET)) {
if (current->lineno == mark_beginbuf->lineno) { if (current->lineno == mark_beginbuf->lineno) {
cuttingpartialline = 1; dontupdate = 1;
tmp = copy_node(current); tmp = copy_node(current);
newsize = abs(mark_beginx - current_x) + 1; newsize = abs(mark_beginx - current_x) + 1;
@ -224,21 +224,38 @@ int do_cut_text(void)
add_to_cutbuffer(tmp); add_to_cutbuffer(tmp);
dump_buffer(cutbuffer); dump_buffer(cutbuffer);
align(&current->data); align(&current->data);
} else if (current->lineno < mark_beginbuf->lineno) } else if (current->lineno < mark_beginbuf->lineno) {
/* Don't do_update and move the screen position if the marked
area lies entirely within the screen buffer */
if (current->lineno >= edittop->lineno
&& mark_beginbuf->lineno <= editbot->lineno)
dontupdate = 1;
cut_marked_segment(current, current_x, mark_beginbuf, cut_marked_segment(current, current_x, mark_beginbuf,
mark_beginx); mark_beginx);
else }
else {
/* Same as above, easier logic since we know it's a multi-line
cut and mark_beginbuf is before current */
if (mark_beginbuf->lineno >= edittop->lineno
&& current->lineno <= editbot->lineno)
dontupdate = 1;
cut_marked_segment(mark_beginbuf, mark_beginx, current, cut_marked_segment(mark_beginbuf, mark_beginx, current,
current_x); current_x);
}
placewewant = xplustabs(); placewewant = xplustabs();
UNSET(MARK_ISSET); UNSET(MARK_ISSET);
marked_cut = 1; marked_cut = 1;
set_modified(); set_modified();
if (cuttingpartialline || cuttingtoend) if (dontupdate || cuttingtoend) {
fix_editbot();
edit_refresh(); edit_refresh();
else } else
edit_update(current, CENTER); edit_update(current, CENTER);
return 1; return 1;
@ -385,8 +402,12 @@ int do_uncut_text(void)
i = editbot->lineno; i = editbot->lineno;
current = newend; current = newend;
if (i <= newend->lineno) if (i < newend->lineno) {
edit_update(current, CENTER); edit_update(current, CENTER);
}
else {
edit_refresh();
}
} }
/* If marked cut == 2, that means that we're doing a cut to end /* If marked cut == 2, that means that we're doing a cut to end
@ -444,8 +465,12 @@ int do_uncut_text(void)
i = editbot->lineno; i = editbot->lineno;
renumber(newbuf); renumber(newbuf);
if (i < newend->lineno) if (i < newend->lineno) {
edit_update(fileptr, CENTER); edit_update(fileptr, CENTER);
}
else {
edit_refresh();
}
dump_buffer_reverse(fileptr); dump_buffer_reverse(fileptr);