fix for the totsize / cut bug
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@16 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
ab4295b80c
commit
ea19c7369f
5
BUGS
5
BUGS
|
@ -32,3 +32,8 @@
|
|||
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)
|
||||
|
|
11
cut.c
11
cut.c
|
@ -44,7 +44,7 @@ void add_to_cutbuffer(filestruct * inptr)
|
|||
inptr->data);
|
||||
#endif
|
||||
|
||||
totsize -= strlen(inptr->data) + 1;
|
||||
totsize -= strlen(inptr->data);
|
||||
tmp = cutbuffer;
|
||||
if (cutbuffer == NULL) {
|
||||
cutbuffer = inptr;
|
||||
|
@ -82,6 +82,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
|
|||
next = tmp->next;
|
||||
add_to_cutbuffer(tmp);
|
||||
totlines--;
|
||||
totsize--; /* newline (add_to_cutbuffer doesn't count newlines) */
|
||||
tmp = next;
|
||||
}
|
||||
while (next != bot && next != NULL);
|
||||
|
@ -101,7 +102,8 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
|
|||
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;
|
||||
|
@ -183,7 +185,7 @@ int do_cut_text(void)
|
|||
UNSET(MARK_ISSET);
|
||||
marked_cut = 1;
|
||||
set_modified();
|
||||
edit_update_top(edittop);
|
||||
edit_update(current);
|
||||
return 1;
|
||||
#else
|
||||
if (0) {
|
||||
|
@ -201,10 +203,9 @@ int do_cut_text(void)
|
|||
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 {
|
||||
|
|
5
winio.c
5
winio.c
|
@ -1066,11 +1066,6 @@ int do_cursorpos(void)
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue