mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
New action: move-cursor-line-start.
It moves cursor to the start of the line.
(cherry picked from commit 5ee1d3b2b3
)
This commit is contained in:
parent
64c385f0db
commit
3a87ec55fc
@ -55,6 +55,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),
|
||||
|
@ -360,6 +360,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