mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
/SET force_colors -> /SET term_force_colors. Added /SET term_scroll_fast
option to specify if we want to scroll with fastest method, or the cleanest method. The default is cleanest and it looks best with xterm, with some other terminals where line-by-line scroll is slow, you might want to use the fast scrolling. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2015 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
0dafb7349a
commit
4d771c54d9
@ -193,6 +193,13 @@ void term_force_colors(int set)
|
|||||||
/* don't do anything with curses */
|
/* don't do anything with curses */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Setup scrolling - if fast is TRUE, we'll use the fastest method to
|
||||||
|
scroll, if it's FALSE, we'll use the one that looks cleanest. */
|
||||||
|
void term_setup_scroll(int fast)
|
||||||
|
{
|
||||||
|
/* don't do anything with curses */
|
||||||
|
}
|
||||||
|
|
||||||
/* Clear screen */
|
/* Clear screen */
|
||||||
void term_clear(void)
|
void term_clear(void)
|
||||||
{
|
{
|
||||||
|
@ -170,6 +170,13 @@ void term_force_colors(int set)
|
|||||||
terminfo_setup_colors(current_term, set);
|
terminfo_setup_colors(current_term, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Setup scrolling - if fast is TRUE, we'll use the fastest method to
|
||||||
|
scroll, if it's FALSE, we'll use the one that looks cleanest. */
|
||||||
|
void term_setup_scroll(int fast)
|
||||||
|
{
|
||||||
|
terminfo_setup_scroll(current_term, fast);
|
||||||
|
}
|
||||||
|
|
||||||
/* Clear screen */
|
/* Clear screen */
|
||||||
void term_clear(void)
|
void term_clear(void)
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,8 @@ static void read_settings(void)
|
|||||||
{
|
{
|
||||||
int old_colors = term_use_colors;
|
int old_colors = term_use_colors;
|
||||||
|
|
||||||
if (settings_get_bool("force_colors")) {
|
term_setup_scroll(settings_get_bool("term_scroll_fast"));
|
||||||
|
if (settings_get_bool("term_force_colors")) {
|
||||||
if (!term_use_colors) {
|
if (!term_use_colors) {
|
||||||
term_force_colors(TRUE);
|
term_force_colors(TRUE);
|
||||||
term_use_colors = TRUE;
|
term_use_colors = TRUE;
|
||||||
@ -115,7 +116,8 @@ void term_common_init(void)
|
|||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
#endif
|
#endif
|
||||||
settings_add_bool("lookandfeel", "colors", TRUE);
|
settings_add_bool("lookandfeel", "colors", TRUE);
|
||||||
settings_add_bool("lookandfeel", "force_colors", FALSE);
|
settings_add_bool("lookandfeel", "term_force_colors", FALSE);
|
||||||
|
settings_add_bool("lookandfeel", "term_scroll_fast", FALSE);
|
||||||
|
|
||||||
term_use_colors = term_has_colors() && settings_get_bool("colors");
|
term_use_colors = term_has_colors() && settings_get_bool("colors");
|
||||||
read_settings();
|
read_settings();
|
||||||
|
@ -40,6 +40,9 @@ void term_resize_dirty(void);
|
|||||||
int term_has_colors(void);
|
int term_has_colors(void);
|
||||||
/* Force the colors on any way you can */
|
/* Force the colors on any way you can */
|
||||||
void term_force_colors(int set);
|
void term_force_colors(int set);
|
||||||
|
/* Setup scrolling - if fast is TRUE, we'll use the fastest method to
|
||||||
|
scroll, if it's FALSE, we'll use the one that looks cleanest. */
|
||||||
|
void term_setup_scroll(int fast);
|
||||||
|
|
||||||
/* Clear screen */
|
/* Clear screen */
|
||||||
void term_clear(void);
|
void term_clear(void);
|
||||||
|
@ -484,6 +484,36 @@ void terminfo_cont(TERM_REC *term)
|
|||||||
terminfo_input_init(term);
|
terminfo_input_init(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Setup scrolling - if fast is TRUE, we'll use the fastest method to
|
||||||
|
scroll, if it's FALSE, we'll use the one that looks cleanest. */
|
||||||
|
void terminfo_setup_scroll(TERM_REC *term, int fast)
|
||||||
|
{
|
||||||
|
int region_1;
|
||||||
|
|
||||||
|
if ((term->TI_csr || term->TI_wind) && term->TI_rin && term->TI_indn) {
|
||||||
|
/* this is excellent - if only terminals supported it.. */
|
||||||
|
term->scroll = _scroll_region;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
region_1 = (term->TI_csr || term->TI_wind) && term->TI_ri && term->TI_ind;
|
||||||
|
if (!fast && region_1) {
|
||||||
|
/* we prefer pretty */
|
||||||
|
term->scroll = _scroll_region_1;
|
||||||
|
} else if (term->TI_il && term->TI_dl) {
|
||||||
|
/* either we prefer fast, or can't do pretty */
|
||||||
|
term->scroll = _scroll_line;
|
||||||
|
} else if (region_1) {
|
||||||
|
/* we prefer fast, but can't do it */
|
||||||
|
term->scroll = _scroll_region_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (term->scroll == NULL && (term->TI_il1 && term->TI_dl1)) {
|
||||||
|
/* the final slowest and ugliest method we can use */
|
||||||
|
term->scroll = _scroll_line_1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void terminfo_stop(TERM_REC *term)
|
void terminfo_stop(TERM_REC *term)
|
||||||
{
|
{
|
||||||
/* reset colors */
|
/* reset colors */
|
||||||
@ -543,15 +573,8 @@ static int term_setup(TERM_REC *term)
|
|||||||
_set_cursor_visible : _ignore_parm;
|
_set_cursor_visible : _ignore_parm;
|
||||||
|
|
||||||
/* Scrolling */
|
/* Scrolling */
|
||||||
if ((term->TI_csr || term->TI_wind) && term->TI_rin && term->TI_indn)
|
terminfo_setup_scroll(term, FALSE);
|
||||||
term->scroll = _scroll_region;
|
if (term->scroll == NULL) {
|
||||||
else if (term->TI_il && term->TI_dl)
|
|
||||||
term->scroll = _scroll_line;
|
|
||||||
else if ((term->TI_csr || term->TI_wind) && term->TI_ri && term->TI_ind)
|
|
||||||
term->scroll = _scroll_region_1;
|
|
||||||
else if (term->TI_il1 && term->TI_dl1)
|
|
||||||
term->scroll = _scroll_line_1;
|
|
||||||
else {
|
|
||||||
fprintf(term->out, "Terminal doesn't support scrolling\n");
|
fprintf(term->out, "Terminal doesn't support scrolling\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,10 @@ void terminfo_core_deinit(TERM_REC *term);
|
|||||||
terminal capabilities don't contain color codes */
|
terminal capabilities don't contain color codes */
|
||||||
void terminfo_setup_colors(TERM_REC *term, int force);
|
void terminfo_setup_colors(TERM_REC *term, int force);
|
||||||
|
|
||||||
|
/* Setup scrolling - if fast is TRUE, we'll use the fastest method to
|
||||||
|
scroll, if it's FALSE, we'll use the one that looks cleanest. */
|
||||||
|
void terminfo_setup_scroll(TERM_REC *term, int fast);
|
||||||
|
|
||||||
/* Terminal was resized - ask the width/height from terminfo again */
|
/* Terminal was resized - ask the width/height from terminfo again */
|
||||||
void terminfo_resize(TERM_REC *term);
|
void terminfo_resize(TERM_REC *term);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user