From d0f63f5130c5024bead498ea8a0ebf26d8b72478 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sun, 14 Jul 2013 01:28:36 -0600 Subject: * 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. --- pico/word.c | 12 ++++++++---- po/Makefile.in | 12 ++++++------ 2 files changed, 14 insertions(+), 10 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++) diff --git a/po/Makefile.in b/po/Makefile.in index 3cc398e1..7c50c48c 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -34,14 +34,14 @@ INSTALL_DATA = ${INSTALL} -m 644 # We use $(mkdir_p). # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, -# ${SHELL} /run/media/echappa/Alpine/alpine/alpinegit/install-sh does not start with $(SHELL), so we add it. -# In automake >= 1.10, /usr/bin/mkdir -p is derived from ${MKDIR_P}, which is defined +# ${SHELL} /media/Alpine/alpine/alpinegit/install-sh does not start with $(SHELL), so we add it. +# In automake >= 1.10, /bin/mkdir -p is derived from ${MKDIR_P}, which is defined # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake # versions, $(mkinstalldirs) and $(install_sh) are unused. -mkinstalldirs = $(SHELL) ${SHELL} /run/media/echappa/Alpine/alpine/alpinegit/install-sh -d -install_sh = $(SHELL) ${SHELL} /run/media/echappa/Alpine/alpine/alpinegit/install-sh -MKDIR_P = /usr/bin/mkdir -p -mkdir_p = /usr/bin/mkdir -p +mkinstalldirs = $(SHELL) ${SHELL} /media/Alpine/alpine/alpinegit/install-sh -d +install_sh = $(SHELL) ${SHELL} /media/Alpine/alpine/alpinegit/install-sh +MKDIR_P = /bin/mkdir -p +mkdir_p = /bin/mkdir -p GMSGFMT_ = /usr/bin/msgfmt GMSGFMT_no = /usr/bin/msgfmt -- cgit v1.2.3-54-g00ecf