Signed-off-by: Fabienne Ducroquet <fabi...@gmail.com> --- src/config/actions-main.inc | 1 + src/viewer/action.c | 4 ++++ src/viewer/text/view.c | 6 ++++++ src/viewer/text/view.h | 1 + 4 files changed, 12 insertions(+)
diff --git a/src/config/actions-main.inc b/src/config/actions-main.inc index 5f686b2..abe6fa6 100644 --- a/src/config/actions-main.inc +++ b/src/config/actions-main.inc @@ -53,6 +53,7 @@ ACTION_(MAIN, "lua-console", LUA_CONSOLE, N__("Open a Lua console"), ACTION_REST ACTION_(MAIN, "mark-goto", MARK_GOTO, N__("Go at a specified mark"), ACTION_REQUIRE_VIEW_STATE), ACTION_(MAIN, "mark-set", MARK_SET, N__("Set a mark"), ACTION_REQUIRE_VIEW_STATE), ACTION_(MAIN, "menu", MENU, N__("Activate the menu"), 0), +ACTION_(MAIN, "move-current-top", MOVE_CURRENT_TOP, N__("Move downwards to put the current line at the top"), ACTION_REQUIRE_VIEW_STATE), ACTION_(MAIN, "move-cursor-down", MOVE_CURSOR_DOWN, N__("Move cursor down"), ACTION_REQUIRE_VIEW_STATE), ACTION_(MAIN, "move-cursor-left", MOVE_CURSOR_LEFT, N__("Move cursor left"), ACTION_REQUIRE_VIEW_STATE), ACTION_(MAIN, "move-cursor-line-start", MOVE_CURSOR_LINE_START, N__("Move cursor to the start of the line"), ACTION_REQUIRE_VIEW_STATE), diff --git a/src/viewer/action.c b/src/viewer/action.c index 77280e6..6d15e33 100644 --- a/src/viewer/action.c +++ b/src/viewer/action.c @@ -335,6 +335,10 @@ do_action(struct session *ses, enum main_action action_id, int verbose) activate_bfu_technology(ses, -1); break; + case ACT_MAIN_MOVE_CURRENT_TOP: + status = move_current_top(ses, doc_view); + break; + case ACT_MAIN_MOVE_CURSOR_UP: status = move_cursor_up(ses, doc_view); break; diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c index 8eb422d..943bd33 100644 --- a/src/viewer/text/view.c +++ b/src/viewer/text/view.c @@ -138,6 +138,12 @@ move_half_page_down(struct session *ses, struct document_view *doc_view) return move_part_page_down(ses, doc_view, doc_view->box.height / 2); } +enum frame_event_status +move_current_top(struct session *ses, struct document_view *doc_view) +{ + return move_part_page_down(ses, doc_view, doc_view->box.height - ses->tab->y + 1); +} + /*! @a type == 0 -> PAGE_UP; * @a type == 1 -> UP */ static void diff --git a/src/viewer/text/view.h b/src/viewer/text/view.h index d7721b1..7c11260 100644 --- a/src/viewer/text/view.h +++ b/src/viewer/text/view.h @@ -14,6 +14,7 @@ struct terminal; * But doesn't free() the @a doc_view. */ void detach_formatted(struct document_view *doc_view); +enum frame_event_status move_current_top(struct session *ses, struct document_view *doc_view); enum frame_event_status move_half_page_down(struct session *ses, struct document_view *doc_view); enum frame_event_status move_half_page_up(struct session *ses, struct document_view *doc_view); enum frame_event_status move_page_down(struct session *ses, struct document_view *doc_view); -- 1.8.5.1 _______________________________________________ elinks-dev mailing list elinks-dev@linuxfromscratch.org http://linuxfromscratch.org/mailman/listinfo/elinks-dev