Re: [PATCH 2/2] Add a function to put the current line at the top of the screen

"David [email protected]" <[email protected]> Mon, 23 Dec 2013 12:21:02 -0600
Newsgroups gmane.comp.web.links
Message-ID <CALZV2eVpNK4s-CJ6BcKx9GjfRSqCbZiEad+MUEBJoYkvWgH-qA@mail.gmail.com>
--===============0420635582==
Content-Type: multipart/alternative; boundary=bcaec5171b93c2553404ee37b00b

--bcaec5171b93c2553404ee37b00b
Content-Type: text/plain; charset=ISO-8859-1

please remove me



On Wed, Dec 18, 2013 at 6:30 AM, Fabienne Ducroquet <[email protected]>wrote:

> Signed-off-by: Fabienne Ducroquet <[email protected]>
> ---
>  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
> [email protected]
> http://linuxfromscratch.org/mailman/listinfo/elinks-dev
>

--bcaec5171b93c2553404ee37b00b
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">please remove me<br><br></div><div class=3D"gmail_extra"><=
br><br><div class=3D"gmail_quote">On Wed, Dec 18, 2013 at 6:30 AM, Fabienne=
 Ducroquet <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" targe=
t=3D"_blank">[email protected]</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Signed-off-by: Fabienne Ducroquet &lt;<a hre=
f=3D"mailto:[email protected]">[email protected]</a>&gt;<br>
---<br>
=A0src/config/actions-main.inc | 1 +<br>
=A0src/viewer/action.c =A0 =A0 =A0 =A0 | 4 ++++<br>
=A0src/viewer/text/view.c =A0 =A0 =A0| 6 ++++++<br>
=A0src/viewer/text/view.h =A0 =A0 =A0| 1 +<br>
=A04 files changed, 12 insertions(+)<br>
<br>
diff --git a/src/config/actions-main.inc b/src/config/actions-main.inc<br>
index 5f686b2..abe6fa6 100644<br>
--- a/src/config/actions-main.inc<br>
+++ b/src/config/actions-main.inc<br>
@@ -53,6 +53,7 @@ ACTION_(MAIN, &quot;lua-console&quot;, LUA_CONSOLE, N__(&=
quot;Open a Lua console&quot;), ACTION_REST<br>
=A0ACTION_(MAIN, &quot;mark-goto&quot;, MARK_GOTO, N__(&quot;Go at a specif=
ied mark&quot;), ACTION_REQUIRE_VIEW_STATE),<br>
=A0ACTION_(MAIN, &quot;mark-set&quot;, MARK_SET, N__(&quot;Set a mark&quot;=
), ACTION_REQUIRE_VIEW_STATE),<br>
=A0ACTION_(MAIN, &quot;menu&quot;, MENU, N__(&quot;Activate the menu&quot;)=
, 0),<br>
+ACTION_(MAIN, &quot;move-current-top&quot;, MOVE_CURRENT_TOP, N__(&quot;Mo=
ve downwards to put the current line at the top&quot;), ACTION_REQUIRE_VIEW=
_STATE),<br>
=A0ACTION_(MAIN, &quot;move-cursor-down&quot;, MOVE_CURSOR_DOWN, N__(&quot;=
Move cursor down&quot;), ACTION_REQUIRE_VIEW_STATE),<br>
=A0ACTION_(MAIN, &quot;move-cursor-left&quot;, MOVE_CURSOR_LEFT, N__(&quot;=
Move cursor left&quot;), ACTION_REQUIRE_VIEW_STATE),<br>
=A0ACTION_(MAIN, &quot;move-cursor-line-start&quot;, MOVE_CURSOR_LINE_START=
, N__(&quot;Move cursor to the start of the line&quot;), ACTION_REQUIRE_VIE=
W_STATE),<br>
diff --git a/src/viewer/action.c b/src/viewer/action.c<br>
index 77280e6..6d15e33 100644<br>
--- a/src/viewer/action.c<br>
+++ b/src/viewer/action.c<br>
@@ -335,6 +335,10 @@ do_action(struct session *ses, enum main_action action=
_id, int verbose)<br>
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 activate_bfu_technology(ses=
, -1);<br>
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;<br>
<br>
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 case ACT_MAIN_MOVE_CURRENT_TOP:<br>
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 status =3D move_current_top(s=
es, doc_view);<br>
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;<br>
+<br>
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 case ACT_MAIN_MOVE_CURSOR_UP:<br>
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 status =3D move_cursor_up(s=
es, doc_view);<br>
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;<br>
diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c<br>
index 8eb422d..943bd33 100644<br>
--- a/src/viewer/text/view.c<br>
+++ b/src/viewer/text/view.c<br>
@@ -138,6 +138,12 @@ move_half_page_down(struct session *ses, struct docume=
nt_view *doc_view)<br>
=A0 =A0 =A0 =A0 return move_part_page_down(ses, doc_view, doc_view-&gt;box.=
height / 2);<br>
=A0}<br>
<br>
+enum frame_event_status<br>
+move_current_top(struct session *ses, struct document_view *doc_view)<br>
+{<br>
+ =A0 =A0 =A0 return move_part_page_down(ses, doc_view, doc_view-&gt;box.he=
ight - ses-&gt;tab-&gt;y + 1);<br>
+}<br>
+<br>
=A0/*! @a type =3D=3D 0 -&gt; PAGE_UP;<br>
=A0 * @a type =3D=3D 1 -&gt; UP */<br>
=A0static void<br>
diff --git a/src/viewer/text/view.h b/src/viewer/text/view.h<br>
index d7721b1..7c11260 100644<br>
--- a/src/viewer/text/view.h<br>
+++ b/src/viewer/text/view.h<br>
@@ -14,6 +14,7 @@ struct terminal;<br>
=A0 * But doesn&#39;t free() the @a doc_view. */<br>
=A0void detach_formatted(struct document_view *doc_view);<br>
<br>
+enum frame_event_status move_current_top(struct session *ses, struct docum=
ent_view *doc_view);<br>
=A0enum frame_event_status move_half_page_down(struct session *ses, struct =
document_view *doc_view);<br>
=A0enum frame_event_status move_half_page_up(struct session *ses, struct do=
cument_view *doc_view);<br>
=A0enum frame_event_status move_page_down(struct session *ses, struct docum=
ent_view *doc_view);<br>
<span class=3D"HOEnZb"><font color=3D"#888888">--<br>
1.8.5.1<br>
<br>
_______________________________________________<br>
elinks-dev mailing list<br>
<a href=3D"mailto:[email protected]">elinks-dev@linuxfromscra=
tch.org</a><br>
<a href=3D"http://linuxfromscratch.org/mailman/listinfo/elinks-dev" target=
=3D"_blank">http://linuxfromscratch.org/mailman/listinfo/elinks-dev</a><br>
</font></span></blockquote></div><br></div>

--bcaec5171b93c2553404ee37b00b--

--===============0420635582==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev

--===============0420635582==--