Mercurial > vim
comparison src/term.c @ 28505:8751e815864e v8.2.4777
patch 8.2.4777: screendump tests fail because of a redraw
Commit: https://github.com/vim/vim/commit/366f0bdd08ae8f4aec38bca6b02ba41adae6ffce
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 17 19:20:33 2022 +0100
patch 8.2.4777: screendump tests fail because of a redraw
Problem: Screendump tests fail because of a redraw.
Solution: Do not output t_8u before receiving termresponse. Redraw only
when t_8u is not reset and termresponse is received.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 17 Apr 2022 20:30:02 +0200 |
parents | e1c6e1f3c1bb |
children | a54564337e89 |
comparison
equal
deleted
inserted
replaced
28504:7939138bfab8 | 28505:8751e815864e |
---|---|
163 &rbm_status, | 163 &rbm_status, |
164 &rcs_status, | 164 &rcs_status, |
165 &winpos_status, | 165 &winpos_status, |
166 NULL | 166 NULL |
167 }; | 167 }; |
168 | |
169 // The t_8u code may default to a value but get reset when the term response is | |
170 // received. To avoid redrawing too often, only redraw when t_8u is not reset | |
171 // and it was supposed to be written. | |
172 // FALSE -> don't output t_8u yet | |
173 // MAYBE -> tried outputing t_8u while FALSE | |
174 // OK -> can write t_8u | |
175 int write_t_8u_state = FALSE; | |
168 # endif | 176 # endif |
169 | 177 |
170 /* | 178 /* |
171 * Don't declare these variables if termcap.h contains them. | 179 * Don't declare these variables if termcap.h contains them. |
172 * Autoconf checks if these variables should be declared extern (not all | 180 * Autoconf checks if these variables should be declared extern (not all |
2102 full_screen = TRUE; // we can use termcap codes from now on | 2110 full_screen = TRUE; // we can use termcap codes from now on |
2103 set_term_defaults(); // use current values as defaults | 2111 set_term_defaults(); // use current values as defaults |
2104 #ifdef FEAT_TERMRESPONSE | 2112 #ifdef FEAT_TERMRESPONSE |
2105 LOG_TR(("setting crv_status to STATUS_GET")); | 2113 LOG_TR(("setting crv_status to STATUS_GET")); |
2106 crv_status.tr_progress = STATUS_GET; // Get terminal version later | 2114 crv_status.tr_progress = STATUS_GET; // Get terminal version later |
2115 write_t_8u_state = FALSE; | |
2107 #endif | 2116 #endif |
2108 | 2117 |
2109 /* | 2118 /* |
2110 * Initialize the terminal with the appropriate termcap codes. | 2119 * Initialize the terminal with the appropriate termcap codes. |
2111 * Set the mouse and window title if possible. | 2120 * Set the mouse and window title if possible. |
3047 term_rgb_color(char_u *s, guicolor_T rgb) | 3056 term_rgb_color(char_u *s, guicolor_T rgb) |
3048 { | 3057 { |
3049 #define MAX_COLOR_STR_LEN 100 | 3058 #define MAX_COLOR_STR_LEN 100 |
3050 char buf[MAX_COLOR_STR_LEN]; | 3059 char buf[MAX_COLOR_STR_LEN]; |
3051 | 3060 |
3061 if (*s == NUL) | |
3062 return; | |
3052 vim_snprintf(buf, MAX_COLOR_STR_LEN, | 3063 vim_snprintf(buf, MAX_COLOR_STR_LEN, |
3053 (char *)s, RED(rgb), GREEN(rgb), BLUE(rgb)); | 3064 (char *)s, RED(rgb), GREEN(rgb), BLUE(rgb)); |
3054 #ifdef FEAT_VTP | 3065 #ifdef FEAT_VTP |
3055 if (use_wt()) | 3066 if (use_wt()) |
3056 { | 3067 { |
3076 } | 3087 } |
3077 | 3088 |
3078 void | 3089 void |
3079 term_ul_rgb_color(guicolor_T rgb) | 3090 term_ul_rgb_color(guicolor_T rgb) |
3080 { | 3091 { |
3081 term_rgb_color(T_8U, rgb); | 3092 # ifdef FEAT_TERMRESPONSE |
3093 if (write_t_8u_state != OK) | |
3094 write_t_8u_state = MAYBE; | |
3095 else | |
3096 # endif | |
3097 term_rgb_color(T_8U, rgb); | |
3082 } | 3098 } |
3083 #endif | 3099 #endif |
3084 | 3100 |
3085 #if (defined(UNIX) || defined(VMS) || defined(MACOS_X)) || defined(PROTO) | 3101 #if (defined(UNIX) || defined(VMS) || defined(MACOS_X)) || defined(PROTO) |
3086 /* | 3102 /* |
4812 // conflict with what was set in the .vimrc. | 4828 // conflict with what was set in the .vimrc. |
4813 if (term_props[TPR_UNDERLINE_RGB].tpr_status != TPR_YES && *T_8U != NUL) | 4829 if (term_props[TPR_UNDERLINE_RGB].tpr_status != TPR_YES && *T_8U != NUL) |
4814 { | 4830 { |
4815 set_string_option_direct((char_u *)"t_8u", -1, (char_u *)"", | 4831 set_string_option_direct((char_u *)"t_8u", -1, (char_u *)"", |
4816 OPT_FREE, 0); | 4832 OPT_FREE, 0); |
4817 redraw_later(CLEAR); | 4833 } |
4818 } | 4834 if (*T_8U != NUL && write_t_8u_state == MAYBE) |
4835 // Did skip writing t_8u, a complete redraw is needed. | |
4836 redraw_later_clear(); | |
4837 write_t_8u_state = OK; // can otuput t_8u now | |
4819 | 4838 |
4820 // Only set 'ttymouse' automatically if it was not set | 4839 // Only set 'ttymouse' automatically if it was not set |
4821 // by the user already. | 4840 // by the user already. |
4822 if (!option_was_set((char_u *)"ttym") | 4841 if (!option_was_set((char_u *)"ttym") |
4823 && (term_props[TPR_MOUSE].tpr_status == TPR_MOUSE_XTERM2 | 4842 && (term_props[TPR_MOUSE].tpr_status == TPR_MOUSE_XTERM2 |