Search&Replace dialog improvements

Started by Stefan, December 06, 2008, 04:45:03 PM

Previous topic - Next topic

Stefan

i collecting ideas to add more power to the  HippoEDIT Search&Replace dialog


Call it an poor-mans-scripting.
With such options we could do most of common task of our daily work.
This makes HippoEDIT even more outstanding (but i am sure other will implement such feature too, once seen)

-

1.) add an Repeat-Counter

"( ) Action on every [  3] find" "( ) Repeat"

Explanation: i do an s&r that act on (every) 3 match.

So one can add an blank line every n line.
Or find&replace the third occurrence of an term in an line only.
Or select next 50 lines by ^(.*)$ - count '50' - Extend selection
Or...

( )Repeat will reset counter to 0 and start counting again.

---

2.) add an "matching lines only"

"( ) Act / ( ) Don't act on lines containing:[ \d\d\.\d\d\.2008]" "( ) RegEx"


"Contain: [^ABC.+  ]" "(o) Act / ( ) Don't" "(o) RegEx"

"Find what: [ X ]"
"Replace with:[ Y  ]"

Explanation: do the find or the replace only on lines containing special word/terms

So i want to find 'X' and replace it by 'Y', but only for lines starting with 'ABC'

---

3.) add option "Not" for find/replace

"[ ] Find line that do NOT match"

Explanation: if i do an search (with or without an replace) i want to find lines that doesn't contain search term.

F.ex. I want
Find: .+word.+
Replace: nothing
[X ] Find line that do NOT match
And HippoEDIT will delete all lines that do not have term 'word'

Or Find '//ToDo', and copy all lines NOT containing '//ToDo' to an new file.
 
---

4.) add "Offset"

" Act on offset [  1]
( )+  ( )- 
( )Word ( )Line"


Explanation: things like "Replace" or "Extent selection" should act on word/line set by offset n.

F.ex.

"Find what: [  sVar ]"
"Replace with:[ MsgBox sVar   ]"
" Act on offset [  1]
(o)+  ( )- 
( )Word (o)Line"

And HippoEDIT should FIND search term, GoTo Offset(+1).Line, and to the replace.

Or Find 'End If', go one line back by Offset(-1).Line, and extend Selection.

.
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

Thanks Stefan!

I would think how can I implement these functionlity in best way. Only problem, that I already worte you in some other post, that I dont want to make existing find dialog more complex and big...
Dont know, maybe I need some additional dialog or need some extension dialog for existing one.
I would evaluate what is possible. But any way thanks a lot for your brainstorming and ideas!

Best regards,
Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Stefan

Thanks.

> that I dont want to make existing find dialog more complex and big..
Maybe tapped Interface?

.__________________________.
| Find  |  Replace  |  Advanced |
|          -------------------------------------
| Find what: [                                        ]  |


  ::)
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

Stefan

Another Idea:

Find: ^
Replace: #(start 1; step 1; pad 3)
[X] Script

"Script" means: execute an user script or maybe till then an HE inside script.
My example Script will insert an digit specified inside the ()'s
This will give us:
001
002
003
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

Hi Stefan,

Thanks for suggestion. I have already thought about such thing. But not as Search Dialog enhancement. I have it in my idea list as separated feature, simillar to functionality that has Excel, when you stretch some selection, and Excel predict the pattern. This can be as incremenenting or decrementing with a step, or just pattern multiplication if not number but text is selected.

About you previous post, with idea of Tabbed interface in Search dialog. When I have designed the dialog, I initially skip Tabbed interface, because think, that this makes interface more complicated and somehow heterogeneos, and this is what I want to avoid. So I would try to keep the interface as it is, as far as possible...

Best regards,
Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Stefan

Quote from: Stefan3.) add option "Not" for find/replace

"[ ] Find line that do NOT match"

Explanation: if i do an search (with or without an replace) i want to find lines that doesn't contain search term.

While i can do an work around for my issue (jump to EOF and search up)
it is disturbing to do this several times in a row.
(and this workaround not always work, because this string may appears into other, not related lines, too)


Maybe you have think about in the meantime to add an third row in the Options section?  ;)

Then you may add an "[ ] Find not match" option.
(for the rest of the empty space we will find additional options too  :P)
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Stefan

I don't understood why i should bookmark a few hundred lines and then invert to some many hundred not matching lines
when i just want to find first line not containing <string>

And what is with my usual bookmarks i currently use... they are now mixed up with this "Find"-Bookmarks.
(((Maybe an another improvement idea? Save an restore an set of bookmarks.
Then you can do other thinks with temporary bookmarks and later restore your "real" bookmarks.
And one can transfer this bookmarks to an other document, for e.g. cross-referencing)))


