From: Chris Allegretta <chrisa@asty.org>
Date: Thu, 3 Sep 2009 23:29:14 +0000 (+0000)
Subject: 2009-09-03 Chris Allegretta <chrisa@asty.org>
X-Git-Tag: v2.1.11~3
X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=bce7d404d955d38ab5c9b41d706eec49c0c862ee;p=nano.git

2009-09-03 Chris Allegretta <chrisa@asty.org>
        * global.c (shortcut_init): Fix up/down keys not responding in the file browser,
          discovered by Hannes <mr_creosote@mutantwatch.de>.
        * move.c (do_up) - Fix another scrolling issue with softwrap when the
          cursor is beyond COLS, discovered by Hannes <mr_creosote@mutantwatch.de>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4408 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---

diff --git a/ChangeLog b/ChangeLog
index 59ec727a..92e42dee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-03 Chris Allegretta <chrisa@asty.org>
+	* global.c (shortcut_init): Fix up/down keys not responding in the file browser,
+	  discovered by Hannes <mr_creosote@mutantwatch.de>.
+	* move.c (do_up) - Fix another scrolling issue with softwrap when the
+	  cursor is beyond COLS, discovered by Hannes <mr_creosote@mutantwatch.de>.
+
 2009-09-02 Chris Allegretta <chrisa@asty.org>
 	* Attempt to check file writability and emit a warning on the status bar
 	  if nano doesn't think the file can be written to.  Feature originally
diff --git a/src/global.c b/src/global.c
index dbd42091..c7f8ea1e 100644
--- a/src/global.c
+++ b/src/global.c
@@ -1079,10 +1079,10 @@ void shortcut_init(bool unjustify)
     add_to_sclist(MALL, "kleft", DO_LEFT, 0, TRUE);
     add_to_sclist(MMAIN, "^Q", XON_COMPLAINT, 0, TRUE);
     add_to_sclist(MMAIN, "^S", XOFF_COMPLAINT, 0, TRUE);
-    add_to_sclist(MMAIN, "^P", DO_UP_VOID, 0, TRUE);
-    add_to_sclist(MMAIN, "kup", DO_UP_VOID, 0, TRUE);
-    add_to_sclist(MMAIN, "^N", DO_DOWN_VOID, 0, TRUE);
-    add_to_sclist(MMAIN, "kdown", DO_DOWN_VOID, 0, TRUE);
+    add_to_sclist(MMAIN|MBROWSER, "^P", DO_UP_VOID, 0, TRUE);
+    add_to_sclist(MMAIN|MBROWSER, "kup", DO_UP_VOID, 0, TRUE);
+    add_to_sclist(MMAIN|MBROWSER, "^N", DO_DOWN_VOID, 0, TRUE);
+    add_to_sclist(MMAIN|MBROWSER, "kdown", DO_DOWN_VOID, 0, TRUE);
     add_to_sclist(MALL, "^A", DO_HOME, 0, TRUE);
     add_to_sclist(MALL, "khome", DO_HOME, 0, TRUE);
     add_to_sclist(MALL, "^E", DO_END, 0, TRUE);
diff --git a/src/move.c b/src/move.c
index fba776b4..737404de 100644
--- a/src/move.c
+++ b/src/move.c
@@ -488,7 +488,7 @@ void do_up(
 	)
 	return;
 
-    assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
+    assert(ISSET(SOFTWRAP) || openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
 
     /* Move the current line of the edit window up. */
     openfile->current = openfile->current->prev;
@@ -500,7 +500,7 @@ void do_up(
      * smooth scrolling mode, or up half a page if we're not.  If
      * scroll_only is TRUE, scroll the edit window up one line
      * unconditionally. */
-    if (openfile->current_y == 0
+    if (openfile->current_y == 0 || (ISSET(SOFTWRAP) && openfile->edittop->lineno == openfile->current->next->lineno)
 #ifndef NANO_TINY
 	|| scroll_only
 #endif