diff --git a/ChangeLog b/ChangeLog
index d3bfb5a9db7f1a461300c5eb33bdca669b1c4046..52bf278fe761019cc2c9f6f616ca3176d0a5b40c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,7 +26,9 @@ CVS code -
 	  (David Lawrence Ramsey).
 - nano.c:
 	- New function do_prev_word, similar to do_next_word.  Hard coded as
-	  Alt-space, as next word is hard coded as control-space.
+	  Alt-space, as next word is hard coded as control-space. Fixed
+	  goofy logic setting x pos to value of last line when hitting the
+	  beginning of first line, prog should simply abort.
 - rcfile.c:
 	- Fix incorrect number of rc options (David Lawrence Ramsey).
 - po/sv.po:
diff --git a/nano.c b/nano.c
index 70bd99b4d9e400beb31a5ee3c86f83c7fa5bc2e2..b7d550bf885089035ac02d9265916d258db2082e 100644
--- a/nano.c
+++ b/nano.c
@@ -839,9 +839,10 @@ void do_prev_word(void)
 	    if (i == 0) {
 		if (fileptr->prev != NULL)
 		    i = strlen(fileptr->prev->data) - 1;
-		else if (fileptr == fileage && filebot != NULL)
-		    i = strlen(filebot->data) - 1;
-
+		else if (fileptr == fileage && filebot != NULL) {
+		    current_x = 0;
+		    return;
+		}
 		continue;
 	    }
 	}
@@ -862,8 +863,10 @@ void do_prev_word(void)
 	}
 	if (fileptr->prev != NULL)
 	    i = strlen(fileptr->prev->data) - 1;
-	else if (fileptr == fileage && filebot != NULL)
-	    i = strlen(filebot->data) - 1;
+	else if (fileptr == fileage && filebot != NULL) {
+	    current_x = 0;
+	    return;
+	}
     }
     if (fileptr == NULL)
 	current = fileage;