[2584] in BarnOwl Developers
[PATCH 2/2] Fix owl_editwin_move_to_beginning_of_line for empty first lines
daemon@ATHENA.MIT.EDU (David Benjamin)
Sat Aug 7 00:56:18 2010
From: David Benjamin <davidben@MIT.EDU>
To: barnowl-dev@mit.edu
Date: Fri, 6 Aug 2010 21:56:10 -0700
In-Reply-To: <1281156970-17962-1-git-send-email-davidben@mit.edu>
The condition for determining whether we stopped moving because we
encountered the beginning of the buffer or the end of the previous line
was incorrect. As a result, the editwin was moving back an extra line
when the first line was empty.
---
editwin.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/editwin.c b/editwin.c
index a4bb932..219b1a6 100644
--- a/editwin.c
+++ b/editwin.c
@@ -834,7 +834,10 @@ int owl_editwin_move_to_beginning_of_line(owl_editwin *e)
/* move off the \n if were at the end of a line */
distance += owl_editwin_point_move(e, -1);
distance += owl_editwin_move_if_not_in(e, -1, "\n");
- if (distance && !owl_editwin_at_beginning_of_buffer(e))
+ /* If we stopped because we reached a '\n', rather than because we
+ * hit the top of the buffer, move forward from the end of the
+ * previous line to the start of the current. */
+ if (owl_editwin_get_char_at_point(e) == '\n')
distance += owl_editwin_point_move(e, 1);
}
e->goal_column = 0; /* subtleties */
--
1.7.2.1.7.gf50fd