Ticket #1662 (closed defect: fixed)

Opened 15 years ago

Last modified 15 years ago

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:

  1. search for anything (in viewer, editor or find file dialog itself),
  2. open find file, clear Content filed (when one want to search just by filename), press OK
  3. 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

Blocked by #1665 due to the same piece of code.

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:3 Changed 15 years ago by andrew_b

  • severity changed from no branch to on review

comment:4 Changed 15 years ago by andrew_b

  • Blocked By 1665 removed

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:

  1. search for anything (in viewer, editor or find file dialog itself),

Ok, search text is 'bla-bla', for example

  1. 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.

  1. 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:

  1. search for anything (in viewer, editor or find file dialog itself),

Ok, search text is 'bla-bla', for example

  1. 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.

  1. 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:9 in reply to: ↑ 8 Changed 15 years ago by andrew_b

Replying to slavazanko:

Is my patch useful?

Yes, I think.

comment:10 Changed 15 years ago by slavazanko

See changeset:d9ce7329f178d40c2433c410088fdc1cd61db13f

Need to rebase before merge into 'master' branch

Review.

comment:11 Changed 15 years ago by andrew_b

  • Votes for changeset set to andrew_b

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

comment:14 Changed 15 years ago by andrew_b

  • Status changed from testing to closed

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:16 Changed 15 years ago by andrew_b

  • Blocked By 1814 added

comment:17 Changed 15 years ago by andrew_b

  • Blocked By 1814 removed

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
Note: See TracTickets for help on using tickets.