Ticket #1662 (closed defect: fixed)
Find file - Content keeps filling in
Reported by: | gotar | Owned by: | andrew_b |
---|---|---|---|
Priority: | minor | Milestone: | 4.7.0 |
Component: | mc-core | Version: | 4.7.0-pre3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Branch state: | Votes for changeset: | committed-master |
Description
This one is very irritating... how to reproduce:
- search for anything (in viewer, editor or find file dialog itself),
- open find file, clear Content filed (when one want to search just by filename), press OK
- open find file again, Content has previous value (grrr! 99% of time I don't want to search any contents).
There's no way to clear this (unless someone clears entire search history).
Change History
comment:1 Changed 15 years ago by andrew_b
- Status changed from new to accepted
- Owner set to andrew_b
- Blocked By 1665 added
- Milestone changed from 4.7 to 4.7.0-pre4
comment:2 Changed 15 years ago by andrew_b
Created 1662_find_file_empty_content branch. Parent branch: 1665_find_file_panelize.
changeset:7dabcee58f95a520f3ad15280bc6ba3650673b92
Partially revert of changeset:5fd7d65dcaf74d896afed15fa0ca7e7c55e308fe.
comment:4 Changed 15 years ago by andrew_b
- Blocked By 1665 removed
(In #1665) Merged to master.
changeset:197e5f62f1c6890118e53f7cfa59423fba34d1dd
comment:5 Changed 15 years ago by andrew_b
Rebased to master.
changeset:f6301427c8c432b82589312b324f15ac8968c12c (forced update)
comment:6 follow-up: ↓ 7 Changed 15 years ago by slavazanko
I don't fully agree with commit.
For example, run over test case of ticket:
- search for anything (in viewer, editor or find file dialog itself),
Ok, search text is 'bla-bla', for example
- open find file, clear Content filed (when one want to search just by filename), press OK
In commit, 'Content' field always empty at first start. If I want to continue search, need to call previous value manually.
- open find file again, Content has previous value (grrr! 99% of time I don't want to search any contents).
All ok, empty value will correctly saved. But I'll open editor again and search for 'bla-bla2'. Then I will close editor and call 'Find file' dialog again. What I'll see? 'bla-bla2'? Nope. 'bla-bla' :)
Next patch will fix this behavior:
--- a/src/find.c +++ b/src/find.c @@ -318,7 +318,7 @@ find_parameters (char **start_dir, char **pattern, char **content) find_par_start: if (in_contents == NULL) - in_contents = g_strdup (""); + in_contents = INPUT_LAST_TEXT; if (in_start_dir == NULL) in_start_dir = g_strdup ("."); @@ -437,12 +437,16 @@ find_parameters (char **start_dir, char **pattern, char **content) file_pattern_flag = file_pattern_cbox->state & C_BOOL; file_case_sens_flag = file_case_sens_cbox->state & C_BOOL; skip_hidden_flag = skip_hidden_cbox->state & C_BOOL; - g_free (in_contents); - *content = in_contents = NULL; + *content = NULL; if (in_with->buffer[0] != '\0') { *content = g_strdup (in_with->buffer); - in_contents = g_strdup (*content); + in_contents = INPUT_LAST_TEXT; } + else + { + in_contents = ""; + } + *start_dir = g_strdup ((in_start->buffer[0] != '\0') ? in_start->buffer : "."); *pattern = g_strdup (in_name->buffer); if (in_start_dir != INPUT_LAST_TEXT)
And with test case this looks like:
- search for anything (in viewer, editor or find file dialog itself),
Ok, search text is 'bla-bla', for example
- open find file, clear Content filed (when one want to search just by filename), press OK
'Content' field contain 'bla-bla'. Feel free to clear field or change to other value. All work good.
- open find file again, Content has previous value (grrr! 99% of time I don't want to search any contents).
All ok, empty value will correctly saved. I'll open editor again and search for 'bla-bla2'. Then I will close editor and call 'Find file' dialog again. What I'll see? 'bla-bla2'.
comment:7 in reply to: ↑ 6 Changed 15 years ago by andrew_b
Replying to slavazanko:
All ok, empty value will correctly saved. But I'll open editor again and search for 'bla-bla2'. Then I will close editor and call 'Find file' dialog again. What I'll see? 'bla-bla2'? Nope. 'bla-bla' :)
No. You'll see the empty Content field because you cleared it in previous time.
comment:8 follow-up: ↓ 9 Changed 15 years ago by slavazanko
Well, what about this ticket? Is my patch usefull?
comment:10 Changed 15 years ago by slavazanko
See changeset:d9ce7329f178d40c2433c410088fdc1cd61db13f
Need to rebase before merge into 'master' branch
Review.
comment:12 Changed 15 years ago by angel_il
- Votes for changeset changed from andrew_b to andrew_b angel_il
- severity changed from on review to approved
comment:13 Changed 15 years ago by andrew_b
- Status changed from accepted to testing
- Votes for changeset changed from andrew_b angel_il to commited-master
- Resolution set to fixed
- severity changed from approved to merged
Merged to master.
changeset:2d1eb7bea0f599e0000d97992fd33b201e4b2608
comment:15 Changed 15 years ago by gotar
- Status changed from closed to reopened
- Priority changed from major to minor
- Resolution fixed deleted
Commited solution doesn't prevent Content from filling again after mc restart and so enforces everyone to clear this up every time he starts an mc instance.
comment:17 Changed 15 years ago by andrew_b
- Blocked By 1814 removed
(In #1814) Merged to master.
changeset:35de934437c8aefc1edea09a6f5ab0d963a894f4
comment:18 Changed 15 years ago by andrew_b
- Status changed from reopened to closed
- Resolution set to fixed
- Milestone changed from 4.7.0-pre4 to 4.7.0
Blocked by #1665 due to the same piece of code.