mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-18 08:51:46 +03:00
Use printf instead of echo for displaying modified lines
Avoid eventual interpretation of escapes in the line.
This commit is contained in:
parent
f200079069
commit
f69495ea71
4
test/run
4
test/run
@ -149,14 +149,14 @@ colorize() {
|
|||||||
|
|
||||||
show_diff() {
|
show_diff() {
|
||||||
diff -u $1 $2 | while IFS='' read -r line; do
|
diff -u $1 $2 | while IFS='' read -r line; do
|
||||||
first_character=$(echo "$line" | cut -b 1)
|
first_character=$(printf '%s\n' "$line" | cut -b 1)
|
||||||
case $first_character in
|
case $first_character in
|
||||||
+) color=green ;;
|
+) color=green ;;
|
||||||
-) color=red ;;
|
-) color=red ;;
|
||||||
@) color=magenta ;;
|
@) color=magenta ;;
|
||||||
*) color=none ;;
|
*) color=none ;;
|
||||||
esac
|
esac
|
||||||
echo "$line" | colorize $color normal
|
printf '%s\n' "$line" | colorize $color normal
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user