1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-27 01:25:34 +00:00

Add a function to put the current line at the top of the screen

Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
This commit is contained in:
Fabienne Ducroquet 2013-12-17 20:58:47 +01:00 committed by Witold Filipczyk
parent 40fdc14012
commit 60a5fce0f0
4 changed files with 12 additions and 0 deletions

View File

@ -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),

View File

@ -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;

View File

@ -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

View File

@ -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_page_down(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_page_up(struct session *ses, struct document_view *doc_view);