Menu

Find in Files default directory

Matt Faus
2009-04-24
2012-11-13
  • Matt Faus

    Matt Faus - 2009-04-24

    Hello,

    I've been using Notepad++ for years, and I love it.  I have thought several times about getting involved with the project to add some code, but have never been able to find the time.  Anyway, thanks for all your efforts!

    Here's my complaint:

    I used to do this all the time:
    - Drag 'n drop a file into Notepad++
    - Hit CTRL+SHIFT+F to start a Find in All files
    - type in my phrase and hit enter
    - Wait a few seconds (depending on the number of subdirectories)
    - Get results

    I used this workflow ALL the time to search for phrases in our vast code base.  This worked because the default directory when hitting CTRL+SHIFT+F was the directory that the file I dropped in.  However, now, it defaults to the previously used directory.

    This change in functionality makes one of my favorite uses of Notepad++ take 4-5x longer, as I have to browse to find the directory I'm looking for.

    When was this change made?  I always keep up-to-date on all the versions, so it must have been recently.  Can we revert the functionality to be what it was before?  If not, can we at least make it configurable so Notepad++ still works for my favorite use?

    Thanks!
    Matt

    P.S. I absolutely LOVE that it stores previous "Find in Files" results for the session and that you can expand/collapse them, this is a huge improvement.

     
    • Karl Schultz

      Karl Schultz - 2009-05-07

      Just looked at the code at the tip of tree.  I may have been wrong about the "common function".  In any case, it looks like it is being worked on.  There's a new FindHistory attrib in config.xml to control this that seems to work.  I don't think that there is a UI for setting it yet.

       
    • Matt Faus

      Matt Faus - 2009-04-24

      It sounds like several users have run into this same problem.

      Here is my proposed fix:

      - Add a checkbox to the Find in Files dialog that reads "Keep folder selection"
      - When checked, subsequent ctrl+shift+F will NOT overwrite the folder selection with current file's directory
      - When unchecked, each ctrl+shift+F WILL overwrite the folder selection with the current file's directory
      - Default is OFF, to keep the functionality as it was before 5.3.1

       
    • AT

      AT - 2009-04-26

      @Matt Faus: that sounds like a good idea, I hope Don will implement this.

      Other solution that I thought of is to add a button 'Current directory' (or icon version), which sets the search path to the current file path.

      Since the change my search has become quite click-intensive:
      - crtl+shift+f
      - type search words
      - switch to explorer
      - copy path from explorer
      - switch to notepad
      - paste path

      It would be very nice if Matt's solution could be implemented. And if not, please add the button 'Current directory'.

       
    • Matt Faus

      Matt Faus - 2009-04-27

      Thanks for your suggestion, anqtalunin.  I would like to note, however, that this button would add 1 click to the original scenario.

      I have downloaded the source code for Notepad++ and I think the change required is somewhere around line 3226 of Notepad_plus.cpp, but I am not quite comfortable enough with the code to execute the change.  Also, adding the checkbox is probably a little more difficult than adding the logic.  I have not found where that change should be made yet.

       
    • cchris

      cchris - 2009-04-27

      FindReplaceDlg.rc and FindReplaceDlg_rc.h . And then add logic for the WM_COMMAND message in FindReplaceDlg.cpp to take action on a click on that new checkbox.

      CChris

       
    • Matt Faus

      Matt Faus - 2009-04-30

      Haven't had time to figure out how to implement this change myself.  Seems easy enough for someone versed in this codebase.  Can we expect this next release?

       
    • Karl Schultz

      Karl Schultz - 2009-05-07

      I think this is a bug.  It is a regression from the pre-5.3.1 behavior.

      The first priority should be to restore the previous behavior - making the default dir the one that contains the current file.  That is intuitive and makes sense.

      In addition, I note that there is something wrong with the default directory for the File/Open dialog.  For me, it always goes to the notepad++ installation directory.  It used to be, again, the directory containing the current file.   I know that there is a preference for this, but mine is set to "Follow the current document", and it does not work.

      This suggests to me that there is probably something broken in a common function that is used by both the Find in Files and File/Open dialogs to obtain the "directory of the current file".  This might explain the regression.

      Also, for the Find in Files fans that need a workaround, it may be faster to use:

      Edit/Copy Current Dir Path to Clipboard

      and then paste into the Find in Files directory dialog, rather than going out to Explorer to copy the path.