mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
*** empty log message ***
This commit is contained in:
parent
bca3821dac
commit
445046de11
@ -1,3 +1,12 @@
|
||||
Sat Sep 12 02:59:43 1998 Timur Bakeyev <mc@bat.ru>
|
||||
|
||||
* screen.c: Xtry_to_select() Remove extfs hack to the main.c. Change
|
||||
for() cycle to the x_basename() call (Thanks to Pavel Roskin).
|
||||
Add (key_callback) do_enter() to prevent warnings.
|
||||
|
||||
* main.c: Rename cd_try_to_select() to the get_parent_dir_name(). Now
|
||||
it process VFS postfixes too. Reduced number of loops against prev hack.
|
||||
|
||||
Fri Sep 11 15:27:59 1998 Pavel Machek <pavel@ucw.cz>
|
||||
|
||||
* screen.c: make cd .. from extfs file highlight it
|
||||
|
50
src/main.c
50
src/main.c
@ -370,26 +370,6 @@ try_to_select (WPanel *panel, char *name)
|
||||
display_mini_info (panel);
|
||||
}
|
||||
|
||||
/*
|
||||
* cd_try_to_select:
|
||||
*
|
||||
* If we moved to the parent directory move the selection pointer to
|
||||
* the old directory name
|
||||
*/
|
||||
void
|
||||
cd_try_to_select (WPanel *panel)
|
||||
{
|
||||
char *p, *q;
|
||||
int i, j = 4;
|
||||
|
||||
if (strlen (panel->lwd) > strlen (panel->cwd)
|
||||
&& strncmp (panel->cwd, panel->lwd, strlen (panel->cwd)) == 0
|
||||
&& strchr (panel->lwd + strlen (panel->cwd) + 1, PATH_SEP) == 0)
|
||||
try_to_select (panel, panel->lwd);
|
||||
else
|
||||
try_to_select (panel, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
reload_panelized (WPanel *panel)
|
||||
{
|
||||
@ -938,6 +918,30 @@ translate_url_to_new_syntax (const char *p)
|
||||
return strdup (p);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we moved to the parent directory move the selection pointer to
|
||||
* the old directory name; If we leave VFS dir, remove FS specificator.
|
||||
* Warn: This code spoils lwd string.
|
||||
*/
|
||||
char*
|
||||
get_parent_dir_name (char *cwd, char *lwd)
|
||||
{
|
||||
char *p, *q;
|
||||
|
||||
if (strlen (lwd) > strlen (cwd))
|
||||
if((p=strrchr(lwd, PATH_SEP)) && !strncmp(cwd, lwd, p-lwd)){
|
||||
#ifdef USE_VFS
|
||||
if((q=strrchr(p, '#')) != 0){
|
||||
/* Here we need proper VFS function */
|
||||
if(!strcmp(q+1, "utar") || extfs_which(q+1) >= 0 || sfs_which(q+1) >= 0)
|
||||
*q = '\0';
|
||||
}
|
||||
#endif /* USE_VFS */
|
||||
return p;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Changes the current panel directory */
|
||||
int
|
||||
_do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type)
|
||||
@ -986,7 +990,6 @@ _do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type)
|
||||
vfs_add_noncurrent_stamps (oldvfs, oldvfsid, parent);
|
||||
vfs_rm_parents (parent);
|
||||
#endif
|
||||
free (olddir);
|
||||
|
||||
subshell_chdir (panel->cwd);
|
||||
|
||||
@ -1000,9 +1003,12 @@ _do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type)
|
||||
panel->dirs_marked = 0;
|
||||
panel->total = 0;
|
||||
panel->searching = 0;
|
||||
cd_try_to_select (panel);
|
||||
try_to_select (panel, get_parent_dir_name(panel->cwd, olddir));
|
||||
load_hint ();
|
||||
panel_update_contents (panel);
|
||||
|
||||
free (olddir);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
26
src/screen.c
26
src/screen.c
@ -814,9 +814,6 @@ paint_panel (WPanel *panel)
|
||||
mini_info_separator (panel);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is used to select xyzzy after you asked for cd .. in xyzzy/ subdir.
|
||||
*/
|
||||
void
|
||||
Xtry_to_select (WPanel *panel, char *name)
|
||||
{
|
||||
@ -831,25 +828,14 @@ Xtry_to_select (WPanel *panel, char *name)
|
||||
}
|
||||
|
||||
/* We only want the last component of the directory */
|
||||
for (subdir = name + strlen (name) - 1; subdir >= name; subdir--){
|
||||
if (*subdir == PATH_SEP){
|
||||
subdir++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
subdir = x_basename(name);
|
||||
|
||||
if (subdir < name)
|
||||
subdir = name;
|
||||
|
||||
|
||||
/* Search that subdirectory, if found select it */
|
||||
for (i = 0; i < panel->count; i++){
|
||||
char c, *s = panel->dir.list [i].fname;
|
||||
if (strncmp (subdir, s, strlen(s)))
|
||||
continue;
|
||||
|
||||
c = subdir[ strlen(s) ];
|
||||
/* This ugly hack is for returning from extfs archive: now
|
||||
that archive will be highlighted when you cd .. from it. */
|
||||
if ((c!=0) && (c!='#'))
|
||||
if (strcmp (subdir, panel->dir.list [i].fname))
|
||||
continue;
|
||||
|
||||
if (i != panel->selected){
|
||||
@ -2146,8 +2132,8 @@ static key_map panel_keymap [] = {
|
||||
{ KEY_UP, move_up },
|
||||
|
||||
/* The action button :-) */
|
||||
{ '\n', do_enter },
|
||||
{ KEY_ENTER, do_enter },
|
||||
{ '\n', (key_callback) do_enter },
|
||||
{ KEY_ENTER, (key_callback) do_enter },
|
||||
|
||||
{ KEY_IC, mark_file },
|
||||
{ KEY_HOME, move_home },
|
||||
|
Loading…
Reference in New Issue
Block a user