mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
New action: move-cursor-line-start.
It moves cursor to the start of the line. (cherry picked from commit5ee1d3b2b3
) (cherry picked from commit3a87ec55fc
)
This commit is contained in:
parent
d358810a5f
commit
61eb46e94d
@ -54,6 +54,7 @@ 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-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),
|
||||
ACTION_(MAIN, "move-cursor-right", MOVE_CURSOR_RIGHT, N__("Move cursor right"), ACTION_REQUIRE_VIEW_STATE),
|
||||
ACTION_(MAIN, "move-cursor-up", MOVE_CURSOR_UP, N__("Move cursor up"), ACTION_REQUIRE_VIEW_STATE),
|
||||
ACTION_(MAIN, "move-document-end", MOVE_DOCUMENT_END, N__("Move to the end of the document"), ACTION_REQUIRE_VIEW_STATE),
|
||||
|
@ -356,6 +356,10 @@ do_action(struct session *ses, enum main_action action_id, int verbose)
|
||||
status = move_cursor_right(ses, doc_view);
|
||||
break;
|
||||
|
||||
case ACT_MAIN_MOVE_CURSOR_LINE_START:
|
||||
status = move_cursor_line_start(ses, doc_view);
|
||||
break;
|
||||
|
||||
case ACT_MAIN_MOVE_LINK_DOWN:
|
||||
status = move_link_down(ses, doc_view);
|
||||
break;
|
||||
|
@ -829,6 +829,22 @@ move_link_next_line(struct session *ses, struct document_view *doc_view)
|
||||
return FRAME_EVENT_OK;
|
||||
}
|
||||
|
||||
enum frame_event_status
|
||||
move_cursor_line_start(struct session *ses, struct document_view *doc_view)
|
||||
{
|
||||
struct view_state *vs;
|
||||
struct box *box;
|
||||
int x;
|
||||
|
||||
assert(ses && doc_view && doc_view->vs);
|
||||
if_assert_failed return FRAME_EVENT_OK;
|
||||
|
||||
vs = doc_view->vs;
|
||||
box = &doc_view->box;
|
||||
x = vs->x + ses->tab->x - box->x;
|
||||
return move_cursor_rel(ses, doc_view, -x, 0);
|
||||
}
|
||||
|
||||
enum frame_event_status
|
||||
copy_current_link_to_clipboard(struct session *ses,
|
||||
struct document_view *doc_view,
|
||||
|
@ -58,6 +58,8 @@ enum frame_event_status move_cursor_up(struct session *ses,
|
||||
enum frame_event_status move_cursor_down(struct session *ses,
|
||||
struct document_view *view);
|
||||
|
||||
enum frame_event_status move_cursor_line_start(struct session *ses, struct document_view *doc_view);
|
||||
|
||||
enum frame_event_status move_cursor(struct session *ses,
|
||||
struct document_view *doc_view,
|
||||
int x, int y);
|
||||
|
Loading…
Reference in New Issue
Block a user