From 1cb945fe8e51b0c935b5d409b323c595983badc2 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 14 Feb 2017 21:35:01 -0600
Subject: [PATCH] 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.
---
 src/cut.c   | 18 +++++++++---------
 src/nano.c  |  4 ++--
 src/proto.h |  4 ++--
 src/text.c  |  8 ++++----
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/cut.c b/src/cut.c
index a64f2bd1..fe689757 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -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);
diff --git a/src/nano.c b/src/nano.c
index 78e39aaa..542348b6 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -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;
diff --git a/src/proto.h b/src/proto.h
index 4517514f..de899f04 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -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);
diff --git a/src/text.c b/src/text.c
index ab8434aa..f1f4c090 100644
--- a/src/text.c
+++ b/src/text.c
@@ -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
-- 
GitLab