From 1b525e9ad64f4d09f525c3efa28ea8b1eb7a0426 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Mon, 24 May 2004 02:35:02 +0000
Subject: [PATCH] switch test around in do_prev_word() for consistency with
 do_next_word()

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

diff --git a/ChangeLog b/ChangeLog
index 8fabe8e3..7f55139d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -91,6 +91,10 @@ CVS code -
 	  during wait() and can then call cancel_fork() properly. (DLR)
   do_delete()
 	- Tweak for efficiency. (David Benbennick)
+  do_prev_word()
+	- Switch the last test (current != NULL or not) around to match
+	  the order of the same test in do_next_word() (current ==
+	  NULL).  The results are the same either way. (DLR)
   do_spell()
 	- Tweak for efficiency. (David Benbennick)
 	- Change the statusbar entries used in cases of failure so that
diff --git a/src/nano.c b/src/nano.c
index d0b5501d..e890e890 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1200,12 +1200,12 @@ int do_prev_word(void)
 	    current_x = strlen(current->prev->data);
     }
 
-    if (current != NULL) {
-	while (current_x > 0 && isalnum((int)current->data[current_x - 1]))
-	    current_x--;
-    } else {
+    if (current == NULL) {
 	current = fileage;
 	current_x = 0;
+    } else {
+	while (current_x > 0 && isalnum((int)current->data[current_x - 1]))
+	    current_x--;
     }
 
     placewewant = xplustabs();
-- 
GitLab