aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-28 21:52:24 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-28 21:52:24 +0000
commit34e1a0bc4b3dca95062fddc7739b31586e7cda10 (patch)
tree85dcd2bb0e3296df05f9aeea283faad6c6d01963
parent02912ca61fe8794415c11757cc1d48b7ab794309 (diff)
downloadpaludis-34e1a0bc4b3dca95062fddc7739b31586e7cda10.tar.gz
paludis-34e1a0bc4b3dca95062fddc7739b31586e7cda10.tar.xz
r1213@snowdrop: ciaranm | 2006-07-28 22:49:36 +0100
Disable xterm titles for dumb and linux terminals. Fixes: Berlios#8235.
-rw-r--r--src/paludis/colour.cc11
-rw-r--r--src/paludis/colour.hh3
2 files changed, 13 insertions, 1 deletions
diff --git a/src/paludis/colour.cc b/src/paludis/colour.cc
index 9e63e58..6a81e44 100644
--- a/src/paludis/colour.cc
+++ b/src/paludis/colour.cc
@@ -29,3 +29,14 @@ bool use_colour()
return result;
}
+
+bool use_xterm_titles()
+{
+ static bool result(
+ (0 != paludis::getenv_with_default("TERM", "").compare(0, 4, "dumb")) &&
+ (0 != paludis::getenv_with_default("TERM", "").compare(0, 5, "linux")));
+
+ return result;
+}
+
+
diff --git a/src/paludis/colour.hh b/src/paludis/colour.hh
index 50aea69..62b58bd 100644
--- a/src/paludis/colour.hh
+++ b/src/paludis/colour.hh
@@ -76,6 +76,7 @@ enum Colour
};
bool use_colour() PALUDIS_ATTRIBUTE((pure));
+bool use_xterm_titles() PALUDIS_ATTRIBUTE((pure));
template <typename T_>
std::string colour(Colour colour, const T_ & s)
@@ -93,7 +94,7 @@ std::string colour(Colour colour, const T_ & s)
template <typename T_>
std::string xterm_title(const T_ & s)
{
- if (CommandLine::get_instance()->a_no_color.specified() || ! use_colour())
+ if (CommandLine::get_instance()->a_no_color.specified() || ! use_colour() || ! use_xterm_titles())
return "";
else
return "\x1b]2;" + paludis::stringify(s) + "\x07";