Here is the patch containing window_scroll_line_up() and
window_scroll_line_down().
Regards,
Claudio
2014-09-14 18:31 GMT+02:00 Claudio <[email protected]>:
> Okay, I just noticed that the original behaviour of window_line_*() is
> different than the one I thought. It's used by the j and k commands so
> I'll need two new ad-hoc routines for ^y and ^e.
>
>
> Regards,
> Claudio Alessi
>
> 2014-09-14 18:25 GMT+02:00 Claudio <[email protected]>:
>> Hi,
>>
>> thank you for writing vis. I would ask if the attached patch makes
>> sense to you. Now window_line_up() and window_line_down() works
>> properly and I can add the following key bindings:
>>
>> { { CONTROL('y') }, cursor, { .m = window_line_up } },
>> { { CONTROL('e') }, cursor, { .m = window_line_down } },
>>
>> It works but I'm not sure it's the only (and right) way to do it.
>>
>>
>> Regards,
>> Claudio
diff --git a/window.c b/window.c
index eb1c8e7..e1bc483 100644
--- a/window.c
+++ b/window.c
@@ -655,6 +655,18 @@ size_t window_line_down(Win *win) {
return window_cursor_update(win);
}
+size_t window_scroll_line_up(Win *win) {
+ Cursor *cursor = &win->cursor;
+ window_scroll_lines_up(win, 1);
+ return cursor->pos;
+}
+
+size_t window_scroll_line_down(Win *win) {
+ Cursor *cursor = &win->cursor;
+ window_scroll_lines_down(win, 1);
+ return cursor->pos;
+}
+
void window_update(Win *win) {
wnoutrefresh(win->win);
}