Changeset 30da473


Ignore:
Timestamp:
Aug 2, 2010, 11:38:03 PM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
e0022d2
Parents:
2b83ad6
git-author:
David Benjamin <davidben@mit.edu> (07/25/10 19:43:08)
git-committer:
David Benjamin <davidben@mit.edu> (08/02/10 23:38:03)
Message:
Expand tabs before applying OWL_TAB

This is a partial fix to #90. Messages with tabs still do not correctly
tab in the default style, if the intent is to begin column counts after
the 4-space indent. But, if the style does give us tabs, BarnOwl should
correctly draw them from the style. Expanding them here both deals with
owl_fmtext_truncate_cols not understanding tabs and tabs getting
confused by the OWL_TAB indent.

A full fix should expand tabs in the style layer, taking markup into
account.
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fmtext.c

    r2b83ad6 r30da473  
    389389    if (c == '\t') {
    390390      /* Copy up to this tab */
    391       _owl_fmtext_append_fmtext(out, in, numcopied, ptr - in->textbuff - 1);
     391      _owl_fmtext_append_fmtext(out, in, numcopied, ptr - in->textbuff);
    392392      /* and then copy spaces for the tab. */
    393393      chwidth = OWL_TAB_WIDTH - (col % OWL_TAB_WIDTH);
     
    406406  /* Append anything we've missed. */
    407407  if (numcopied < in->textlen)
    408     _owl_fmtext_append_fmtext(out, in, numcopied, in->textlen - 1);
     408    _owl_fmtext_append_fmtext(out, in, numcopied, in->textlen);
    409409}
    410410
  • style.c

    rb585ba2 r30da473  
    4545  char *indent;
    4646  int curlen;
     47  owl_fmtext with_tabs;
    4748
    4849  SV *sv = NULL;
     
    7273  }
    7374
     75  owl_fmtext_init_null(&with_tabs);
    7476  /* fmtext_append.  This needs to change */
    75   owl_fmtext_append_ztext(fm, indent);
     77  owl_fmtext_append_ztext(&with_tabs, indent);
     78  /* Expand tabs, taking the indent into account. Otherwise, tabs from the
     79   * style display incorrectly due to our own indent. */
     80  owl_fmtext_expand_tabs(&with_tabs, fm, OWL_TAB_WIDTH - OWL_TAB);
     81  owl_fmtext_cleanup(&with_tabs);
    7682
    7783  owl_free(indent);
Note: See TracChangeset for help on using the changeset viewer.