1
1

Ticket #2163: rotating dash is not removed when mc finishes reading the directory

...or when other long aperation is finished.

(rotate_dash): add argument to show/hide dash. Move dash to the corner
of the right/top panel from corner of the screen.

Thanks Egmont Koblinger for the original patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
Andrew Borodin 2013-05-25 11:33:26 +04:00
родитель 368a303d93
Коммит aeb8933543
7 изменённых файлов: 34 добавлений и 18 удалений

Просмотреть файл

@ -315,7 +315,7 @@ compare_files (const vfs_path_t * vpath1, const vfs_path_t * vpath2, off_t size)
data2 = mmap (0, size, PROT_READ, MAP_FILE | MAP_PRIVATE, file2, 0);
if (data2 != (char *) -1)
{
rotate_dash ();
rotate_dash (TRUE);
result = memcmp (data1, data2, size);
munmap (data2, size);
}
@ -325,7 +325,7 @@ compare_files (const vfs_path_t * vpath1, const vfs_path_t * vpath2, off_t size)
/* Don't have mmap() :( Even more ugly :) */
char buf1[BUFSIZ], buf2[BUFSIZ];
int n1, n2;
rotate_dash ();
rotate_dash (TRUE);
do
{
while ((n1 = read (file1, buf1, BUFSIZ)) == -1 && errno == EINTR);
@ -338,6 +338,8 @@ compare_files (const vfs_path_t * vpath1, const vfs_path_t * vpath2, off_t size)
}
close (file1);
}
rotate_dash (FALSE);
return result;
}

Просмотреть файл

@ -604,7 +604,7 @@ do_load_dir (const vfs_path_t * vpath, dir_list * list, sortfn * sort, gboolean
next_free++;
if ((next_free & 31) == 0)
rotate_dash ();
rotate_dash (TRUE);
}
if (next_free != 0)
@ -613,6 +613,7 @@ do_load_dir (const vfs_path_t * vpath, dir_list * list, sortfn * sort, gboolean
ret:
mc_closedir (dirp);
tree_store_end_check ();
rotate_dash (FALSE);
return next_free;
}
@ -742,8 +743,8 @@ do_reload_dir (const vfs_path_t * vpath, dir_list * list, sortfn * sort, int cou
list->list[next_free].sort_key = NULL;
list->list[next_free].second_sort_key = NULL;
next_free++;
if (!(next_free % 16))
rotate_dash ();
if ((next_free % 16) == 0)
rotate_dash (TRUE);
}
mc_closedir (dirp);
tree_store_end_check ();
@ -753,6 +754,8 @@ do_reload_dir (const vfs_path_t * vpath, dir_list * list, sortfn * sort, int cou
do_sort (list, sort, next_free - 1, lc_reverse, lc_case_sensitive, exec_ff);
}
clean_dir (&dir_copy, count);
rotate_dash (FALSE);
return next_free;
}

Просмотреть файл

@ -85,6 +85,7 @@
#include "filenot.h"
#include "tree.h"
#include "midnight.h" /* current_panel */
#include "layout.h" /* rotate_dash() */
#include "file.h"
@ -828,7 +829,7 @@ copy_file_file_display_progress (FileOpTotalContext * tctx, FileOpContext * ctx,
long dt;
/* 1. Update rotating dash after some time */
rotate_dash ();
rotate_dash (TRUE);
/* 3. Compute ETA */
dt = (tv_current.tv_sec - tv_transfer_start.tv_sec);
@ -1916,6 +1917,7 @@ copy_file_file (FileOpTotalContext * tctx, FileOpContext * ctx,
dst_status = DEST_FULL; /* copy successful, don't remove target file */
ret:
rotate_dash (FALSE);
while (src_desc != -1 && mc_close (src_desc) < 0 && !ctx->skip_all)
{
temp_status = file_error (_("Cannot close source file \"%s\"\n%s"), src_path);

Просмотреть файл

@ -1766,8 +1766,8 @@ do_find (const char *start_dir, ssize_t start_dir_len, const char *ignore_dirs,
list->list[next_free].second_sort_key = NULL;
next_free++;
g_free (name);
if (!(next_free & 15))
rotate_dash ();
if ((next_free & 15) == 0)
rotate_dash (TRUE);
}
if (next_free)
@ -1793,6 +1793,7 @@ do_find (const char *start_dir, ssize_t start_dir_len, const char *ignore_dirs,
do_search (NULL); /* force do_search to release resources */
g_free (old_dir);
old_dir = NULL;
rotate_dash (FALSE);
return return_value;
}

Просмотреть файл

@ -879,21 +879,27 @@ set_hintbar (const char *str)
/* --------------------------------------------------------------------------------------------- */
void
rotate_dash (void)
rotate_dash (gboolean show)
{
static const char rotating_dash[] = "|/-\\";
static const char rotating_dash[4] = "|/-\\";
static size_t pos = 0;
Widget *w = WIDGET (midnight_dlg);
if (!nice_rotating_dash || (ok_to_refresh <= 0))
return;
if (pos >= sizeof (rotating_dash) - 1)
pos = 0;
tty_gotoyx (0, COLS - 1);
widget_move (w, (menubar_visible != 0) ? 1 : 0, w->cols - 1);
tty_setcolor (NORMAL_COLOR);
tty_print_char (rotating_dash[pos]);
if (!show)
tty_print_alt_char (ACS_URCORNER, FALSE);
else
{
tty_print_char (rotating_dash[pos]);
pos = (pos + 1) % sizeof (rotating_dash);
}
mc_refresh ();
pos++;
}
/* --------------------------------------------------------------------------------------------- */

Просмотреть файл

@ -79,7 +79,7 @@ void set_hintbar (const char *str);
/* Rotating dash routines */
void use_dash (gboolean flag); /* Disable/Enable rotate_dash routines */
void rotate_dash (void);
void rotate_dash (gboolean show);
#ifdef ENABLE_SUBSHELL
gboolean do_load_prompt (void);

Просмотреть файл

@ -52,6 +52,7 @@
#include "dir.h"
#include "midnight.h" /* current_panel */
#include "layout.h" /* rotate_dash() */
#include "panel.h" /* WPanel */
#include "panelize.h"
@ -366,8 +367,8 @@ do_external_panelize (char *command)
list->list[next_free].sort_key = NULL;
list->list[next_free].second_sort_key = NULL;
next_free++;
if (!(next_free & 32))
rotate_dash ();
if ((next_free & 32) == 0)
rotate_dash (TRUE);
}
current_panel->is_panelized = TRUE;
@ -395,6 +396,7 @@ do_external_panelize (char *command)
close_error_pipe (D_NORMAL, NULL);
try_to_select (current_panel, NULL);
panel_re_sort (current_panel);
rotate_dash (FALSE);
}
/* --------------------------------------------------------------------------------------------- */