Open-Selected-File improvement

Started by Stefan, April 15, 2009, 09:58:28 AM

Previous topic - Next topic

Stefan


No request, just FYI

I don't know if it is worth, but i just mention it:

I have:
A.   f:\a\HippoEDIT\license.txt
B. "f:\a\HippoEDIT\license space xUSSR.txt"

I try:
1.) Put cursor inside string A - press Ctrl+Shift+O > file is opened in HippoEDIT
2.) Put cursor inside string B - press Ctrl+Shift+O > file "f:\a\HippoEDIT\license" is not found (path is only taken till first space)
3.) Select    whole    string B - press Ctrl+Shift+O > file is opened in HippoEDIT


Question:
Perhaps it works as indented, i would expect string inside "quotes" would also be recognized as an valid path? (without selecting all)


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

alex

Hi Stefan,

Yes, I agree. I would try to beautify logic and check also double quotes around the text... Also woul not work always, but maybe more often.

Example which would not work:
" some text " include C:\SomeDir\SomeFile.txt "another text"

calculation of all symmetric quotes is real hell (because you need to take into account that it can start previous line etc.)

BTW: how you get a german text in message box ;)

Best regards,
Alex.

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

Stefan

#2
I think you can simply search left for  \w:\\ , then...

PseudoCode:

LeftPos = RegExSerach("\w:\\")
HE.columnSet(LeftPos)
HE.charLeft(1)
CharLeft = HE.charGet

While CharLeft = " "
  HE.charLeft(1)
  If error break
  CharLeft = HE.charGet
Loop


IF CharLeft =   chr(34) Then
   RigthPos = RegExSearch(chr(34))          'search to right for next quote "  chr(34)
   select LeftPos-RightPos
   open file
Else
   RigthPos = RegExSearch(" ")                 'search to right for next space \s
   select LeftPos-RightPos
   open file
End If


Here i wouldn't expect to take line breaks into account?


----

> BTW: how you get a german text in message box
Because you use API


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

alex

Hi, thanks.

this should work. I would limit search line bounds, just to simplicity and speed. If does not work - bad luck.
But regexp does not take into account relative paths containing spaces...
Path can be relative to current file location and also containing in project (then file name search, without path used).
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Arthur

Can I suggest: perhaps a check for file existence would not harm either.

alex

HE does check for existance, but not in interactive cases (when you call command OpenSelectedFileName).
Because it is better to inform user that function fail, then silently do nothing. In case of message he can at least select file name manually and try reopen.

But internally to select which of ways to select, existance check used. For example, if HE could not recognize file name in text, it checks clipboard content.

Possible solution would be to open File Open dialog (prefilled with selected text), in case than file not found to give user possibilty to select it manually. What do you think.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Arthur

Then definitely pop up the Open File dialog; optionally the File Search.