Menu

Find functionality

2004-02-19
2012-09-14
  • Scott Carmichael

    Hey there, great app, I love this!

    However, I have one question... Would it be possible to modify the search inside a file (ctrl-f) to:

    A. search downwards by default (like most apps)
    B. search from the cursor point, not the top or bottom of the file

    ?

    That would be sweet if it's possible... That's the only complaint I have, but its current default functionality is bothersome. :)

    Thanks

     
    • Josiah Carlson

      Josiah Carlson - 2004-02-20

      I'm glad you like PyPE.

      A. Looking through the docs again, I notice that all the dialog options can be set with wxFindReplaceData options.  I didn't notice that before.  I'll have it save the last used options, defaulting to down and the other boxes unchecked.  Thanks for poking me into finding the docs for that.

      B. That sounds like something that should be optional, as in, it should be a checkbox in the find dialog.  The default dialog doesn't have a checkbox, so I'd have to make one.  Not such a big deal, but a pain in the ass none the less - I'm not very good at laying out dialogs.  Until I say that I've implemented it, bother me about it every Saturday (I'm quite busy and have had difficulty remembering important things lately).

       
    • Scott Carmichael

      Right on, thanks. ;) Will do... (the bugging)... heh

       
      • Josiah Carlson

        Josiah Carlson - 2004-02-21

        You know what?  I don't know if I really want to spend the time to hack together the 'find from cursor position' dialog code.  As I said before, I'm not really that good at laying out dialogs, so usually end up spending a few hours on such things.  I'm so pressed for time lately, I wouldn't be able to guarantee that it would get done even if you bothered me.

        I did get the up/down and saving state thing set up.  I don't know if that change alone deserves all the work required for the SF and FM update, but if you want me to build you a version and email it to you, I can do that.

         
    • Scott Carmichael

      I was just hoping that 'find from cursor position' would be the default behaviour, since that's the default behaviour of most other apps. :)

      Anyways, if anyone else desires it, the following code seems to do the trick:

      In pype.py, in MainWindow::OnFind(self, evt), down in the case of "elif et == wxEVT_COMMAND_FIND:", there should be the following code (edit as you please):

                  if wxFR_DOWN&flags:
                      win.last = win.FindText(win.GetSelection()[1], win.GetTextLength(), findTxt, flags)
                  else:
                      win.last = win.FindText(win.GetTextLength(), win.GetSelection()[0], findTxt, flags)
                  if win.last > -1:
                      win.SetSelection(win.last, win.last+len(findTxt))

       
      • Josiah Carlson

        Josiah Carlson - 2004-04-21

        There's one trick...If you search down, this works as expected (from cursor to end), but if you are searching up, it searches from the end of the document to the current cursor position.  Perhaps the second find should be as follows...

        win.last = win.FindText(win.GetSelection()[0], 0, findTxt, flags)

         
    • Anonymous

      Anonymous - 2004-08-11

      Thankyou! This search from the top/bottom of file stuff was making me very unhappy. Now the only thing I want is a 'Search only in what is selected' ability, and I'll never need to Cut/Paste code into another editor :D

      BTW: There's no 'perhaps' about it, the second FindText needs to be as Josiah says.

       
      • Josiah Carlson

        Josiah Carlson - 2004-08-11

        I may make that addition and cut a PyPE 1.9.4 release, though PyPE 2.x feels like it is only around a month away from being done.

        If I get some time later this week, I'll probably make 1.9.4 with that addition happen.

         

Log in to post a comment.