mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Ticket #4397: sort in editor without arguments stopped working.
* (input_get_text): never return NULL. If buffer is empty, return an empty allocated string. * (input_push_history): use new input_get_text. * (find_parameters): likewise. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
9f15305dc2
commit
318315399b
@ -220,14 +220,12 @@ input_push_history (WInput * in)
|
|||||||
char *t;
|
char *t;
|
||||||
gboolean empty;
|
gboolean empty;
|
||||||
|
|
||||||
/* FIXME: don't use input_get_text() to avoid extra checks */
|
t = g_strstrip (input_get_text (in));
|
||||||
t = g_strstrip (g_strndup (in->buffer->str, in->buffer->len));
|
|
||||||
empty = *t == '\0';
|
empty = *t == '\0';
|
||||||
if (!empty)
|
if (!empty)
|
||||||
{
|
{
|
||||||
g_free (t);
|
g_free (t);
|
||||||
/* FIXME: don't use input_get_text() to avoid extra checks */
|
t = input_get_text (in);
|
||||||
t = g_strndup (in->buffer->str, in->buffer->len);
|
|
||||||
|
|
||||||
if (in->history.name != NULL && in->strip_password)
|
if (in->history.name != NULL && in->strip_password)
|
||||||
{
|
{
|
||||||
@ -1159,14 +1157,10 @@ input_assign_text (WInput * in, const char *text)
|
|||||||
* @param in input line
|
* @param in input line
|
||||||
*
|
*
|
||||||
* @return newly allocated string that contains a copy of @in's text.
|
* @return newly allocated string that contains a copy of @in's text.
|
||||||
* If @in is empty, return NULL.
|
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
input_get_text (const WInput * in)
|
input_get_text (const WInput * in)
|
||||||
{
|
{
|
||||||
if (input_is_empty (in))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return g_strndup (in->buffer->str, in->buffer->len);
|
return g_strndup (in->buffer->str, in->buffer->len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -823,10 +823,11 @@ find_parameters (WPanel * panel, char **start_dir, ssize_t * start_dir_len,
|
|||||||
g_free (options.ignore_dirs);
|
g_free (options.ignore_dirs);
|
||||||
options.ignore_dirs = input_get_text (in_ignore);
|
options.ignore_dirs = input_get_text (in_ignore);
|
||||||
|
|
||||||
*content = input_get_text (in_with);
|
*content = !input_is_empty (in_with) ? input_get_text (in_with) : NULL;
|
||||||
*pattern = input_get_text (in_name);
|
if (input_is_empty (in_name))
|
||||||
if (*pattern == NULL)
|
|
||||||
*pattern = g_strdup (options.file_pattern ? "*" : ".*");
|
*pattern = g_strdup (options.file_pattern ? "*" : ".*");
|
||||||
|
else
|
||||||
|
*pattern = input_get_text (in_name);
|
||||||
*start_dir = !input_is_empty (in_start) ? in_start->buffer->str : (char *) ".";
|
*start_dir = !input_is_empty (in_start) ? in_start->buffer->str : (char *) ".";
|
||||||
if (in_start_dir != INPUT_LAST_TEXT)
|
if (in_start_dir != INPUT_LAST_TEXT)
|
||||||
g_free (in_start_dir);
|
g_free (in_start_dir);
|
||||||
|
Loading…
Reference in New Issue
Block a user