Add the possibility to switch off the cursor optimization

This commit is contained in:
Markus Gans 2015-12-21 18:37:20 +01:00
parent a1b7e34d7d
commit 7590d2101d
4 changed files with 57 additions and 31 deletions

View File

@ -114,6 +114,7 @@ void FApplication::cmd_options ()
static struct option long_options[] = static struct option long_options[] =
{ {
{"encoding", required_argument, 0, 0 }, {"encoding", required_argument, 0, 0 },
{"no-optimized-cursor", no_argument, 0, 0 },
{"vgafont", no_argument, 0, 0 }, {"vgafont", no_argument, 0, 0 },
{"newfont", no_argument, 0, 0 }, {"newfont", no_argument, 0, 0 },
{0, 0, 0, 0 } {0, 0, 0, 0 }
@ -141,8 +142,13 @@ void FApplication::cmd_options ()
setEncoding(encoding.c_str()); setEncoding(encoding.c_str());
} }
} }
if ( strcmp(long_options[idx].name, "no-optimize-cursor") == 0 )
setCursorOptimisation (false);
if ( strcmp(long_options[idx].name, "vgafont") == 0 ) if ( strcmp(long_options[idx].name, "vgafont") == 0 )
setVGAFont(); setVGAFont();
if ( strcmp(long_options[idx].name, "newfont") == 0 ) if ( strcmp(long_options[idx].name, "newfont") == 0 )
setNewFont(); setNewFont();
} }
@ -1264,6 +1270,7 @@ void FApplication::print_cmd_Options ()
::printf("\nFinalCut Options:\n" ::printf("\nFinalCut Options:\n"
" --encoding <name> Sets the character encoding mode\n" " --encoding <name> Sets the character encoding mode\n"
" {UTF8, VT100, PC, ASCII}\n" " {UTF8, VT100, PC, ASCII}\n"
" --no-optimized-cursor No cursor optimisation\n"
" --vgafont Set the standard vga 8x16 font\n" " --vgafont Set the standard vga 8x16 font\n"
" --newfont Enables the graphical font\n"); " --newfont Enables the graphical font\n");
} }

View File

@ -8,7 +8,7 @@
// ▕ FOptiMove ▏ // ▕ FOptiMove ▏
// ▕▁▁▁▁▁▁▁▁▁▁▁▏ // ▕▁▁▁▁▁▁▁▁▁▁▁▏
// The cursor optimisation based on ncurses lib_mvcur.c // The cursor optimization based on ncurses lib_mvcur.c
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ifndef _FOPTIMOVE_H #ifndef _FOPTIMOVE_H

View File

@ -87,6 +87,7 @@ bool FTerm::vt100_console;
bool FTerm::ascii_console; bool FTerm::ascii_console;
bool FTerm::NewFont; bool FTerm::NewFont;
bool FTerm::VGAFont; bool FTerm::VGAFont;
bool FTerm::cursor_optimisation;
uChar FTerm::x11_button_state; uChar FTerm::x11_button_state;
termios FTerm::term_init; termios FTerm::term_init;
char FTerm::termtype[30] = ""; char FTerm::termtype[30] = "";
@ -591,6 +592,9 @@ int FTerm::parseKeyString ( char* buffer
buffer[n] = '\0'; buffer[n] = '\0';
input_data_pending = bool(buffer[0] != '\0'); input_data_pending = bool(buffer[0] != '\0');
if ( key == 0 ) // Ctrl+Space or Ctrl+@
key = fc::Fckey_space;
return int(key == 127 ? fc::Fkey_backspace : key); return int(key == 127 ? fc::Fkey_backspace : key);
} }
@ -1328,6 +1332,9 @@ void FTerm::init()
tmux_terminal = \ tmux_terminal = \
background_color_erase = false; background_color_erase = false;
// Preset to true
cursor_optimisation = true;
// assertion: programm start in cooked mode // assertion: programm start in cooked mode
raw_mode = \ raw_mode = \
input_data_pending = \ input_data_pending = \
@ -3186,7 +3193,10 @@ void FTerm::setTermXY (register int x, register int y)
if ( y >= term_height ) if ( y >= term_height )
y = term_height - 1; y = term_height - 1;
if ( cursor_optimisation )
move_str = opti->cursor_move (x_term_pos, y_term_pos, x, y); move_str = opti->cursor_move (x_term_pos, y_term_pos, x, y);
else
move_str = tgoto(tcap[t_cursor_address].string, x, y);
if ( move_str ) if ( move_str )
appendOutputBuffer(move_str); appendOutputBuffer(move_str);
flush_out(); flush_out();

View File

@ -186,6 +186,7 @@ class FTerm
static bool underline; static bool underline;
static bool NewFont; static bool NewFont;
static bool VGAFont; static bool VGAFont;
static bool cursor_optimisation;
static uInt tabstop; static uInt tabstop;
static fc::encoding Encoding; static fc::encoding Encoding;
@ -301,6 +302,7 @@ class FTerm
static bool setNewFont(); static bool setNewFont();
static bool isNewFont(); static bool isNewFont();
static bool setOldFont(); static bool setOldFont();
static bool setCursorOptimisation (bool);
static void setConsoleCursor (fc::console_cursor_style); static void setConsoleCursor (fc::console_cursor_style);
static void getTermSize(); static void getTermSize();
static void setTermSize (int, int); static void setTermSize (int, int);
@ -529,6 +531,13 @@ inline bool FTerm::isTeraTerm()
inline bool FTerm::isUrxvtTerminal() inline bool FTerm::isUrxvtTerminal()
{ return urxvt_terminal; } { return urxvt_terminal; }
//----------------------------------------------------------------------
inline bool FTerm::setCursorOptimisation (bool on)
{
cursor_optimisation = on;
return cursor_optimisation;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FTerm::isRaw() inline bool FTerm::isRaw()
{ return raw_mode; } { return raw_mode; }