Changeset 2fc8397


Ignore:
Timestamp:
Jul 11, 2009, 1:14:36 PM (15 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
19a023f
Parents:
77f605d
git-author:
Nelson Elhage <nelhage@mit.edu> (07/06/09 20:41:51)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/11/09 13:14:36)
Message:
Implement {forward,backward}-paragraph
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    ra60edf2 r2fc8397  
    938938                  "runs 'editmulti:done'.\n"\
    939939                  "Otherwise runs 'edit:delete-next-char'\n"),
     940
     941  OWLCMD_VOID_CTX("editmulti:forward-paragraph", owl_editwin_forward_paragraph,
     942                  OWL_CTX_EDITMULTI,
     943                  "Move forward to end of paragraph.",
     944                  "",
     945                  "Move the point to the end of the current paragraph"),
     946
     947  OWLCMD_VOID_CTX("editmulti:backward-paragraph", owl_editwin_backward_paragraph,
     948                  OWL_CTX_EDITMULTI,
     949                  "Move backward to the start of paragraph.",
     950                  "",
     951                  "Move the point to the start of the current paragraph"),
    940952
    941953  /****************************************************************/
  • editwin.c

    r77f605d r2fc8397  
    10501050}
    10511051
     1052void owl_editwin_backward_paragraph(owl_editwin *e)
     1053{
     1054  owl_editwin_point_move(e, -1);
     1055  for (; e->index >= e->lock; owl_editwin_point_move(e, -1)) {
     1056    if (e->index <= e->lock ||
     1057        ((e->buff[e->index] == '\n') && (e->buff[e->index - 1]=='\n')))
     1058      break;
     1059  }
     1060}
     1061
     1062void owl_editwin_forward_paragraph(owl_editwin *e)
     1063{
     1064  owl_editwin_point_move(e, 1);
     1065  /* scan forward to the start of the next paragraph */
     1066  for(; e->index < e->bufflen; owl_editwin_point_move(e, 1)) {
     1067    if (e->buff[e->index -1] == '\n' && e->buff[e->index] == '\n')
     1068      break;
     1069  }
     1070}
     1071
    10521072static int oe_display_column(owl_editwin *e)
    10531073{
  • keys.c

    ra60edf2 r2fc8397  
    109109  BIND_CMD("M-[ B",   "editmulti:move-down-line", "");
    110110  BIND_CMD("C-n",     "editmulti:move-down-line", "");
     111
     112  BIND_CMD("M-}",     "editmulti:forward-paragraph", "");
     113  BIND_CMD("M-{",     "editmulti:backward-paragraph", "");
    111114
    112115  /* This would be nice, but interferes with C-c to cancel */
Note: See TracChangeset for help on using the changeset viewer.