1
1

tweaks: rename the functions for moving to and copying from a buffer

The name "filestruct" was a mistake.  What was meant was:
buffer -- a linked list of structs that each describe a line.
Этот коммит содержится в:
David Lawrence Ramsey 2017-02-14 21:35:01 -06:00 коммит произвёл Benno Schulenberg
родитель 330741b650
Коммит 1cb945fe8e
4 изменённых файлов: 17 добавлений и 17 удалений

Просмотреть файл

@ -49,10 +49,10 @@ inline bool keeping_cutbuffer(void)
void cut_line(void)
{
if (openfile->current != openfile->filebot)
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current, 0,
extract_buffer(&cutbuffer, &cutbottom, openfile->current, 0,
openfile->current->next, 0);
else
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current, 0,
extract_buffer(&cutbuffer, &cutbottom, openfile->current, 0,
openfile->current, strlen(openfile->current->data));
openfile->placewewant = 0;
}
@ -68,7 +68,7 @@ void cut_marked(bool *right_side_up)
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, right_side_up);
move_to_filestruct(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
extract_buffer(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
openfile->placewewant = xplustabs();
}
@ -86,14 +86,14 @@ void cut_to_eol(void)
/* If we're not at the end of the line, move all the text from
* the current position up to it, not counting the newline at
* the end, into the cutbuffer. */
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
extract_buffer(&cutbuffer, &cutbottom, openfile->current,
openfile->current_x, openfile->current, data_len);
else if (openfile->current != openfile->filebot) {
/* If we're at the end of the line, and it isn't the last line
* of the file, move all the text from the current position up
* to the beginning of the next line, i.e. the newline at the
* end, into the cutbuffer. */
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
extract_buffer(&cutbuffer, &cutbottom, openfile->current,
openfile->current_x, openfile->current->next, 0);
openfile->placewewant = xplustabs();
}
@ -103,7 +103,7 @@ void cut_to_eol(void)
* file into the cutbuffer. */
void cut_to_eof(void)
{
move_to_filestruct(&cutbuffer, &cutbottom,
extract_buffer(&cutbuffer, &cutbottom,
openfile->current, openfile->current_x,
openfile->filebot, strlen(openfile->filebot->data));
}
@ -172,10 +172,10 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
if (cutbuffer != NULL) {
if (cb_save != NULL) {
cb_save->data += cb_save_len;
copy_from_filestruct(cb_save);
copy_from_buffer(cb_save);
cb_save->data -= cb_save_len;
} else
copy_from_filestruct(cutbuffer);
copy_from_buffer(cutbuffer);
/* If the copied region was marked forward, put the new desired
* x position at its end; otherwise, leave it at its beginning. */
@ -268,7 +268,7 @@ void do_uncut_text(void)
/* Add a copy of the text in the cutbuffer to the current filestruct
* at the current cursor position. */
copy_from_filestruct(cutbuffer);
copy_from_buffer(cutbuffer);
#ifndef NANO_TINY
update_undo(PASTE);

Просмотреть файл

@ -278,7 +278,7 @@ void unpartition_filestruct(partition **p)
* current filestruct to a filestruct beginning with file_top and ending
* with file_bot. If no text is between (top, top_x) and (bot, bot_x),
* don't do anything. */
void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
void extract_buffer(filestruct **file_top, filestruct **file_bot,
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x)
{
filestruct *top_save;
@ -394,7 +394,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
/* Copy all text from the given filestruct to the current filestruct
* at the current cursor position. */
void copy_from_filestruct(filestruct *somebuffer)
void copy_from_buffer(filestruct *somebuffer)
{
filestruct *top_save;
size_t current_x_save = openfile->current_x;

Просмотреть файл

@ -430,9 +430,9 @@ void renumber(filestruct *fileptr);
partition *partition_filestruct(filestruct *top, size_t top_x,
filestruct *bot, size_t bot_x);
void unpartition_filestruct(partition **p);
void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
void extract_buffer(filestruct **file_top, filestruct **file_bot,
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
void copy_from_filestruct(filestruct *somebuffer);
void copy_from_buffer(filestruct *somebuffer);
openfilestruct *make_new_opennode(void);
void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);

Просмотреть файл

@ -647,7 +647,7 @@ void undo_cut(undo *u)
else
goto_line_posx(u->mark_begin_lineno, u->mark_begin_x);
copy_from_filestruct(u->cutbuffer);
copy_from_buffer(u->cutbuffer);
if (u->xflags != WAS_MARKED_FORWARD && u->type != PASTE)
goto_line_posx(u->mark_begin_lineno, u->mark_begin_x);
@ -949,7 +949,7 @@ void do_redo(void)
case INSERT:
redidmsg = _("text insert");
goto_line_posx(u->lineno, u->begin);
copy_from_filestruct(u->cutbuffer);
copy_from_buffer(u->cutbuffer);
free_filestruct(u->cutbuffer);
u->cutbuffer = NULL;
break;
@ -2064,12 +2064,12 @@ void backup_lines(filestruct *first_line, size_t par_len)
/* Move the paragraph from the current buffer's filestruct to the
* justify buffer. */
move_to_filestruct(&jusbuffer, &jusbottom, top, 0, bot,
extract_buffer(&jusbuffer, &jusbottom, top, 0, bot,
(i == 1 && bot == openfile->filebot) ? strlen(bot->data) : 0);
/* Copy the paragraph back to the current buffer's filestruct from
* the justify buffer. */
copy_from_filestruct(jusbuffer);
copy_from_buffer(jusbuffer);
/* Move upward from the last line of the paragraph to the first
* line, putting first_line, edittop, current, and mark_begin at the