Changeset 70110286


Ignore:
Timestamp:
May 12, 2009, 11:25:10 PM (12 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
bd783db
Parents:
e1b136bf
Message:
Implement mark and swap.
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r790ab12 r70110286  
    336336  OWLCMD_VOID("recv:pageup", owl_function_mainwin_pageup, OWL_CTX_INTERACTIVE,
    337337              "scrolls up by a page", "", ""),
     338
     339  OWLCMD_VOID("recv:mark", owl_function_mark_message,
     340              OWL_CTX_INTERACTIVE,
     341              "mark the current message", "", ""),
     342
     343  OWLCMD_VOID("recv:swapmark", owl_function_swap_cur_marked,
     344              OWL_CTX_INTERACTIVE,
     345              "swap curmsg and mark", "", ""),
    338346
    339347  OWLCMD_INT ("recv:scroll", owl_function_page_curmsg, OWL_CTX_INTERACTIVE,
  • functions.c

    r0cb6c26 r70110286  
    35323532  sigprocmask(SIG_UNBLOCK, &intr, oldmask);
    35333533}
     3534
     3535void _owl_function_mark_message(owl_message *m)
     3536{
     3537  if (m)
     3538    owl_global_set_markedmsgid(&g, owl_message_get_id(m));
     3539}
     3540
     3541void owl_function_mark_message()
     3542{
     3543  owl_message *m;
     3544  owl_view *v;
     3545
     3546  v=owl_global_get_current_view(&g);
     3547
     3548  /* bail if there's no current message */
     3549  if (owl_view_get_size(v) < 1) {
     3550    owl_function_error("No messages to mark");
     3551    return;
     3552  }
     3553
     3554  /* mark the message */
     3555  m=owl_view_get_element(v, owl_global_get_curmsg(&g));
     3556  _owl_function_mark_message(m);
     3557}
     3558
     3559void owl_function_swap_cur_marked()
     3560{
     3561  int marked_id;
     3562  owl_message *m;
     3563  owl_view *v;
     3564
     3565  v=owl_global_get_current_view(&g);
     3566  /* bail if there's no current message */
     3567  if (owl_view_get_size(v) < 1) {
     3568    return;
     3569  }
     3570  m=owl_view_get_element(v, owl_global_get_curmsg(&g));
     3571  marked_id=owl_global_get_markedmsgid(&g);
     3572
     3573  _owl_function_mark_message(m);
     3574
     3575  owl_global_set_curmsg(&g, owl_view_get_nearest_to_msgid(v, marked_id));
     3576  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
     3577  owl_global_set_direction_downwards(&g);
     3578}
  • global.c

    r0cb6c26 r70110286  
    199199}
    200200
     201/* markedmsgid */
     202
     203int owl_global_get_markedmsgid(owl_global *g) {
     204  return(g->markedmsgid);
     205}
     206
     207void owl_global_set_markedmsgid(owl_global *g, int i) {
     208  g->markedmsgid=i;
     209  /* i; index of message in the current view.
     210  owl_message *m;
     211  owl_view *v;
     212
     213  v = owl_global_get_current_view(&g);
     214  m = owl_view_get_element(v, i);
     215  g->markedmsgid = m ? owl_message_get_id(m) : 0;
     216  */
     217}
     218
    201219/* windows */
    202220
  • keys.c

    rce56149 r70110286  
    263263  BIND_CMD("M-v",    "recv:pageup",    "");
    264264  BIND_CMD("PPAGE",  "recv:pageup",    "");
     265  BIND_CMD("C-@",    "recv:mark",      "");
     266  BIND_CMD("C-x C-x",    "recv:swapmark",  "");
    265267
    266268  BIND_CMD("SPACE",     "recv:scroll  10", "scroll message down a page");
  • owl.h

    re1b136bf r70110286  
    535535  owl_errqueue errqueue;
    536536  int lines, cols;
    537   int curmsg, topmsg;
     537  int curmsg, topmsg, markedmsg;
     538  int markedmsgid;              /* for finding the marked message when it has moved. */
    538539  int curmsg_vert_offset;
    539540  owl_view current_view;
Note: See TracChangeset for help on using the changeset viewer.