From 5530c99d22c397e800cb44e5c23bde7c509ff75c Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Sun, 20 Nov 2016 21:15:43 +0100 Subject: [PATCH] Increase speed on cygwin terminals --- ChangeLog | 1 + src/fbutton.cpp | 2 +- src/fmenu.cpp | 2 ++ src/foptiattr.cpp | 43 +++++++++++++------------------------------ src/fradiobutton.cpp | 5 ++++- src/fterm.cpp | 7 +++++++ test/windows.cpp | 7 ++++++- 7 files changed, 34 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22dc10a7..d9bd0801 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ 2016-11-20 Markus Gans + * Increase speed on cygwin terminals * Improve tty settings 2016-11-13 Markus Gans diff --git a/src/fbutton.cpp b/src/fbutton.cpp index 96da464e..168fa9b7 100644 --- a/src/fbutton.cpp +++ b/src/fbutton.cpp @@ -647,7 +647,7 @@ void FButton::draw() setColor (button_fg, button_bg); for (x=0; x < i; x++) - print (space); // █ + print (space); // █ if ( hotkeypos == -1 ) setCursorPos (1+margin+i+mono_1st_char, 1+j ); // first character diff --git a/src/fmenu.cpp b/src/fmenu.cpp index d024cd64..2804986f 100644 --- a/src/fmenu.cpp +++ b/src/fmenu.cpp @@ -1310,6 +1310,8 @@ void FMenu::drawItems() { if ( isNewFont() ) print (fc::NF_Bullet); // NF_Bullet ● + else if ( isCygwinTerminal() ) + print (0x04); else print (fc::Bullet); // Bullet ● } diff --git a/src/foptiattr.cpp b/src/foptiattr.cpp index 268f003f..45570b52 100644 --- a/src/foptiattr.cpp +++ b/src/foptiattr.cpp @@ -513,6 +513,14 @@ char* FOptiAttr::changeAttribute (char_data*& term, char_data*& next) if ( ! ( switchOn() || switchOff() || colorChange(term, next) ) ) return 0; + if ( cygwin_terminal && (term->fg_color > 7 || term->bg_color > 7) ) + { + // reset blink and bold mode from colors > 7 + char* rst = const_cast(CSI "m"); + append_sequence (rst); + reset(term); + } + if ( hasNoAttribute(next) ) { if ( off.pc_charset ) @@ -607,7 +615,7 @@ char* FOptiAttr::changeAttribute (char_data*& term, char_data*& next) setTermReverse(term); if ( next->standout ) - setTermStandout(term); + setTermStandout(term); } } } @@ -1346,36 +1354,11 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next) short ansi_fg = vga2ansi(fg); short ansi_bg = vga2ansi(bg); - if ( cygwin_terminal ) - { - // reset blink and bold mode from colors > 7 - char* rst = const_cast(CSI "m"); - append_sequence (rst); - reset(term); + if ( term->fg_color != fg && (color_str = tparm(AF, ansi_fg)) ) + append_sequence (color_str); - 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)) ) - append_sequence (color_str); - - if ( term->bg_color != bg && (color_str = tparm(AB, ansi_bg)) ) - append_sequence (color_str); - } + if ( term->bg_color != bg && (color_str = tparm(AB, ansi_bg)) ) + append_sequence (color_str); } else if ( Sf && Sb ) { diff --git a/src/fradiobutton.cpp b/src/fradiobutton.cpp index b66811a2..6f79494b 100644 --- a/src/fradiobutton.cpp +++ b/src/fradiobutton.cpp @@ -72,7 +72,10 @@ void FRadioButton::drawRadioButton() else { print ('('); - print (fc::Bullet); // Bullet ● + if ( isCygwinTerminal() ) + print (0x04); + else + print (fc::Bullet); // Bullet ● print (')'); } } diff --git a/src/fterm.cpp b/src/fterm.cpp index ebb3a149..cb2c8708 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -2667,6 +2667,13 @@ void FTerm::init_termcaps() tcap[fc::t_orig_pair].string = \ const_cast(CSI "39;49;25m"); + + // avoid dim + underline + tcap[fc::t_enter_dim_mode].string = 0; + tcap[fc::t_exit_dim_mode].string = 0; + tcap[fc::t_enter_underline_mode].string = 0; + tcap[fc::t_exit_underline_mode].string = 0; + FTermcap::attr_without_color = 18; } else if ( rxvt_terminal && ! urxvt_terminal ) { diff --git a/test/windows.cpp b/test/windows.cpp index 7a187ded..8c4f44b2 100644 --- a/test/windows.cpp +++ b/test/windows.cpp @@ -213,6 +213,7 @@ Window::Window (FWidget* parent) : FDialog(parent) , windows() { + FString drop_down_symbol; // menu bar FMenuBar* Menubar = new FMenuBar (this); @@ -221,7 +222,11 @@ Window::Window (FWidget* parent) File->setStatusbarMessage ("File management commands"); // dialog list menu item - FString drop_down_symbol = wchar_t(fc::BlackDownPointingTriangle); + if ( isCygwinTerminal() ) + drop_down_symbol = 'v'; + else + drop_down_symbol = wchar_t(fc::BlackDownPointingTriangle); + FDialogListMenu* DglList = new FDialogListMenu (drop_down_symbol, Menubar); DglList->setStatusbarMessage ("List of all the active dialogs");