aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/terminal/terminaldisplayinit.cc
diff options
context:
space:
mode:
authorGravatar Keith Winstein <keithw@mit.edu>2012-03-16 13:17:28 -0400
committerGravatar Keith Winstein <keithw@mit.edu>2012-03-16 13:46:55 -0400
commitc896055d15b029aa15a1b03fbea7fce3592c95e4 (patch)
treeb890026c2b2dbb5333043aa2a3b34c81d50a8859 /src/terminal/terminaldisplayinit.cc
parent57d97209c02f08bb2f58510a058e4556c449db18 (diff)
Correctly render on terminals without BCE (fixes #56 github issue)
Diffstat (limited to 'src/terminal/terminaldisplayinit.cc')
-rw-r--r--src/terminal/terminaldisplayinit.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/terminal/terminaldisplayinit.cc b/src/terminal/terminaldisplayinit.cc
index 22a2cd5..3b8f972 100644
--- a/src/terminal/terminaldisplayinit.cc
+++ b/src/terminal/terminaldisplayinit.cc
@@ -29,7 +29,7 @@
using namespace Terminal;
Display::Display( bool use_environment )
- : has_ech( true )
+ : has_ech( true ), has_bce( true )
{
if ( use_environment ) {
int errret = -2;
@@ -52,12 +52,24 @@ Display::Display( bool use_environment )
}
}
+ /* check for ECH */
char ech_name[] = "ech";
char *val = tigetstr( ech_name );
- if ( val == (char *)-1 )
+ if ( val == (char *)-1 ) {
throw std::string( "Invalid terminfo string capability " ) + ech_name;
+ }
if ( val == 0 ) {
has_ech = false;
}
+
+ /* check for BCE */
+ char bce_name[] = "bce";
+ int bce_val = tigetflag( bce_name );
+ if ( bce_val == -1 ) {
+ throw std::string( "Invalid terminfo boolean capability " ) + bce_name;
+ }
+ if ( bce_val == 0 ) {
+ has_bce = false;
+ }
}
}