Get rid of center_x and center_y, removed redundant free_node, added restore of totsize when unjustifying


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@492 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
diff --git a/nano.c b/nano.c
index 2517ba2..dd34443 100644
--- a/nano.c
+++ b/nano.c
@@ -169,8 +169,6 @@
 {
     int i;
 
-    center_x = COLS / 2;
-    center_y = LINES / 2;
     current_x = 0;
     current_y = 0;
 
@@ -254,8 +252,11 @@
 
 void delete_node(filestruct * fileptr)
 {
+    if (fileptr == NULL)
+	return;
+
     if (fileptr->data != NULL)
-	free(fileptr->data);
+        free(fileptr->data);
     free(fileptr);
 }
 
@@ -283,18 +284,6 @@
     return head;
 }
 
-/* Free() a single node */
-int free_node(filestruct * src)
-{
-    if (src == NULL)
-	return 0;
-
-    if (src->next != NULL)
-	free(src->data);
-    free(src);
-    return 1;
-}
-
 int free_filestruct(filestruct * src)
 {
     filestruct *fileptr = src;
@@ -304,15 +293,15 @@
 
     while (fileptr->next != NULL) {
 	fileptr = fileptr->next;
-	free_node(fileptr->prev);
+	delete_node(fileptr->prev);
 
 #ifdef DEBUG
-	fprintf(stderr, _("free_node(): free'd a node, YAY!\n"));
+	fprintf(stderr, _("delete_node(): free'd a node, YAY!\n"));
 #endif
     }
-    free_node(fileptr);
+    delete_node(fileptr);
 #ifdef DEBUG
-    fprintf(stderr, _("free_node(): free'd last node.\n"));
+    fprintf(stderr, _("delete_node(): free'd last node.\n"));
 #endif
 
     return 1;
@@ -1571,9 +1560,6 @@
     COLS = win.ws_col;
     LINES = win.ws_row;
 
-    center_x = COLS / 2;
-    center_y = LINES / 2;
-
     if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS)
 	die_too_small();
 
@@ -1751,7 +1737,7 @@
     return 1;
 #else
     int slen = 0;		/* length of combined lines on one line. */
-    int initial_y, kbinput = 0;
+    int initial_y, kbinput = 0, totbak;
     filestruct *initial = NULL, *tmpjust = NULL, *cutbak, *tmptop, *tmpbot;
 
     if (empty_line(current->data)) {
@@ -1791,6 +1777,7 @@
 
     set_modified();
     cutbak = cutbuffer; /* Got to like cutbak ;) */
+    totbak = totsize;
     cutbuffer = NULL;
 
     tmptop = current;
@@ -1915,6 +1902,8 @@
 	if (tmptop->prev == NULL)
 	    edit_refresh();
 
+	/* Restore totsize from befure justify */
+	totsize = totbak;
 	free_filestruct(tmptop);
 	blank_statusbar_refresh();
     }