1
1

Merge branch '2375_smart_backspace_in_panels'

* 2375_smart_backspace_in_panels:
  renamed:
  Ticket #2375 (do cd .. if command line is empty)
Этот коммит содержится в:
Ilia Maslakov 2010-12-04 09:35:35 +00:00
родитель 2bff7b9d80 f153e1ad29
Коммит 810a2417a0
6 изменённых файлов: 38 добавлений и 17 удалений

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

@ -399,8 +399,8 @@ static name_keymap_t command_names[] = {
{"PanelSelect", CK_PanelCmdSelect}, {"PanelSelect", CK_PanelCmdSelect},
{"PanelUnselect", CK_PanelCmdUnselect}, {"PanelUnselect", CK_PanelCmdUnselect},
{"PanelViewSimple", CK_PanelCmdViewSimple}, {"PanelViewSimple", CK_PanelCmdViewSimple},
{"PanelCtrlNextPage", CK_PanelCtrlNextPage}, {"PanelGotoParentDir", CK_PanelGotoParentDir},
{"PanelCtrlPrevPage", CK_PanelCtrlPrevPage}, {"PanelGotoChildDir", CK_PanelGotoChildDir},
{"PanelDirectoryHistoryList", CK_PanelDirectoryHistoryList}, {"PanelDirectoryHistoryList", CK_PanelDirectoryHistoryList},
{"PanelDirectoryHistoryNext", CK_PanelDirectoryHistoryNext}, {"PanelDirectoryHistoryNext", CK_PanelDirectoryHistoryNext},
{"PanelDirectoryHistoryPrev", CK_PanelDirectoryHistoryPrev}, {"PanelDirectoryHistoryPrev", CK_PanelDirectoryHistoryPrev},
@ -431,6 +431,7 @@ static name_keymap_t command_names[] = {
{"PanelSortOrderByExt", CK_PanelSortOrderByExt}, {"PanelSortOrderByExt", CK_PanelSortOrderByExt},
{"PanelSortOrderBySize", CK_PanelSortOrderBySize}, {"PanelSortOrderBySize", CK_PanelSortOrderBySize},
{"PanelSortOrderByMTime", CK_PanelSortOrderByMTime}, {"PanelSortOrderByMTime", CK_PanelSortOrderByMTime},
{"PanelSmartGotoParentDir", CK_PanelSmartGotoParentDir},
/* input line */ /* input line */
{"InputBol", CK_InputBol}, {"InputBol", CK_InputBol},

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

@ -423,8 +423,8 @@
#define CK_PanelCmdSelect 8009 #define CK_PanelCmdSelect 8009
#define CK_PanelCmdUnselect 8010 #define CK_PanelCmdUnselect 8010
#define CK_PanelCmdViewSimple 8011 #define CK_PanelCmdViewSimple 8011
#define CK_PanelCtrlNextPage 8012 #define CK_PanelGotoChildDir 8012
#define CK_PanelCtrlPrevPage 8013 #define CK_PanelGotoParentDir 8013
#define CK_PanelDirectoryHistoryList 8014 #define CK_PanelDirectoryHistoryList 8014
#define CK_PanelDirectoryHistoryNext 8015 #define CK_PanelDirectoryHistoryNext 8015
#define CK_PanelDirectoryHistoryPrev 8016 #define CK_PanelDirectoryHistoryPrev 8016
@ -454,6 +454,7 @@
#define CK_PanelSortOrderByExt 8040 #define CK_PanelSortOrderByExt 8040
#define CK_PanelSortOrderBySize 8041 #define CK_PanelSortOrderBySize 8041
#define CK_PanelSortOrderByMTime 8042 #define CK_PanelSortOrderByMTime 8042
#define CK_PanelSmartGotoParentDir 8043
/* diff viewer */ /* diff viewer */
#define CK_DiffDisplaySymbols 9001 #define CK_DiffDisplaySymbols 9001

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

@ -291,8 +291,8 @@ PanelDeleteLocal = F18
PanelReverseSelection = alt-asterisk PanelReverseSelection = alt-asterisk
PanelSelect = alt-plus PanelSelect = alt-plus
PanelUnselect = alt-minus PanelUnselect = alt-minus
PanelCtrlNextPage = ctrl-pgdn PanelGotoChildDir = ctrl-pgdn
PanelCtrlPrevPage = ctrl-pgup PanelGotoParentDir = ctrl-pgup
PanelDirectoryHistoryList = alt-shift-h PanelDirectoryHistoryList = alt-shift-h
PanelDirectoryHistoryNext = alt-u PanelDirectoryHistoryNext = alt-u
PanelDirectoryHistoryPrev = alt-y PanelDirectoryHistoryPrev = alt-y
@ -311,6 +311,7 @@ PanelSortOrderByName=
PanelSortOrderByExt= PanelSortOrderByExt=
PanelSortOrderBySize= PanelSortOrderBySize=
PanelSortOrderByMTime= PanelSortOrderByMTime=
PanelSmartGotoParentDir=
[input] [input]
InputBol = ctrl-a; alt-lt; home; a1 InputBol = ctrl-a; alt-lt; home; a1

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

@ -295,8 +295,8 @@ PanelDeleteLocal = F18
PanelReverseSelection = alt-asterisk PanelReverseSelection = alt-asterisk
PanelSelect = alt-plus PanelSelect = alt-plus
PanelUnselect = alt-minus PanelUnselect = alt-minus
PanelCtrlNextPage = ctrl-pgdn PanelGotoChildDir = ctrl-pgdn
PanelCtrlPrevPage = ctrl-pgup PanelGotoParentDir = ctrl-pgup
PanelDirectoryHistoryList = alt-shift-h PanelDirectoryHistoryList = alt-shift-h
PanelDirectoryHistoryNext = alt-u PanelDirectoryHistoryNext = alt-u
PanelDirectoryHistoryPrev = alt-y PanelDirectoryHistoryPrev = alt-y
@ -315,6 +315,7 @@ PanelSortOrderByName=
PanelSortOrderByExt= PanelSortOrderByExt=
PanelSortOrderBySize= PanelSortOrderBySize=
PanelSortOrderByMTime= PanelSortOrderByMTime=
PanelSmartGotoParentDir=
[input] [input]
InputBol = ctrl-a; alt-lt; home; a1 InputBol = ctrl-a; alt-lt; home; a1

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

@ -1720,8 +1720,22 @@ maybe_cd (int move_up_dir)
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/** Returns the number of items in the given panel */
/* if command line is empty then do 'cd ..' */
static cb_ret_t
force_maybe_cd (void)
{
if (cmdline->buffer[0] == '\0')
{
do_cd ("..", cd_exact);
return MSG_HANDLED;
}
return MSG_NOT_HANDLED;
}
/* --------------------------------------------------------------------------------------------- */
/* Returns the number of items in the given panel */
static int static int
ITEMS (WPanel * p) ITEMS (WPanel * p)
{ {
@ -1877,7 +1891,7 @@ prev_page (WPanel * panel)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static void static void
ctrl_prev_page (WPanel * panel) goto_parent_dir (WPanel * panel)
{ {
(void) panel; (void) panel;
do_cd ("..", cd_exact); do_cd ("..", cd_exact);
@ -1911,7 +1925,7 @@ next_page (WPanel * panel)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static void static void
ctrl_next_page (WPanel * panel) goto_child_dir (WPanel * panel)
{ {
if ((S_ISDIR (selection (panel)->st.st_mode) || link_isdir (selection (panel)))) if ((S_ISDIR (selection (panel)->st.st_mode) || link_isdir (selection (panel))))
{ {
@ -2760,11 +2774,11 @@ panel_execute_cmd (WPanel * panel, unsigned long command)
case CK_PanelPrevPage: case CK_PanelPrevPage:
prev_page (panel); prev_page (panel);
break; break;
case CK_PanelCtrlNextPage: case CK_PanelGotoChildDir:
ctrl_next_page (panel); goto_child_dir (panel);
break; break;
case CK_PanelCtrlPrevPage: case CK_PanelGotoParentDir:
ctrl_prev_page (panel); goto_parent_dir (panel);
break; break;
case CK_PanelDirectoryHistoryList: case CK_PanelDirectoryHistoryList:
directory_history_list (panel); directory_history_list (panel);
@ -2793,6 +2807,9 @@ panel_execute_cmd (WPanel * panel, unsigned long command)
case CK_PanelMarkFileDown: case CK_PanelMarkFileDown:
mark_file_down (panel); mark_file_down (panel);
break; break;
case CK_PanelSmartGotoParentDir:
res = force_maybe_cd ();
break;
case CK_PanelMoveUp: case CK_PanelMoveUp:
move_up (panel); move_up (panel);
break; break;

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

@ -479,8 +479,8 @@ const global_keymap_t default_panel_keymap[] = {
{KEY_KP_ADD, CK_PanelCmdSelect, "M-+"}, {KEY_KP_ADD, CK_PanelCmdSelect, "M-+"},
{KEY_KP_SUBTRACT, CK_PanelCmdUnselect, "M--"}, {KEY_KP_SUBTRACT, CK_PanelCmdUnselect, "M--"},
{KEY_F (13), CK_PanelCmdViewSimple, "S-F3"}, {KEY_F (13), CK_PanelCmdViewSimple, "S-F3"},
{KEY_M_CTRL | KEY_NPAGE, CK_PanelCtrlNextPage, "C-PgDn"}, {KEY_M_CTRL | KEY_NPAGE, CK_PanelGotoChildDir, "C-PgDn"},
{KEY_M_CTRL | KEY_PPAGE, CK_PanelCtrlPrevPage, "C-PgUp"}, {KEY_M_CTRL | KEY_PPAGE, CK_PanelGotoParentDir, "C-PgUp"},
{ALT ('H'), CK_PanelDirectoryHistoryList, "M-H"}, {ALT ('H'), CK_PanelDirectoryHistoryList, "M-H"},
{ALT ('u'), CK_PanelDirectoryHistoryNext, "M-u"}, {ALT ('u'), CK_PanelDirectoryHistoryNext, "M-u"},
{ALT ('y'), CK_PanelDirectoryHistoryPrev, "M-y"}, {ALT ('y'), CK_PanelDirectoryHistoryPrev, "M-y"},