Author Topic: Open-Selected-File improvement  (Read 610 times)

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 772
  • Karma: +6/-0
    • View Profile
Open-Selected-File improvement
« on: April 15, 2009, 08:58:28 am »

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 News On Twitter: http://twitter.com/hippoedit/)

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1666
  • Karma: +29/-2
    • View Profile
    • HippoEDIT
Re: Open-Selected-File improvement
« Reply #1 on: April 15, 2009, 11:24:37 am »
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.


Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 772
  • Karma: +6/-0
    • View Profile
Re: Open-Selected-File improvement
« Reply #2 on: April 15, 2009, 11:46:44 am »
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


.
« Last Edit: April 15, 2009, 11:52:42 am by Stefan »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1666
  • Karma: +29/-2
    • View Profile
    • HippoEDIT
Re: Open-Selected-File improvement
« Reply #3 on: April 15, 2009, 12:52:11 pm »
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).

Offline Arthur

  • Hero Member
  • *****
  • Posts: 620
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • View Profile
    • My Blog
Re: Open-Selected-File improvement
« Reply #4 on: April 15, 2009, 02:59:19 pm »
Can I suggest: perhaps a check for file existence would not harm either.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1666
  • Karma: +29/-2
    • View Profile
    • HippoEDIT
Re: Open-Selected-File improvement
« Reply #5 on: April 15, 2009, 03:10:23 pm »
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.

Offline Arthur

  • Hero Member
  • *****
  • Posts: 620
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • View Profile
    • My Blog
Re: Open-Selected-File improvement
« Reply #6 on: April 15, 2009, 03:14:02 pm »
Then definitely pop up the Open File dialog; optionally the File Search.

 

Related Topics

  Subject / Started by Replies Last post
6 Replies
540 Views
Last post January 08, 2010, 08:45:38 pm
by alex
9 Replies
583 Views
Last post May 10, 2010, 02:12:46 pm
by alex
1 Replies
363 Views
Last post July 30, 2010, 11:17:26 am
by alex
5 Replies
562 Views
Last post November 22, 2010, 05:22:10 am
by false007
2 Replies
239 Views
Last post June 22, 2011, 02:00:39 am
by alex