Control: tags -1 patch

Helge,

I know this has been waiting for a very long time!

I agree that the sdiff and diff3 output is difficult to read.

I propose the attached patch which uses non-breaking spaces to preserve the
alignment. AIUI they are available in all environments other than pure 7-bit
ASCII (LC_ALL=C).

Mark

diff --git a/ucf b/ucf
index 5c569f4..87a23bf 100755
--- a/ucf
+++ b/ucf
@@ -86,13 +86,15 @@ show_diff() {
         if  [ 99999 -lt "$(echo "$1" | wc -c | awk '{print $1; }')" ]; then
             DIFF="The differences between the files are too large to display."
         else
-            DIFF="$1"
+	    # Try to convert 8-bit ASCII non-breaking space to current locale
+	    nbsp=$(printf '\240' | iconv -c --from-code=ISO88591 --to-code=//TRANSLIT)
+	    DIFF="$(printf "%s" "$1" | sed "s/ /${nbsp:- }/g" | debconf-escape -e )"
         fi
     fi
     if [ "$DEBCONF_OK" = "YES" ] && [ "$DEBIAN_HAS_FRONTEND" ]; then
 	templ=ucf/show_diff
 	db_capb escape
-	db_subst $templ DIFF "$(printf %s "$DIFF" | debconf-escape -e)"
+	db_subst $templ DIFF "$DIFF"
 	db_fset $templ seen false
 	db_input critical $templ || true
 	db_go || true
@@ -992,7 +994,7 @@ else
 		show_diff "$DIFF"
 		;;
 	    sdiff|S|s)
-		DIFF="$(run_diff sdiff -BbW "$dest_file" "$new_file")"
+		DIFF="$(run_diff sdiff -BbWt "$dest_file" "$new_file")"
 		show_diff "$DIFF"
 		;;
 	    diff_threeway|3|t|T)

Reply via email to