summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2013-07-15 14:40:46 -0600
committerEduardo Chappa <chappa@washington.edu>2013-07-15 14:40:46 -0600
commit6f187653ec9cc2122670cd67d01bf8394dc62fe2 (patch)
tree1d153b764fd6bbc5d7e30906f98417de2cc32ed4
parentd0f63f5130c5024bead498ea8a0ebf26d8b72478 (diff)
downloadalpine-6f187653ec9cc2122670cd67d01bf8394dc62fe2.tar.xz
* Fix support for quote strings that have trailing spaces.
-rw-r--r--pico/word.c13
-rw-r--r--pith/pine.hlp2
2 files changed, 11 insertions, 4 deletions
diff --git a/pico/word.c b/pico/word.c
index a46bf3ef..e5b361b7 100644
--- a/pico/word.c
+++ b/pico/word.c
@@ -510,7 +510,7 @@ quote_match(UCS *q, LINE *gl, UCS *bufl, size_t buflen)
LINE *nl = gl != curbp->b_linep ? lforw(gl) : NULL;
LINE *pl = lback(gl) != curbp->b_linep ? lback(gl) : NULL;
UCS bufp[NSTRING], bufn[NSTRING];
- int i, j;
+ int i, j, qstart, qend;
int quoted_line = 0;
do_quote_match(q, pl, bufp, sizeof(bufp)); /* previous line */
@@ -522,8 +522,15 @@ quote_match(UCS *q, LINE *gl, UCS *bufl, size_t buflen)
/* is this line quoted? */
if(q && *q){
- for(i = 0; i < llength(gl) && q[i] && lgetc(gl, i).c == q[i]; i++);
- if(!q[i])
+ /* pare down q so it contains no leading or trailing whitespace */
+ for(i = 0; q[i] == ' '; i++);
+ qstart = i;
+ for(i = ucs4_strlen(q); i > 0 && q[i-1] == ' '; i--);
+ qend = i;
+ for(i = 0; i < llength(gl)
+ && i + qstart < qend
+ && lgetc(gl, i).c == q[i+qstart]; i++);
+ if(i + qstart == qend)
quoted_line = 1;
}
diff --git a/pith/pine.hlp b/pith/pine.hlp
index edd2896d..cf5039b1 100644
--- a/pith/pine.hlp
+++ b/pith/pine.hlp
@@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any
reasonable place to be called from.
Dummy change to get revision in pine.hlp
============= h_revision =================
-Alpine Commit 15 2013-07-10 23:11:10
+Alpine Commit 17 2013-07-15 14:35:02
============= h_news =================
<HTML>
<HEAD>