mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
redraw_leds: Redraw the LED panel for each terminal, not each session
Since there is only one LED panel per terminal, redrawing for each session is wasteful. Furthermore, since one terminal can have many sessions (i.e. tabs), and since the last session in the list might not be the current session, the wrong LEDs might be drawn. An easy way to demonstrate the bug is to enable ui.clock.enable, so that the panel is redrawn every 100ms, and then to select a text field and enter insert mode. Unless the current tab is the last tab, the insert-mode LED will only briefly show that insert mode is enabled.
This commit is contained in:
parent
12dce0d1c0
commit
0d001a88b7
@ -23,6 +23,7 @@
|
||||
#include "main/timer.h"
|
||||
#include "session/session.h"
|
||||
#include "terminal/draw.h"
|
||||
#include "terminal/tab.h"
|
||||
#include "terminal/terminal.h"
|
||||
#include "terminal/window.h"
|
||||
#include "util/color.h"
|
||||
@ -300,7 +301,7 @@ update_download_led(struct session *ses)
|
||||
static void
|
||||
redraw_leds(void *xxx)
|
||||
{
|
||||
struct session *ses;
|
||||
struct terminal *term;
|
||||
|
||||
if (!get_leds_panel_enable()
|
||||
&& get_opt_int("ui.timer.enable", NULL) != 2) {
|
||||
@ -314,11 +315,20 @@ redraw_leds(void *xxx)
|
||||
if (drawing) return;
|
||||
drawing = 1;
|
||||
|
||||
foreach (ses, sessions) {
|
||||
foreach (term, terminals) {
|
||||
struct session *ses;
|
||||
struct window *win;
|
||||
|
||||
if (list_empty(term->windows)) continue;
|
||||
|
||||
win = get_current_tab(term);
|
||||
assert(win);
|
||||
ses = win->data;
|
||||
|
||||
update_download_led(ses);
|
||||
if (!sync_leds(ses))
|
||||
continue;
|
||||
redraw_terminal(ses->tab->term);
|
||||
redraw_terminal(term);
|
||||
draw_leds(ses);
|
||||
}
|
||||
drawing = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user