From f400c232797b020d713d771834d8a2432bb91a7d Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 8 Nov 2005 16:37:29 +0000
Subject: [PATCH] tweak do_alt_speller() to remove the assumption that the file
 always ends in a magicline

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3106 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog  | 4 ++--
 src/text.c | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 373fa3f8..65c037a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,8 +39,8 @@ CVS code -
 	  do_help() (all moved to help.c). (DLR)
 	- Tweak a few functions to remove the assumption that the file
 	  always ends in a magicline.  Changes to do_cut_till_end(),
-	  open_buffer(), read_file(), write_file(), do_last_line(), and
-	  do_wordlinechar_count(). (DLR)
+	  open_buffer(), read_file(), write_file(), do_last_line(),
+	  do_alt_speller(), and do_wordlinechar_count(). (DLR)
 	- Tweak a few functions to rely on fileage and filebot instead
 	  of NULL for their checks to detect the top or bottom of the
 	  file.  Changes to cut_line(), cut_to_eol(), do_page_up(),
diff --git a/src/text.c b/src/text.c
index 642ce1e1..3063ab03 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1953,10 +1953,12 @@ const char *do_alt_speller(char *tempfile_name)
     initialize_buffer_text();
 
     /* Reload the temp file.  Open it, read it into the current buffer,
-     * and move back to the first line of the buffer. */
+     * and move back to the beginning of the first line of the
+     * buffer. */
     open_file(tempfile_name, FALSE, &f);
     read_file(f, tempfile_name);
     openfile->current = openfile->fileage;
+    openfile->current_x = 0;
 
 #ifndef NANO_SMALL
     if (old_mark_set) {
-- 
GitLab