[2559] in BarnOwl Developers
[PATCH 2/3] Expand tabs before applying OWL_TAB
daemon@ATHENA.MIT.EDU (David Benjamin)
Sun Jul 25 20:19:42 2010
From: David Benjamin <davidben@MIT.EDU>
To: barnowl-dev@mit.edu
Date: Sun, 25 Jul 2010 17:19:31 -0700
In-Reply-To: <1280103572-6009-1-git-send-email-davidben@mit.edu>
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.
---
style.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/style.c b/style.c
index 4894f1c..e2c6903 100644
--- a/style.c
+++ b/style.c
@@ -44,6 +44,7 @@ void owl_style_get_formattext(const owl_style *s, owl_fmtext *fm, const owl_mess
const char *body;
char *indent;
int curlen;
+ owl_fmtext with_tabs;
SV *sv = NULL;
@@ -71,8 +72,13 @@ void owl_style_get_formattext(const owl_style *s, owl_fmtext *fm, const owl_mess
indent[curlen+1] = '\0';
}
+ owl_fmtext_init_null(&with_tabs);
/* fmtext_append. This needs to change */
- owl_fmtext_append_ztext(fm, indent);
+ owl_fmtext_append_ztext(&with_tabs, indent);
+ /* Expand tabs, taking the indent into account. Otherwise, tabs from the
+ * style display incorrectly due to our own indent. */
+ owl_fmtext_expand_tabs(&with_tabs, fm, OWL_TAB_WIDTH - OWL_TAB);
+ owl_fmtext_cleanup(&with_tabs);
owl_free(indent);
if(sv)
--
1.7.2.rc2.1.gaace1