diff --git a/ChangeLog b/ChangeLog
index 9a87febd53d850c5454ada3be8fbceadb8c76c84..63743ae301a80f11da54c2b71dbae1372e9942ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -100,6 +100,14 @@ CVS code -
 	  inpar(), backup_lines(), find_paragraph(), do_justify(),
 	  do_justify_void(), do_full_justify(), and do_word_count() (all
 	  moved to text.c). (DLR)
+	- Since the total number of lines in a file is the same as the
+	  number of its last line when all its lines are numbered
+	  properly, use that in place of openfile->totlines, and
+	  eliminate references to openfile->totlines.  Changes to
+	  initialize_buffer_text(), read_file(), move_to_filestruct(),
+	  copy_from_filestruct(), do_delete(), do_enter(), do_wrap(),
+	  do_justify(), do_alt_speller(), do_wordlinechar_count(),
+	  new_magicline(), remove_magicline(), and do_cursorpos(). (DLR)
 - color.c:
 	- Remove unneeded string.h and fcntl.h includes. (DLR)
 - chars.c:
diff --git a/src/files.c b/src/files.c
index 51c3251cc088ba9accd9bb4156e33b6ec2d3a99a..949b121c13504c19f32c64142a730878226b3fef 100644
--- a/src/files.c
+++ b/src/files.c
@@ -97,7 +97,6 @@ void initialize_buffer_text(void)
     openfile->edittop = openfile->fileage;
     openfile->current = openfile->fileage;
 
-    openfile->totlines = 1;
     openfile->totsize = 0;
 }
 
@@ -488,8 +487,6 @@ void read_file(FILE *f, const char *filename)
 #endif
 	statusbar(P_("Read %lu line", "Read %lu lines",
 		(unsigned long)num_lines), (unsigned long)num_lines);
-
-    openfile->totlines += num_lines;
 }
 
 /* Open the file (and decide if it exists).  If newfie is TRUE, display
diff --git a/src/nano.c b/src/nano.c
index 376aa0e4f84cd656b6ed2ce299e2e2e0eb593da7..7b0e28e4003cc5109df3b3a049d6afd867f83980 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -382,9 +382,6 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
 
     if (openfile->filebot->data[0] != '\0')
 	new_magicline();
-
-    /* Set totlines to the new number of lines in the file. */
-    openfile->totlines = openfile->filebot->lineno;
 }
 
 /* Copy all the text from the filestruct beginning with file_top and
@@ -443,9 +440,6 @@ void copy_from_filestruct(filestruct *file_top, filestruct *file_bot)
 
     if (openfile->filebot->data[0] != '\0')
 	new_magicline();
-
-    /* Set totlines to the new number of lines in the file. */
-    openfile->totlines = openfile->filebot->lineno;
 }
 
 /* Create a new openfilestruct node. */
diff --git a/src/nano.h b/src/nano.h
index bc0ad56c27a2ecf526935a817b082ed7fbe88f9e..e250b3dc5560ccfbf8564a316beccfd5765bf3a1 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -215,9 +215,8 @@ typedef struct openfilestruct {
     filestruct *filebot;	/* Current file's last line. */
     filestruct *edittop;	/* Current top of edit window. */
     filestruct *current;	/* Current file's line. */
-    size_t totlines;		/* Current file's total number of
-				 * lines. */
-    size_t totsize;		/* Current file's total size. */
+    size_t totsize;		/* Current file's total number of
+				 * characters. */
     size_t current_x;		/* Current file's x-coordinate
 				 * position. */
     size_t placewewant;		/* Current file's place we want. */
diff --git a/src/text.c b/src/text.c
index f5f128f94349895fa8b6c6e3ccd1bc761d03f29a..0edca63f298a0b8f6083250c6be0cb55c93f3efc 100644
--- a/src/text.c
+++ b/src/text.c
@@ -127,7 +127,6 @@ void do_delete(void)
 	unlink_node(foo);
 	delete_node(foo);
 	renumber(openfile->current);
-	openfile->totlines--;
 	openfile->totsize--;
 #ifndef DISABLE_WRAPPING
 	wrap_reset();
@@ -237,7 +236,6 @@ void do_enter(void)
 
     edit_refresh();
 
-    openfile->totlines++;
     openfile->totsize++;
     set_modified();
     openfile->placewewant = xplustabs();
@@ -505,7 +503,6 @@ bool do_wrap(filestruct *line)
 
 	openfile->current->next->data = new_line;
 
-	openfile->totlines++;
 	openfile->totsize++;
     }
 
@@ -1094,8 +1091,8 @@ void do_justify(bool full_justify)
 	/* Will be the line containing the newline after the last line
 	 * of the result.  Also for restoring after unjustify. */
 
-    /* We save these variables to be restored if the user unjustifies.
-     * Note that we don't need to save totlines. */
+    /* We save these variables to be restored if the user
+     * unjustifies. */
     size_t current_x_save = openfile->current_x;
     size_t pww_save = openfile->placewewant;
     ssize_t current_y_save = openfile->current_y;
@@ -1258,7 +1255,6 @@ void do_justify(bool full_justify)
 	    i--;
 
 	    par_len--;
-	    openfile->totlines--;
 	    openfile->totsize--;
 	}
 
@@ -1317,7 +1313,6 @@ void do_justify(bool full_justify)
 		openfile->current->data + break_pos);
 
 	    par_len++;
-	    openfile->totlines++;
 	    openfile->totsize += indent_len + 1;
 
 #ifndef NANO_SMALL