For better understanding, an usual scenario:
- log file with 32.000 lines
- first two hundred lines are all somehow different
- then you have an block of a few hundreds lines containing all same <string>,
--- (which you don't have to read, just skip over (first line to read was enough))
- now you can scroll down or PgDn a few times for several seconds till the end of this block of identical lines is reached
- or as work around you go to EOF and search up for the last line with <string>
--- (but this searched string could be an part of an other, not really releted line)

- And then, know you have to do this work several times for this log file.

- The easyst way is just to search for first line not containing <string>
- So you have skipped this block and can go on reading more important lines.



.
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Stefan

(Since the last days i have problems with quoting... the side say "Loading" or "Prefetching" for previewing, but don't go ahead. Just FYI, maybe it's only me)



Thanks Alex, this really works!

i was able to jump over all lines with:
^((?!Program Files\\Oracle\\Jinitiator).)*$


 
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

Stefan

QuoteVersion 608:
    * Fixed. Now, if multiline text is pasted into Find What field in Search dialog,
    not only line breaks are replaced by appropriate escaped symbols, but also all regular expression reserverd symbols, found in text.


Discuss 1:
Why only for multi lines ?
Why not if i have enabled RegEx and paste in smtg like: "Program Files\Oracle\" give me "Program Files\\Oracle\\"


Discuss 2:
If i paste in multiple lines like
blank
   test\eins\zwei


then RegEx is enabled automatically, resulting in " \r\n test\\eins\\zwei".
I think this automatically escaping of RegEx meta chars should be only appear if the user has enable RegEx before.
And don't enable RegEx automatically by HE. So the average user searching for "test\eins\zwei" didn't wonder.


All in all it seams to me this auto-escaping should only work if i have enable RegEx, but then for single lines two.



---
(Now again: i see "Fetching preview..." but nothing more happens, have to post without preview. Just FYI. I don't see why. Will test at home too.)
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

Discuss 1:
And what if user paste already escaped regular expression from some where?
From where HE should know if it is already escaped or not. I have only one chance to know that it is not escaped, if HE has enabled regular expression search by itself.
And this case is more often, than one when user search for simple text with enabled regexp.

Discuss 2:
Same problem as with 1.
Normal user will not know how to search mutli line text, and this is a good trick.
The only optimization I see, is to NOT enable regular expression for multi line text, if it is lead/trailed by blank line (as in your example).
So, it will be enabled for this:
aaaaaaa
bbbbbb


but not for this:

bbbbbb


or this:
bbbbbb


And about problems with forum - it is my fault: I have installed some plugins for it, and one of them probably has caused this bug with preview and also easy edit. I will try to fix this, but I need to uninstall all mods one by one to find one which leads to bug. And some of mods were installed manually (code modifications) - removing of them is complex... :/
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Stefan

OK Alex.  This was only an idea while stumbling over that while working.
I know i can wait for scripting, but i always want to have this features as defaults so the average user can use this too (and new customers can feel the power of HE)


If you still enjoy, here some thought about this.
(changes are i am going to far and being totally wrong while missing important things)

Alex> And what if user paste already escaped regular expression from some where?
It is even right now that HE doubles the escaping. (from \\ to \\\\) if i paste in an escaped multiline regex
But for single line HE doesn't do any escaping, but this would be nice to have.
So i had the idea to enable this auto-escaping only if (and then always) the user want this, >> by enabling RegEx right before.

[X] Regular Expression
Paste in multi line pattern >> escape it
Paste in single line pattern >> escape it

[  ] Regular Expression
Paste in multi line pattern >> take it as it is
Paste in single line pattern >> take it as it is

-

Maybe an idea would be an semi-automatic, lets the user decide:
If NOT (RegEx checked) && (meta chars pasted in) THEN leave it as it is
If user enables (RegEx checked) checkbox  && (meta chars found) THEN ShowDialog "Should HE escape for you?"

If (RegEx checked) && (meta chars pasted in) THEN ShowDialog "Should HE escape for you?"

If user dis-ables (RegEx checked) checkbox  && (meta chars found) THEN ShowDialog "Should HE remove escape-chars for you?"


-

Even better would be an  option in the RegEx-Hint menu to trigger two functions on my own "escape meta-chars" and "remove escaping"


-------

Alex> Normal user will not know how to search mutli line text, and this is a good trick.
Yes i agree.

Aley> NOT enable regex for multi line text, if it is lead/trailed by blank line
I disagree, this would be contra productive if just this line break is mantatory for the current work of an user
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

Hello Stefan,

QuoteIt is even right now that HE doubles the escaping. (from \\ to \\\\) if i paste in an escaped multiline regex
And this is correct. Because you should not have valid regular expression split in several lines. For regular expression it should be presented in way <line1>\r\n<line2> in one line. If the text is multi lined it is 95% not a regexp, otherwise it is user error.

The purpose of this feature was to make it more comfortable to search for multi line text, but no for escaping of regular expression special characters. This was only a  post correction for case when users multi line texts contains regular expression control symbols, which should be escaped. Otherwise expression is invalid.

I see this very dangerous (see my post before for details):
Quote[X] Regular Expression
Paste in multi line pattern >> escape it
Paste in single line pattern >> escape it
because you can not predict if pasted text already escaped or not and should be escaped at all or have valid escape symbols because it is actually regular expression copied from some where but not a plain text.

So, I will leave the state as it is, because for me it is less error-prone then yours.
But let us wait for more complains about this topic and then I can rethink my decision ;)

Best regards,
Alex.


HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Stefan

Another issue: Search-Dialog moves out of HE-Window

Note:
depending where i place the Search-Dialog at the begin, this happens not always.
But it happens to me while search&replace an text over the whole screen from top to button.

Scenario:
If the Search & Replace Dialog  would cover an replacement location
this dialog moves down - and also the cursor stays on the same button as before, good!

Issue:
But once the dialog moves down enough
the button to click is hidden behind the taskbar
and the click goes to the button in the taskbar instead of the [Replace]-button.

Question:
Maye you can compare the location of the bottom border of the Search-Dialog to the border of HE window
and if the Search-Dialog is outside of HE, move the Search-Dialog more up to the top of the HE window, right over the replacement location.


<on topic fifa>
#000000
#FF0000
#FFFF00
</on topic fifa>
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-