Changeset d36f2cb


Ignore:
Timestamp:
Jun 29, 2002, 7:42:37 PM (22 years ago)
Author:
Erik Nygren <nygren@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
8ee73f8d
Parents:
7360fab
Message:
	Added variables edit:maxfillcols and edit:maxwrapcols which
	        will limit how wide editing paragraphs may get before
		they get wrapped.  Default is 70 columns each.
	Added smartzpunt command with key binding of "C-x k".
	        This starts a zpunt command filled in with
		the proposed zpunt.
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r7360fab rd36f2cb  
    2929                matching current" and "move to previous message
    3030                matching current"
     31        Added variables edit:maxfillcols and edit:maxwrapcols which
     32                will limit how wide editing paragraphs may get before
     33                they get wrapped.  Default is 70 columns each.
     34        Added smartzpunt command with key binding of "C-x k".
     35                This starts a zpunt command filled in with
     36                the proposed zpunt.
    3137       
    32381.2.0-pre-erikdevel-17
  • commands.c

    r7360fab rd36f2cb  
    148148              "getsubs retrieves the current subscriptions from the server\n"
    149149              "and displays them.\n"),
     150
     151  OWLCMD_ARGS("smartzpunt", owl_command_smartzpunt, OWL_CTX_INTERACTIVE,
     152              "creates a zpunt based on the current message",
     153              "smartnarrow [-i | --instance]",
     154              "Starts a zpunt command based on the current message's class\n"
     155              "(and instance if -i is specified).\n"),
    150156
    151157  OWLCMD_ARGS("zpunt", owl_command_zpunt, OWL_CTX_ANY,
     
    13861392}
    13871393
     1394char *owl_command_smartzpunt(int argc, char **argv, char *buff) {
     1395  if (argc == 1) {
     1396    owl_function_smartzpunt(0);
     1397  } else if (argc == 2 && (!strcmp(argv[1], "-i") || !strcmp(argv[1], "--instance"))) {
     1398    owl_function_smartzpunt(1);
     1399  } else {
     1400    owl_function_makemsg("Wrong number of arguments for %s", argv[0]);   
     1401  }
     1402  return NULL;
     1403}
     1404
     1405
    13881406
    13891407/*********************************************************************/
  • editwin.c

    r1aee7d9 rd36f2cb  
    2121  e->winlines=winlines;
    2222  e->wincols=wincols;
    23   if (wincols > 80) {
    24     e->fillcol=80-9;
    25   } else {
    26     e->fillcol=wincols-9;
    27   }
    28   e->wrapcol=wincols-9;
     23  e->fillcol=owl_editwin_limit_maxcols(wincols-1,
     24                                       owl_global_get_edit_maxfillcols(&g));
     25  e->wrapcol=owl_editwin_limit_maxcols(wincols-1,
     26                                       owl_global_get_edit_maxwrapcols(&g));
    2927  e->curswin=win;
    3028  e->style=style;
     
    4240  e->winlines=winlines;
    4341  e->wincols=wincols;
    44   if (wincols > 80) {
    45     e->fillcol=80-8;
    46   } else {
    47     e->fillcol=wincols-8;
    48   }
    49   e->wrapcol=wincols-9;
     42  e->fillcol=owl_editwin_limit_maxcols(wincols-1,
     43                                       owl_global_get_edit_maxfillcols(&g));
     44  e->wrapcol=owl_editwin_limit_maxcols(wincols-1,
     45                                       owl_global_get_edit_maxwrapcols(&g));
    5046}
    5147
     
    5652void owl_editwin_set_dotsend(owl_editwin *e) {
    5753  e->dotsend=1;
     54}
     55
     56int owl_editwin_limit_maxcols(int v, int maxv) {
     57  if (maxv > 5 && v > maxv) {
     58    return maxv;
     59  } else {
     60    return v;
     61  }
    5862}
    5963
  • functions.c

    r7360fab rd36f2cb  
    218218                         skip_deleted?" non-deleted":"",
    219219                         filter?" in ":"", filter?filter:"");
    220     owl_function_beep();
     220    if (!skip_deleted) owl_function_beep();
    221221  }
    222222
     
    267267                         skip_deleted?" non-deleted":"",
    268268                         filter?" in ":"", filter?filter:"");
    269     owl_function_beep();
     269    if (!skip_deleted) owl_function_beep();
    270270  }
    271271
     
    18431843}
    18441844
     1845void owl_function_smartzpunt(int type) {
     1846  /* Starts a zpunt command based on the current class,instance pair.
     1847   * If type=0, uses just class.  If type=1, uses instance as well. */
     1848  owl_view *v;
     1849  owl_message *m;
     1850  char *cmd, *cmdprefix, *mclass, *minst;
     1851 
     1852  v=owl_global_get_current_view(&g);
     1853  m=owl_view_get_element(v, owl_global_get_curmsg(&g));
     1854
     1855  if (owl_view_get_size(v)==0) {
     1856    owl_function_makemsg("No message selected\n");
     1857    return;
     1858  }
     1859
     1860  /* for now we skip admin messages. */
     1861  if (owl_message_is_admin(m)
     1862      || owl_message_is_login(m)
     1863      || !owl_message_is_zephyr(m)) {
     1864    owl_function_makemsg("smartzpunt doesn't support this message type.");
     1865    return;
     1866  }
     1867
     1868  mclass = owl_message_get_class(m);
     1869  minst = owl_message_get_instance(m);
     1870  if (!mclass || !*mclass || *mclass==' '
     1871      || (!strcasecmp(mclass, "message") && !strcasecmp(minst, "personal"))
     1872      || (type && (!minst || !*minst|| *minst==' '))) {
     1873    owl_function_makemsg("smartzpunt can't safely do this for <%s,%s>",
     1874                         mclass, minst);
     1875  } else {
     1876    cmdprefix = "start-command zpunt ";
     1877    cmd = owl_malloc(strlen(cmdprefix)+strlen(mclass)+strlen(minst)+3);
     1878    strcpy(cmd, cmdprefix);
     1879    strcat(cmd, mclass);
     1880    if (type) {
     1881      strcat(cmd, " ");
     1882      strcat(cmd, minst);
     1883    } else {
     1884      strcat(cmd, " *");
     1885    }
     1886    owl_function_command(cmd);
     1887    owl_free(cmd);
     1888  }
     1889}
     1890
     1891
     1892
    18451893void owl_function_color_current_filter(char *color) {
    18461894  owl_filter *f;
  • keys.c

    r7360fab rd36f2cb  
    188188  BIND_CMD("d",       "delete",         "mark message for deletion");
    189189  BIND_CMD("M-D",     "delete view",    "mark all messages in view for deletion");
     190  BIND_CMD("C-x k",   "smartzpunt -i",  "zpunt current <class,instance>");
    190191
    191192  BIND_CMD("X",   "( expunge ; view --home )", "expunge deletions and switch to home view");
  • variable.c

    r1aee7d9 rd36f2cb  
    119119  OWLVAR_STRING( "view_home" /* %OwlVarStub */, "all",
    120120                 "home view to switch to after 'X'" ),
     121
     122  OWLVAR_INT(    "edit:maxfillcols" /* %OwlVarStub:edit_maxfillcols */, 70,
     123                 "maximum number of columns for M-q to fill text to" ),
     124
     125  OWLVAR_INT(    "edit:maxwrapcols" /* %OwlVarStub:edit_maxwrapcols */, 70,
     126                 "maximum number of columns for line-wrapping" ),
    121127
    122128  OWLVAR_INT_FULL( "typewinsize" /* %OwlVarStub:typwin_lines */,
Note: See TracChangeset for help on using the changeset viewer.