edo

Experimental text editor.
Log | Files | Refs | LICENSE

commit d1e14aafe3edd19e4350a0378a5ac1ac87da8ec5
parent aad3fe5a25f85c369bba6ba43f344c04f2613db6
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Sun, 23 Nov 2025 13:38:27 +0100

Don't render hidden lines when scrolling horizontally.

Diffstat:
Medo.c | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/edo.c b/edo.c @@ -341,8 +341,11 @@ draw_view(View *v) { assert(l); len = l->len - v->col_offset; - if(len > v->screen_cols) - len = v->screen_cols; + + /* lines may be hidden when scrolling horizontally */ + if(len < 0) continue; + + if(len > v->screen_cols) len = v->screen_cols; ui->draw_text(0, y, l->buf + v->col_offset, len); } @@ -384,11 +387,14 @@ run(void) { else if(ev.key == 'h') view_cursor_left(vcur); else if(ev.key == 'l') view_cursor_right(vcur); else if(ev.key == 'q') running = 0; - else if(ev.key == '\n') { + else if(ev.key == 'K') { + Line *l = line_create(NULL); + buffer_insert_line(vcur->buf, vcur->line_num + 0, l); + } + else if(ev.key == 'J') { Line *l = line_create(NULL); buffer_insert_line(vcur->buf, vcur->line_num + 1, l); view_cursor_down(vcur); - break; } else { line_insert_char(vcur->buf->lines[vcur->line_num], vcur->col_num, ev.key); view_cursor_right(vcur);