URI: 
       Fix bug with scrolling using ctrl-e - ledit - Text editor (WIP)
  HTML git clone git://lumidify.org/ledit.git (fast, but not encrypted)
  HTML git clone https://lumidify.org/ledit.git (encrypted, but very slow)
  HTML git clone git://4kcetb7mo7hj6grozzybxtotsub5bempzo4lirzc3437amof2c2impyd.onion/ledit.git (over tor)
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit f08805b3d2b41daefe6a552a569440a3e09b4b65
   DIR parent 2f53fc9c11a1f7d9261c257e6c53be259bb1f41e
  HTML Author: lumidify <nobody@lumidify.org>
       Date:   Thu,  5 Sep 2024 08:50:11 +0200
       
       Fix bug with scrolling using ctrl-e
       
       Diffstat:
         M LICENSE                             |       2 +-
         M keys_basic.c                        |       2 +-
         M view.c                              |       7 ++++---
         M view.h                              |       2 ++
       
       4 files changed, 8 insertions(+), 5 deletions(-)
       ---
   DIR diff --git a/LICENSE b/LICENSE
       @@ -6,7 +6,7 @@ Note 4: See LICENSE.ctrlsel for ctrlsel.{c,h}
        
        ISC License
        
       -Copyright (c) 2021-2023 lumidify <nobody@lumidify.org>
       +Copyright (c) 2021-2024 lumidify <nobody@lumidify.org>
        
        Permission to use, copy, modify, and/or distribute this software for any
        purpose with or without fee is hereby granted, provided that the above
   DIR diff --git a/keys_basic.c b/keys_basic.c
       @@ -1781,7 +1781,7 @@ move_cursor_left_right(ledit_view *view, int dir, int allow_illegal_index) {
                motion_callback cb;
                int num = get_key_repeat_and_motion_cb(view, &cb);
                if (num == -1)
       -                (void)err_invalid_key(view);
       +                (void)err_invalid_key(view); /* FIXME: why do I not return here? */
                if (num == 0)
                        num = 1;
        
   DIR diff --git a/view.c b/view.c
       @@ -1039,7 +1039,6 @@ view_move_cursor_visually(ledit_view *view, size_t line, size_t pos, int movemen
                            new_index, trailing, dir,
                            &new_index, &trailing
                        );
       -                /* for some reason, this is necessary */
                        if (new_index < 0)
                                new_index = 0;
                        else if (new_index > (int)cur_line->len)
       @@ -1580,7 +1579,8 @@ view_get_nearest_legal_pos(
                        /* search for the hard line covering the top of the screen */
                        size_t hline = line;
                        while (vline->y_offset + vline->h <= view->display_offset && hline < view->lines_num - 1) {
       -                        vline = view_get_line(view, ++hline);
       +                        ++hline;
       +                        vline = view_get_line(view, hline);
                        }
                        /* the current hard line is now the one at the very top of the screen*/
                        layout = get_pango_layout(view, hline);
       @@ -1617,7 +1617,8 @@ view_get_nearest_legal_pos(
                        /* search for the hard line covering the bottom of the screen */
                        size_t hline = line;
                        while (vline->y_offset > view->display_offset + text_h && hline > 0) {
       -                        vline = view_get_line(view, --hline);
       +                        --hline;
       +                        vline = view_get_line(view, hline);
                        }
                        /* the current hard line is now the one at the very bottom of the screen*/
                        layout = get_pango_layout(view, hline);
   DIR diff --git a/view.h b/view.h
       @@ -117,6 +117,8 @@ void view_unlock(ledit_view *view);
        
        /* This is very hacky - it's so the actual function calling view_get_line is returned in the assertion message.
         * There probably is a better way to do this.
       + * FIXME: couldn't this just use the same trick that assert does?
       + * WARNING: Since this is now a macro, the arguments are not allowed to have side effects!
         */
        #define view_get_line(view, index) (ledit_assert((index) < (view)->lines_num), (index) < (view)->lines_gap ? &(view)->lines[index] : &(view)->lines[(index) + (view)->lines_cap - (view)->lines_num])