display: initialize the colors only when starting to draw the content
This avoids https://savannah.gnu.org/bugs/?49912 while at the same time avoiding to draw the edit window twice in a row -- the first drawing would use a wrong margin, which results in a visible and irritating shift left or right of the content upon the second drawing. This fixes https://savannah.gnu.org/bugs/?50877.master
parent
395c8e9e25
commit
3275c4e514
|
@ -132,6 +132,8 @@ void color_init(void)
|
||||||
fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n", foreground, background);
|
fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n", foreground, background);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
have_palette = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to match the given shibboleth string with one of the regexes in
|
/* Try to match the given shibboleth string with one of the regexes in
|
||||||
|
|
|
@ -589,8 +589,7 @@ void display_buffer(void)
|
||||||
titlebar(NULL);
|
titlebar(NULL);
|
||||||
|
|
||||||
#ifndef DISABLE_COLOR
|
#ifndef DISABLE_COLOR
|
||||||
/* Make sure we're using the buffer's associated colors. */
|
have_palette = FALSE;
|
||||||
color_init();
|
|
||||||
|
|
||||||
/* If there are multiline coloring regexes, and there is no
|
/* If there are multiline coloring regexes, and there is no
|
||||||
* multiline cache data yet, precalculate it now. */
|
* multiline cache data yet, precalculate it now. */
|
||||||
|
@ -599,8 +598,7 @@ void display_buffer(void)
|
||||||
precalc_multicolorinfo();
|
precalc_multicolorinfo();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Update the content of the edit window straightaway. */
|
refresh_needed = TRUE;
|
||||||
edit_refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_MULTIBUFFER
|
#ifndef DISABLE_MULTIBUFFER
|
||||||
|
|
|
@ -52,6 +52,11 @@ int margin = 0;
|
||||||
int editwincols = -1;
|
int editwincols = -1;
|
||||||
/* The number of usable columns in the edit window: COLS - margin. */
|
/* The number of usable columns in the edit window: COLS - margin. */
|
||||||
|
|
||||||
|
#ifndef DISABLE_COLOR
|
||||||
|
bool have_palette = FALSE;
|
||||||
|
/* Whether the colors for the current syntax have been initialized. */
|
||||||
|
#endif
|
||||||
|
|
||||||
message_type lastmessage = HUSH;
|
message_type lastmessage = HUSH;
|
||||||
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
|
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,10 @@ extern bool as_an_at;
|
||||||
extern int margin;
|
extern int margin;
|
||||||
extern int editwincols;
|
extern int editwincols;
|
||||||
|
|
||||||
|
#ifndef DISABLE_COLOR
|
||||||
|
extern bool have_palette;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern message_type lastmessage;
|
extern message_type lastmessage;
|
||||||
|
|
||||||
extern filestruct *pletion_line;
|
extern filestruct *pletion_line;
|
||||||
|
|
|
@ -3054,6 +3054,12 @@ void edit_refresh(void)
|
||||||
filestruct *line;
|
filestruct *line;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
||||||
|
#ifndef DISABLE_COLOR
|
||||||
|
/* When needed, initialize the colors for the current syntax. */
|
||||||
|
if (!have_palette)
|
||||||
|
color_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* If the current line is out of view, get it back on screen. */
|
/* If the current line is out of view, get it back on screen. */
|
||||||
if (current_is_offscreen()) {
|
if (current_is_offscreen()) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
Loading…
Reference in New Issue