diff options
author | Eduardo Chappa <chappa@washington.edu> | 2013-07-14 01:28:36 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2013-07-14 01:28:36 -0600 |
commit | d0f63f5130c5024bead498ea8a0ebf26d8b72478 (patch) | |
tree | 21181cf33aa0d743138e7466e2d652815dd3aaa5 /pico | |
parent | b0f119565dcf76eb0ef8926e84736ea532aefdb1 (diff) | |
download | alpine-d0f63f5130c5024bead498ea8a0ebf26d8b72478.tar.xz |
* Further improvement to justification to deal with quote strings that
only contain spaces (ASCII 32). There is more to do to deal with TABs
and non-breaking spaces.
Diffstat (limited to 'pico')
-rw-r--r-- | pico/word.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/pico/word.c b/pico/word.c index 335babcd..a46bf3ef 100644 --- a/pico/word.c +++ b/pico/word.c @@ -449,17 +449,17 @@ do_quote_match(UCS *q, LINE *l, UCS *buf, size_t buflen) * (">" and whatever the user's quote_string is) */ - /* count leading whitespace as part of the quote */ *buf = '\0'; if(l == NULL) return; + /* count leading whitespace as part of the quote */ for(j = 0; j <= llength(l) && lgetc(l, j).c == ' ' && j+1 < buflen; j++) buf[j] = lgetc(l, j).c; - buf[j] = '\0'; - if(*q == '\0') + + if(q == NULL || *q == '\0') return; /* pare down q so it contains no leading or trailing whitespace */ @@ -468,8 +468,12 @@ do_quote_match(UCS *q, LINE *l, UCS *buf, size_t buflen) for(i = ucs4_strlen(q); i > 0 && q[i-1] == ' '; i--); qend = i; - if(qend <= qstart) + /* for quote strings that are blanks, chop buf to the length of q */ + if(qend <= qstart){ + if(ucs4_strlen(q) < buflen) + buf[ucs4_strlen(q)] = '\0'; return; + } while(j <= llength(l)){ for(i = qstart; j <= llength(l) && i < qend; i++, j++) |