public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] eselect r440 - in trunk: . libs
@ 2009-04-16 21:05 Ulrich Mueller (ulm)
  0 siblings, 0 replies; only message in thread
From: Ulrich Mueller (ulm) @ 2009-04-16 21:05 UTC (permalink / raw
  To: gentoo-commits

Author: ulm
Date: 2009-04-16 21:05:28 +0000 (Thu, 16 Apr 2009)
New Revision: 440

Modified:
   trunk/ChangeLog
   trunk/libs/output.bash.in
Log:
Fix logic for insertion of spaces between words, bug 260464.

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-04-16 15:10:36 UTC (rev 439)
+++ trunk/ChangeLog	2009-04-16 21:05:28 UTC (rev 440)
@@ -1,5 +1,8 @@
 2009-04-16  Ulrich Mueller  <ulm@gentoo.org>
 
+	* libs/output.bash.in (write_kv_list_entry): Fix logic for
+	insertion of spaces between words, bug 260464.
+
 	* libs/config.bash.in (store_config): Split config file content
 	on newlines only, not on all whitespace. Fixes bug 219864.
 

Modified: trunk/libs/output.bash.in
===================================================================
--- trunk/libs/output.bash.in	2009-04-16 15:10:36 UTC (rev 439)
+++ trunk/libs/output.bash.in	2009-04-16 21:05:28 UTC (rev 440)
@@ -119,31 +119,22 @@
     text=${val//\%%%??%%%/}
     # only loop if it doesn't fit on the same line
     if [[ $(( ${n} + ${#text} )) -ge ${cols} ]] ; then
-        local i=0
+        local i=0 spc=""
         rindent="${rindent}$(space 28)"
         cwords=( ${cwords} )
         for text in ${val} ; do
             text=${text//\%%%??%%%/}
             # put the word on the same line if it fits
-            if [[ $(( ${n} + ${#text} + 1 )) -lt ${cols} ]] ; then
-                echo -n -e "${cwords[i]}"
-                n=$(( ${n} + ${#text} ))
-                # only append a space if we're not on the last word
-                if [[ ${i} -ne ${#cwords} ]] ; then
-                    echo -n ' '
-                    n=$(( ${n} + 1 ))
-                fi
+            if [[ $(( ${n} + ${#spc} + ${#text} )) -lt ${cols} ]] ; then
+                echo -n -e "${spc}${cwords[i]}"
+                n=$(( ${n} + ${#spc} + ${#text} ))
             # otherwise, start a new line and indent
             else
                 echo -n -e "\n${rindent}${cwords[i]}"
                 n=$(( ${#rindent} + ${#text} ))
-                # only append a space if we're not on the last word
-                if [[ ${i} -ne ${#cwords} ]] ; then
-                    echo -n ' '
-                    n=$(( ${n} + 1 ))
-                fi
             fi
             i=$(( ${i} + 1 ))
+            spc=" "
         done
     else
         echo -n -e "${cwords}"




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-16 21:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-16 21:05 [gentoo-commits] eselect r440 - in trunk: . libs Ulrich Mueller (ulm)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox