How to setup : single click to select url

Started by false007, August 19, 2014, 10:46:47 AM

Previous topic - Next topic

false007

Hello,

How to setup : single click to select url.


Thanks a lot.
[url="http://forum.hippoedit.com/?/topic,536.msg2371.html#msg2371"]http://forum.hippoedit.com/?/topic,536.msg2371.html#msg2371[/url]

alex

I do not see any built-in option for it now.
Probable solutions can be:

  • Use Expand selection on URL Alt+Down will select URL in 2-3 presses.
  • Write simple plugin, with command to select an url under cursor -> regular expression will do it easy. But still not with mouse (catching mouse actions not possible with plugins).
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

false007

This pattern can math the url : (http://|www.)(.*?)(?= |\r\n|'|")

but  I could't write the plug now, It's very bad.

When I'm  not buzy,  perhaps will write the plug which match the url.
[url="http://forum.hippoedit.com/?/topic,536.msg2371.html#msg2371"]http://forum.hippoedit.com/?/topic,536.msg2371.html#msg2371[/url]

alex

Install Scripting Tools plugin and use the wizard to create "New Service Script".
It will help you to create a stub for your command in a second.
To read text under cursor and change selection check API page on wiki: http://wiki.hippoedit.com/scripting/api/start . You need IApplication + IDocument + IView.
Bellow is some code you can reuse for start
Code (javascript) Select

var sel = ActiveView.Selection;

// if there is no selection, take current word range as selection
if ( sel.IsEmpty )
sel = new Range(0, 0, ActiveDocument.LineCount - 1, ActiveDocument.GetLineLength(ActiveDocument.LineCount - 1));
var text = ActiveDocument.GetText(sel);
       ...
      ActiveView.Selection = sel;

taken from beautifier.hejs
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]