Avoid height and width underflow in adjustSize
This commit is contained in:
parent
b21fe6a405
commit
e35340114b
|
@ -1,5 +1,7 @@
|
|||
2016-01-17 Markus Gans <guru.mail@muenster.de>
|
||||
* Moving events into the class fc
|
||||
* Avoid height and width underflow in adjustSize()
|
||||
* Fix default color handling on Cygwin and Linux terminals
|
||||
|
||||
2016-01-10 Markus Gans <guru.mail@muenster.de>
|
||||
* Better default color handling in FOptiAttr
|
||||
|
|
|
@ -214,7 +214,12 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next)
|
|||
}
|
||||
else if ( bg == Default && term->bg_color != Default )
|
||||
{
|
||||
char* sgr_49 = const_cast<char*>("\033[49m");
|
||||
char* sgr_49;
|
||||
char* op = F_orig_pair.cap;
|
||||
if ( op && strncmp (op, "\033[39;49;25m", 11) == 0 )
|
||||
sgr_49 = const_cast<char*>("\033[49;25m");
|
||||
else
|
||||
sgr_49 = const_cast<char*>("\033[49m");
|
||||
append_sequence (sgr_49);
|
||||
term->bg_color = Default;
|
||||
}
|
||||
|
@ -231,7 +236,11 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next)
|
|||
return;
|
||||
|
||||
if ( fake_reverse )
|
||||
{
|
||||
std::swap (fg, bg);
|
||||
if ( fg == Default || bg == Default )
|
||||
setTermDefaultColor(term);
|
||||
}
|
||||
|
||||
if ( AF && AB )
|
||||
{
|
||||
|
@ -240,18 +249,24 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next)
|
|||
|
||||
if ( cygwin_terminal )
|
||||
{
|
||||
// reset blink and bold mode from colors > 7
|
||||
char* rst = const_cast<char*>("\033[m");
|
||||
append_sequence (rst);
|
||||
reset(term);
|
||||
|
||||
if ( ansi_fg != Default )
|
||||
{
|
||||
color_str = tparm(AF, ansi_fg);
|
||||
if ( color_str )
|
||||
append_sequence (color_str);
|
||||
|
||||
}
|
||||
if ( ansi_bg != Default )
|
||||
{
|
||||
color_str = tparm(AB, ansi_bg);
|
||||
if ( color_str )
|
||||
append_sequence (color_str);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( term->fg_color != fg && (color_str = tparm(AF, ansi_fg)) )
|
||||
|
@ -1336,7 +1351,18 @@ char* FOptiAttr::change_attribute (char_data*& term, char_data*& next)
|
|||
setTermPCcharset(term);
|
||||
|
||||
if ( colorChange(term, next) )
|
||||
{
|
||||
change_color (term, next);
|
||||
if ( cygwin_terminal )
|
||||
{
|
||||
if ( next->bold )
|
||||
setTermBold(term);
|
||||
if ( next->reverse )
|
||||
setTermReverse(term);
|
||||
if ( next->standout )
|
||||
setTermStandout(term);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1148,6 +1148,8 @@ void FTerm::init_termcaps()
|
|||
const_cast<char*>("\033[3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;21%;m");
|
||||
tcap[t_set_a_background].string = \
|
||||
const_cast<char*>("\033[4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m");
|
||||
tcap[t_orig_pair].string = \
|
||||
const_cast<char*>("\033[39;49;25m");
|
||||
}
|
||||
else if ( rxvt_terminal && ! urxvt_terminal )
|
||||
{
|
||||
|
|
|
@ -445,6 +445,11 @@ void FWidget::adjustSize()
|
|||
width--;
|
||||
while ( ymin+height-1 > ymax )
|
||||
height--;
|
||||
|
||||
if ( width < 1 )
|
||||
width = 1;
|
||||
if ( height < 1 )
|
||||
height = 1;
|
||||
}
|
||||
|
||||
adjustWidgetSize.setRect(xpos, ypos, width, height);
|
||||
|
|
Loading…
Reference in New Issue