@@ -1357,10 +1352,10 @@ void do_justify(bool full_justify)
     }
 
     /* We are now done justifying the paragraph or the file, so clean
-     * up.  totlines, totsize, and current_y have been maintained above.
-     * Set last_par_line to the new end of the paragraph, update
-     * fileage, and renumber since edit_refresh() needs the line numbers
-     * to be right (but only do the last two if we actually justified
+     * up.  totsize, and current_y have been maintained above.  Set
+     * last_par_line to the new end of the paragraph, update fileage,
+     * and renumber, since edit_refresh() needs the line numbers to be
+     * right (but only do the last two if we actually justified
      * something). */
     last_par_line = openfile->current;
     if (first_par_line != NULL) {
@@ -1425,7 +1420,6 @@ void do_justify(bool full_justify)
 
 	    /* Restore variables from before the justify. */
 	    openfile->totsize = totsize_save;
-	    openfile->totlines = openfile->filebot->lineno;
 #ifndef NANO_SMALL
 	    if (openfile->mark_set) {
 		openfile->mark_begin = mark_begin_save;
@@ -1969,12 +1963,10 @@ const char *do_alt_speller(char *tempfile_name)
 	unpartition_filestruct(&filepart);
 
 	/* Renumber starting with the beginning line of the old
-	 * partition.  Also set totlines to the new number of lines in
-	 * the file, add the number of characters in the spell-checked
-	 * marked text to the saved value of totsize, and then make that
-	 * saved value the actual value. */
+	 * partition.  Also add the number of characters in the
+	 * spell-checked marked text to the saved value of totsize, and
+	 * then make that saved value the actual value. */
 	renumber(top_save);
-	openfile->totlines = openfile->filebot->lineno;
 	totsize_save += openfile->totsize;
 	openfile->totsize = totsize_save;
 
@@ -2049,7 +2041,8 @@ void do_spell(void)
 #ifndef NANO_SMALL
 void do_wordlinechar_count(void)
 {
-    size_t words = 0, lines = 0, chars = 0;
+    size_t words = 0, chars = 0;
+    ssize_t lines = 0;
     size_t current_x_save = openfile->current_x;
     size_t pww_save = openfile->placewewant;
     filestruct *current_save = openfile->current;
@@ -2104,7 +2097,7 @@ void do_wordlinechar_count(void)
 	unpartition_filestruct(&filepart);
 	openfile->mark_set = TRUE;
     } else {
-	lines = openfile->totlines;
+	lines = openfile->filebot->lineno;
 	chars = openfile->totsize;
     }
 
@@ -2115,8 +2108,8 @@ void do_wordlinechar_count(void)
 
     /* Display the total word, line, and character counts on the
      * statusbar. */
-    statusbar("%sWords: %lu  Lines: %lu  Chars: %lu", old_mark_set ?
-	_("(In Selection)  ") : "", (unsigned long)words,
-	(unsigned long)lines, (unsigned long)chars);
+    statusbar("%sWords: %lu  Lines: %ld  Chars: %lu", old_mark_set ?
+	_("(In Selection)  ") : "", (unsigned long)words, (long)lines,
+	(unsigned long)chars);
 }
 #endif /* !NANO_SMALL */
diff --git a/src/utils.c b/src/utils.c
index 3313b53279700dcd8ec0bd64fa44865daf12fac0..ca8106b903decbbf9939e3e626b908152a54fa25 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -404,7 +404,6 @@ void new_magicline(void)
     openfile->filebot->next->next = NULL;
     openfile->filebot->next->lineno = openfile->filebot->lineno + 1;
     openfile->filebot = openfile->filebot->next;
-    openfile->totlines++;
     openfile->totsize++;
 }
 
@@ -418,7 +417,6 @@ void remove_magicline(void)
 	openfile->filebot = openfile->filebot->prev;
 	free_filestruct(openfile->filebot->next);
 	openfile->filebot->next = NULL;
-	openfile->totlines--;
 	openfile->totsize--;
     }
 }
diff --git a/src/winio.c b/src/winio.c
index 0e54aaf1a95274155acf5ff3c2e9051367a695a2..6a13013501d42ffd643bd65471c7825cde522d05 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -3839,7 +3839,7 @@ void do_cursorpos(bool constant)
     size_t cur_lenpt = strlenpt(openfile->current->data) + 1;
     int linepct, colpct, charpct;
 
-    assert(openfile->current != NULL && openfile->fileage != NULL && openfile->totlines != 0);
+    assert(openfile->current != NULL && openfile->fileage != NULL);
 
     c = openfile->current->data[openfile->current_x];
     f = openfile->current->next;
@@ -3860,15 +3860,16 @@ void do_cursorpos(bool constant)
 
     /* Display the current cursor position on the statusbar, and set 
      * disable_cursorpos to FALSE. */
-    linepct = 100 * openfile->current->lineno / openfile->totlines;
+    linepct = 100 * openfile->current->lineno /
+	openfile->filebot->lineno;
     colpct = 100 * cur_xpt / cur_lenpt;
     charpct = (openfile->totsize == 0) ? 0 : 100 * i /
 	openfile->totsize;
 
     statusbar(
-	_("line %ld/%lu (%d%%), col %lu/%lu (%d%%), char %lu/%lu (%d%%)"),
+	_("line %ld/%ld (%d%%), col %lu/%lu (%d%%), char %lu/%lu (%d%%)"),
 	(long)openfile->current->lineno,
-	(unsigned long)openfile->totlines, linepct,
+	(long)openfile->filebot->lineno, linepct,
 	(unsigned long)cur_xpt, (unsigned long)cur_lenpt, colpct,
 	(unsigned long)i, (unsigned long)openfile->totsize, charpct);