From 9f461b6697a8111017b824cbb359f0d3e07af277 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Wed, 10 Sep 2003 05:12:45 +0000 Subject: [PATCH] * screen.c (file_mark): Set dirty flag if the mark changes. * cmd.c: Remove calls to paint_panel() due to file marks. --- src/ChangeLog | 3 +++ src/cmd.c | 5 ---- src/screen.c | 63 +++++++++++++++++++++++++-------------------------- 3 files changed, 34 insertions(+), 37 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5fbf1b109..7f9d99661 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2003-09-10 Pavel Roskin + * screen.c (file_mark): Set dirty flag if the mark changes. + * cmd.c: Remove calls to paint_panel() due to file marks. + * screen.c (update_dirty_panels): New function - update panels with the dirty flag. (panel_update_contents): Make static, don't call directly. diff --git a/src/cmd.c b/src/cmd.c index 033124437..e9e822137 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -474,7 +474,6 @@ void reverse_selection_cmd (void) continue; do_file_mark (cpanel, i, !file->f.marked); } - paint_panel (cpanel); } void select_cmd (void) @@ -520,7 +519,6 @@ void select_cmd (void) do_file_mark (cpanel, i, 1); } } - paint_panel (cpanel); g_free (reg_exp); } @@ -566,7 +564,6 @@ void unselect_cmd (void) do_file_mark (cpanel, i, 0); } } - paint_panel (cpanel); g_free (reg_exp); } @@ -876,8 +873,6 @@ compare_dirs_cmd (void) && get_other_type () == view_listing) { compare_dir (cpanel, opanel, thorough_flag); compare_dir (opanel, cpanel, thorough_flag); - paint_panel (cpanel); - paint_panel (opanel); } else { message (1, MSG_ERROR, _(" Both panels should be in the " diff --git a/src/screen.c b/src/screen.c index 87d502206..7f7947160 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1827,45 +1827,41 @@ recalculate_panel_summary (WPanel *panel) void do_file_mark (WPanel *panel, int idx, int mark) { - if (panel->dir.list [idx].f.marked == mark) - return; - /* - * Only '..' can't be marked, '.' isn't visible. - */ - if (strcmp (panel->dir.list [idx].fname, "..")){ - file_mark (panel, idx, mark); - if (panel->dir.list [idx].f.marked){ - panel->marked++; - if (S_ISDIR (panel->dir.list [idx].st.st_mode)) { - if (panel->dir.list [idx].f.dir_size_computed) - panel->total += panel->dir.list [idx].st.st_size; - panel->dirs_marked++; - } else - panel->total += panel->dir.list [idx].st.st_size; - set_colors (panel); - } else { - if (S_ISDIR(panel->dir.list [idx].st.st_mode)) { - if (panel->dir.list [idx].f.dir_size_computed) - panel->total -= panel->dir.list [idx].st.st_size; - panel->dirs_marked--; - } else - panel->total -= panel->dir.list [idx].st.st_size; - panel->marked--; - } + if (panel->dir.list[idx].f.marked == mark) + return; + + /* Only '..' can't be marked, '.' isn't visible */ + if (!strcmp (panel->dir.list[idx].fname, "..")) + return; + + file_mark (panel, idx, mark); + if (panel->dir.list[idx].f.marked) { + panel->marked++; + if (S_ISDIR (panel->dir.list[idx].st.st_mode)) { + if (panel->dir.list[idx].f.dir_size_computed) + panel->total += panel->dir.list[idx].st.st_size; + panel->dirs_marked++; + } else + panel->total += panel->dir.list[idx].st.st_size; + set_colors (panel); + } else { + if (S_ISDIR (panel->dir.list[idx].st.st_mode)) { + if (panel->dir.list[idx].f.dir_size_computed) + panel->total -= panel->dir.list[idx].st.st_size; + panel->dirs_marked--; + } else + panel->total -= panel->dir.list[idx].st.st_size; + panel->marked--; } } static void do_mark_file (WPanel *panel, int do_move) { - int idx = panel->selected; - - do_file_mark (panel, idx, selection (panel)->f.marked ? 0 : 1); - repaint_file (panel, idx, 1, 2*panel->dir.list [idx].f.marked+1, 0); - + do_file_mark (panel, panel->selected, + selection (panel)->f.marked ? 0 : 1); if (mark_moves_down && do_move) move_down (panel); - display_mini_info (panel); } static void @@ -2240,7 +2236,10 @@ panel_callback (WPanel *panel, int msg, int par) void file_mark (WPanel *panel, int index, int val) { - panel->dir.list [index].f.marked = val; + if (panel->dir.list[index].f.marked != val) { + panel->dir.list[index].f.marked = val; + panel->dirty = 1; + } } /* */