finish tweaking backup_lines() to remove the assumption that the file
always ends in a magicline, and add documentation fixes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3128 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
8bd960bbc9
commit
5c33e88b25
|
@ -76,7 +76,7 @@ CVS code -
|
||||||
nanogetstr() (renamed get_prompt_string()), statusq() (renamed
|
nanogetstr() (renamed get_prompt_string()), statusq() (renamed
|
||||||
do_prompt()), statusq_abort() (renamed do_prompt_abort()), and
|
do_prompt()), statusq_abort() (renamed do_prompt_abort()), and
|
||||||
do_yesno() (renamed do_yesno_prompt()). (DLR)
|
do_yesno() (renamed do_yesno_prompt()). (DLR)
|
||||||
- Initialize the static pid_t pid in text.c. (DLR)
|
- Initialize the static pid_t pid in text.c to -1. (DLR)
|
||||||
- chars.c:
|
- chars.c:
|
||||||
mbwidth()
|
mbwidth()
|
||||||
- If wcwidth() returns -1 for the character passed in, treat the
|
- If wcwidth() returns -1 for the character passed in, treat the
|
||||||
|
|
14
src/text.c
14
src/text.c
|
@ -978,14 +978,15 @@ filestruct *backup_lines(filestruct *first_line, size_t par_len)
|
||||||
assert(par_len > 0 && openfile->current->lineno + par_len <=
|
assert(par_len > 0 && openfile->current->lineno + par_len <=
|
||||||
filebot->lineno + 1);
|
filebot->lineno + 1);
|
||||||
|
|
||||||
/* Move bot down par_len lines to the newline after the last line of
|
/* Move bot down par_len lines to the line after the last line of
|
||||||
* the paragraph. */
|
* the paragraph, if there is one. */
|
||||||
for (i = par_len; i > 0; i--)
|
for (i = par_len; i > 0 && bot != openfile->filebot; i--)
|
||||||
bot = bot->next;
|
bot = bot->next;
|
||||||
|
|
||||||
/* Move the paragraph from the current buffer's filestruct to the
|
/* Move the paragraph from the current buffer's filestruct to the
|
||||||
* justify buffer. */
|
* justify buffer. */
|
||||||
move_to_filestruct(&jusbuffer, &jusbottom, top, 0, bot, 0);
|
move_to_filestruct(&jusbuffer, &jusbottom, top, 0, bot,
|
||||||
|
strlen(bot->data));
|
||||||
|
|
||||||
/* Copy the paragraph back to the current buffer's filestruct from
|
/* Copy the paragraph back to the current buffer's filestruct from
|
||||||
* the justify buffer. */
|
* the justify buffer. */
|
||||||
|
@ -995,7 +996,10 @@ filestruct *backup_lines(filestruct *first_line, size_t par_len)
|
||||||
* line, putting first_line, edittop, current, and mark_begin at the
|
* line, putting first_line, edittop, current, and mark_begin at the
|
||||||
* same lines in the copied paragraph that they had in the original
|
* same lines in the copied paragraph that they had in the original
|
||||||
* paragraph. */
|
* paragraph. */
|
||||||
top = openfile->current->prev;
|
if (openfile->current != openfile->filebot)
|
||||||
|
top = openfile->current->prev;
|
||||||
|
else
|
||||||
|
top = openfile->current;
|
||||||
for (i = par_len; i > 0; i--) {
|
for (i = par_len; i > 0; i--) {
|
||||||
if (top->lineno == fl_lineno_save)
|
if (top->lineno == fl_lineno_save)
|
||||||
first_line = top;
|
first_line = top;
|
||||||
|
|
Loading…
Reference in New Issue