Ticket #2365: enhancement of quick search.
Double pressing of C-s runs the quick search using previous search pattern. Usage example: 1. Press C-s 2. Make quick search with some pattern. 3. Stop quick search with any way. 4. Press C-s. The empty search line will be shown. 5. Press C-s again. The previous pattern will be shown and will be used in current quick search. English and Russian man pages are updated. Thanks Alexey Losich (E.L.K) for the initial patch. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
99149c5c54
Коммит
504bd05729
@ -586,6 +586,9 @@ or
|
||||
keys can be used to correct typing mistakes. If C\-s is pressed
|
||||
again, the next match is searched for.
|
||||
.P
|
||||
If quick search is started with double pressing of C\-s, the previous quick
|
||||
search pattern will be used for current search.
|
||||
.P
|
||||
Besides the filename characters, you can also use wildcard
|
||||
characters '*' and '?'.
|
||||
.\"NODE " Shell Command Line"
|
||||
|
@ -588,6 +588,9 @@ Midnight Commander\-а. Для возврата к вашему приложен
|
||||
.I C\-s
|
||||
нажато снова, осуществляется поиск следующего подходящего файла.
|
||||
.P
|
||||
Если переход в режим быстрого поиска осуществляется двойным нажатием
|
||||
C\-s, то в текущем поиске будет использоваться шаблон предыдущего поиска.
|
||||
.P
|
||||
Кроме обычных символов в имени файла также можно использовать
|
||||
символы маски '*' и '?'.
|
||||
.P
|
||||
|
@ -99,6 +99,7 @@ typedef struct WPanel {
|
||||
|
||||
gboolean searching;
|
||||
char search_buffer [256];
|
||||
char prev_search_buffer [256];
|
||||
char search_char [MB_LEN_MAX]; /*buffer for multibytes characters*/
|
||||
int search_chpoint; /*point after last characters in search_char*/
|
||||
} WPanel;
|
||||
|
17
src/screen.c
17
src/screen.c
@ -1379,6 +1379,7 @@ panel_new_with_dir (const char *panel_name, const char *wpath)
|
||||
panel->user_status_format[i] = g_strdup (DEFAULT_USER_FORMAT);
|
||||
|
||||
panel->search_buffer[0] = '\0';
|
||||
panel->prev_search_buffer[0] = '\0';
|
||||
panel->frame_size = frame_half;
|
||||
|
||||
section = g_strconcat ("Temporal:", panel->panel_name, (char *) NULL);
|
||||
@ -2415,7 +2416,7 @@ do_search (WPanel * panel, int c_code)
|
||||
{
|
||||
memcpy (panel->search_buffer + l, panel->search_char, panel->search_chpoint);
|
||||
l += panel->search_chpoint;
|
||||
(panel->search_buffer + l)[0] = '\0';
|
||||
*(panel->search_buffer + l) = '\0';
|
||||
panel->search_chpoint = 0;
|
||||
}
|
||||
}
|
||||
@ -2483,6 +2484,13 @@ start_search (WPanel * panel)
|
||||
panel->selected = 0;
|
||||
else
|
||||
move_down (panel);
|
||||
|
||||
/* in case if there was no search string we need to recall
|
||||
previous string, with which we ended previous searching */
|
||||
if (panel->search_buffer[0] == '\0')
|
||||
g_strlcpy (panel->search_buffer, panel->prev_search_buffer,
|
||||
sizeof (panel->search_buffer));
|
||||
|
||||
do_search (panel, 0);
|
||||
}
|
||||
else
|
||||
@ -2500,6 +2508,13 @@ static void
|
||||
stop_search (WPanel * panel)
|
||||
{
|
||||
panel->searching = FALSE;
|
||||
|
||||
/* if user had overrdied search string, we need to store it
|
||||
to the previous_search_buffer */
|
||||
if (panel->search_buffer[0] != '\0')
|
||||
g_strlcpy (panel->prev_search_buffer, panel->search_buffer,
|
||||
sizeof (panel->prev_search_buffer));
|
||||
|
||||
display_mini_info (panel);
|
||||
}
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user