summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2013-07-09 22:38:53 -0600
committerEduardo Chappa <chappa@washington.edu>2013-07-09 23:43:53 -0600
commitcd0c8df49a052009fd0e0a5141632333ede80dd3 (patch)
tree3b2cc9f96a92c1cc6a96c8e231a2fc9c4366f4eb
parentc9e90d3c705c2a2636a24626c5d52e624f91e6e7 (diff)
downloadalpine-cd0c8df49a052009fd0e0a5141632333ede80dd3.tar.xz
* Improvements in justification: Quoted lines that are followed by a
space after the quote string were considered paragraphs by themselves, now they are considered part of a paragraph, as they are. Based on joint work with Jeff Franklin for the Pine 4.5X series.
-rw-r--r--VERSION2
-rwxr-xr-xconfigure20
-rw-r--r--pico/word.c128
-rw-r--r--pith/pine.hlp6
4 files changed, 116 insertions, 40 deletions
diff --git a/VERSION b/VERSION
index fb2af4ea..fa35a9a4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.10.99
+2.10.999
diff --git a/configure b/configure
index a1d87b04..0f94a089 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac Rev:1 by chappa@washington.edu.
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for alpine 2.10.99.
+# Generated by GNU Autoconf 2.69 for alpine 2.10.999.
#
# Report bugs to <chappa@washington.edu>.
#
@@ -730,8 +730,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='alpine'
PACKAGE_TARNAME='alpine'
-PACKAGE_VERSION='2.10.99'
-PACKAGE_STRING='alpine 2.10.99'
+PACKAGE_VERSION='2.10.999'
+PACKAGE_STRING='alpine 2.10.999'
PACKAGE_BUGREPORT='chappa@washington.edu'
PACKAGE_URL=''
@@ -1593,7 +1593,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures alpine 2.10.99 to adapt to many kinds of systems.
+\`configure' configures alpine 2.10.999 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1663,7 +1663,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of alpine 2.10.99:";;
+ short | recursive ) echo "Configuration of alpine 2.10.999:";;
esac
cat <<\_ACEOF
@@ -1947,7 +1947,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-alpine configure 2.10.99
+alpine configure 2.10.999
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2553,7 +2553,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by alpine $as_me 2.10.99, which was
+It was created by alpine $as_me 2.10.999, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3374,7 +3374,7 @@ fi
# Define the identity of the package.
PACKAGE='alpine'
- VERSION='2.10.99'
+ VERSION='2.10.999'
cat >>confdefs.h <<_ACEOF
@@ -19930,7 +19930,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by alpine $as_me 2.10.99, which was
+This file was extended by alpine $as_me 2.10.999, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -19996,7 +19996,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-alpine config.status 2.10.99
+alpine config.status 2.10.999
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/pico/word.c b/pico/word.c
index 145fc1d1..335babcd 100644
--- a/pico/word.c
+++ b/pico/word.c
@@ -4,8 +4,8 @@ static char rcsid[] = "$Id: word.c 769 2007-10-24 00:15:40Z hubert@u.washington.
/*
* ========================================================================
- * Copyright 2006-2007 University of Washington
* Copyright 2013 Eduardo Chappa
+ * Copyright 2006-2007 University of Washington
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -431,40 +431,112 @@ is_user_separator(UCS c)
return 0;
}
+void
+do_quote_match(UCS *q, LINE *l, UCS *buf, size_t buflen)
+{
+ register int i, j, qb;
+ int qstart, qend, k;
+
+ /*
+ * The method for determining the quote string is:
+ * 1) strip leading and trailing whitespace from q
+ * 2) add all leading whitespace to buf
+ * 3) check for q
+ * 4) if q, append q to buf and any trailing whitespace
+ * 5) repeat steps 3 and 4 as necessary
+ *
+ * q in the future could be made to be an array of (UCS *)'s
+ * (">" and whatever the user's quote_string is)
+ */
+
+ /* count leading whitespace as part of the quote */
+ *buf = '\0';
+
+ if(l == NULL)
+ return;
+
+ 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')
+ return;
+
+ /* 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;
+
+ if(qend <= qstart)
+ return;
+
+ while(j <= llength(l)){
+ for(i = qstart; j <= llength(l) && i < qend; i++, j++)
+ if(q[i] != lgetc(l, j).c)
+ return;
+
+ if(i >= qend){
+ if(ucs4_strlen(buf) + qend - qstart < (buflen - 1))
+ ucs4_strncat(buf, q + qstart, qend - qstart);
+ }
+
+ /*
+ * if we're this far along, we've matched a quote string,
+ * and should now add the following white space.
+ */
+ for(k = ucs4_strlen(buf);
+ j <= llength(l) && lgetc(l,j).c == ' ' && (k + 1 < buflen);
+ j++, k++){
+ buf[k] = lgetc(l,j).c;
+ }
+ buf[k] = '\0';
+
+ if(j > llength(l))
+ return;
+ }
+}
/*
* Return number of quotes if whatever starts the line matches the quote string
*/
int
-quote_match(UCS *q, LINE *l, UCS *buf, size_t buflen)
+quote_match(UCS *q, LINE *gl, UCS *bufl, size_t buflen)
{
- register int i, n, j, qb;
-
- *buf = '\0';
- if(*q == '\0')
- return(1);
-
- qb = (ucs4_strlen(q) > 1 && q[ucs4_strlen(q)-1] == ' ') ? 1 : 0;
- for(n = 0, j = 0; ;){
- for(i = 0; j <= llength(l) && qb ? q[i+1] : q[i]; i++, j++)
- if(q[i] != lgetc(l, j).c)
- return(n);
-
- n++;
- if((!qb && q[i] == '\0') || (qb && q[i+1] == '\0')){
- if(ucs4_strlen(buf) + ucs4_strlen(q) + 1 < buflen){
- ucs4_strncat(buf, q, buflen-ucs4_strlen(q)-1);
- buf[buflen-1] = '\0';
- if(qb && (j > llength(l) || lgetc(l, j).c != ' '))
- buf[ucs4_strlen(buf)-1] = '\0';
- }
- }
- if(j > llength(l))
- return(n);
- else if(qb && lgetc(l, j).c == ' ')
- j++;
+ 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 quoted_line = 0;
+
+ do_quote_match(q, pl, bufp, sizeof(bufp)); /* previous line */
+ do_quote_match(q, gl, bufl, buflen); /* given line */
+ do_quote_match(q, nl, bufn, sizeof(bufn)); /* next line */
+
+ if(!ucs4_strcmp(bufp, bufl))
+ return ucs4_strlen(bufl);
+
+ /* 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])
+ quoted_line = 1;
}
- return(n); /* never reached */
+
+ /* compare bufl and bufn */
+ for(i = 0; bufl[i] && bufn[i] && bufl[i] == bufn[i]; i++);
+
+ /* go back to last non-space character */
+ for(; i > 0 && bufl[i-1] == ' '; i--);
+
+ /* do bufl and bufn differ only in spaces? */
+ for(j = i; bufl[j] && bufl[j] == ' '; j++);
+
+ /* if they differ only on trailing spaces, chop bufl to agree with bufn */
+ if (!bufl[j] )
+ bufl[Pmaster && quoted_line ? (j > i ? i+1 : i) : i] = '\0';
+
+ return ucs4_strlen(bufl);
}
diff --git a/pith/pine.hlp b/pith/pine.hlp
index dd0d9cad..bbec06bc 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 13 2013-06-21 12:51:47
+Alpine Commit 14 2013-07-09 22:38:37
============= h_news =================
<HTML>
<HEAD>
@@ -180,6 +180,10 @@ Additions include:
<UL>
<LI> Increase encryption of S/MIME encrypted messages.
+ <LI> Improvements in justification of paragraphs: lines that begin
+with a quote string, followed by a space were considered individual paragraphs,
+now they are considered part of a paragraph. Based on earlier joint work
+with Jeff Franklin.
<LI> Add ability to <A HREF="h_config_folder_color">color folder names</A>,
<A HREF="h_config_directory_color">directory names</A>,
and <A HREF="h_config_folder_list_color">text</A> in the FOLDER SCREEN.