ANSI colors and the space they take.

From: Sandman (mr_at_sandman.net)
Date: 12/31/03


Date: Wed, 31 Dec 2003 11:35:48 +0100

I like ansi colors, but I've run in to this problem:

printf "\e[32;01m%-14s\e[00;00m \e[37;01m%-30s\e[00;00m\n", "Hello", "World!";
printf "%-14s %-30s\n", "Hello", "World!";
printf "%-14s %-30s\n", "\e[32;01mHello\e[00;00m", "\e[37;01mWorld!\e[00;00m";

This results in:

Hello World!
Hello World!
Hello World!

(albeit color-coded)

In the last example, the length of the actual ansi code seems to be taken into
consideration for printf - is there a way to elaviate this?