Ticket #1801: 0001-don-t-allow-cursor-to-wrap-at-BOL-in-cursor_beyond_e.patch

File 0001-don-t-allow-cursor-to-wrap-at-BOL-in-cursor_beyond_e.patch, 1.5 KB (added by ossi, 4 years ago)
  • src/editor/edit.c

    From c427ae74f832f3db35d9221500a8efecb8649a5e Mon Sep 17 00:00:00 2001
    From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
    Date: Thu, 8 Apr 2010 00:58:10 +0200
    Subject: [PATCH] don't allow cursor to wrap at BOL in cursor_beyond_eol mode
    
    enabling "Cursor beyond end of line" ("virtual whitespace") mode stops
    right-arrow from wrapping into the next line. however, left-arrow
    continued to wrap to the previous line. this asymmetry felt highly
    unnatural and often caused "navigation challenges" for me.
    
    consequently, this patch makes left-arrow stop at the beginning of the
    line in virtual whitespace mode. put differently, it couples BOL
    wrapping to EOL wrapping. just about every other editor that has such a
    switch behaves this way (FAR's being the only other exception known to
    me).
    ---
     src/editor/edit.c | 9 +++++++--
     1 file changed, 7 insertions(+), 2 deletions(-)
    
    diff --git a/src/editor/edit.c b/src/editor/edit.c
    index e13be389a..c4f834f11 100644
    a b edit_left_char_move_cmd (WEdit * edit) 
    10401040    } 
    10411041#endif 
    10421042 
    1043     if (option_cursor_beyond_eol && edit->over_col > 0) 
    1044         edit->over_col--; 
     1043    if (option_cursor_beyond_eol) 
     1044    { 
     1045        if (edit->over_col > 0) 
     1046            edit->over_col--; 
     1047        else if (edit->buffer.curs1 != edit_buffer_get_bol (&edit->buffer, edit->buffer.curs1)) 
     1048            edit_cursor_move (edit, -char_length); 
     1049    } 
    10451050    else 
    10461051        edit_cursor_move (edit, -char_length); 
    10471052}