Forum Replies Created
- AuthorPosts
QiaoJiao
ParticipantMy final super script: jump to random line in the file, if more than 1 line selected, jump to a random line from them.
The quirky thing here is to remove last “\n”, otherwise next line will also be included which we don’t want.var text = document.selection.Text; var last_char = text.slice(-1); if ( last_char === "\n" ) text = text.slice(0, -1); if ( text.indexOf("\n") === -1 ) { var lines_total = document.GetLines(); var line_random = Math.floor((Math.random()*lines_total)+1); } else { var yTop = document.selection.GetTopPointY(eePosLogical); var yBottom = document.selection.GetBottomPointY(eePosLogical); if ( last_char === "\n" ) yBottom = yBottom - 1; var line_random = Math.floor((Math.random()*(yBottom - yTop + 1)) + yTop); } document.selection.SetActivePoint(eePosLogical, 1, line_random);
QiaoJiao
ParticipantYes, execty this. GetTopPointY is the magic I was looking for. Thanks a lot.
“–” in code is messed up with formating, should be “-“.
QiaoJiao
ParticipantI want to set cursor to a random line from selected lines. So if I select 3 lines, run script, it would set cursor to one of them randomly.
My code above works for whole file, I wonder is it possible to do this for selected lines.
Main problem is getting line number for selected lines, after that it is the same as in the previouse code.
QiaoJiao
ParticipantThanks, got it. Option would be perfect. It is not a big deal, it depends on how you use links.
I often use EmEditor as file browser with search and click, it is my main way for navigating in os for commonly used files.
plain text is lifeQiaoJiao
ParticipantThats it! I forgot that I changed them. Thank you!
“Tag” is confusing, I know them as html tags or tags like for categorizing content. Can’t wrap my head what they have to do with search, so I turned them off.
I use urls and local links a lot.
QiaoJiao
ParticipantPlease select Tag Jump instead of Open URL with Default Program
It doesn’t helped. Same behavior – hovering over it don’t change cursor, clicking does nothing. I tried several things, restarted EmEditor.
Can you use the Tag Jump command (F10) to jump?
Yes, it works. So, only clicking has problem.
Few days ago I was messing with links and removed all actions except for hyperlinks. When I found that search also has “active strings”, I tried to restoring it, but nothing changes. I actually don’t know what “tag” is, it is somehow misleading.
I did press “reset” – it restored all options here, but search page still is not working with mouse.
QiaoJiao
Participantok, thank you
It would be great if emeditor have export option for this
QiaoJiao
Participantnoman9607, thanks, I didn’t expected it in the “view”
February 18, 2015 at 9:01 pm in reply to: Bookmarks need refreshing if "Highlight Changed/Saved Lines" is off #19854QiaoJiao
ParticipantI just upgraded to 14.7.1 (from 14.6.~) and problem is still here. I uninistalled and installed, it didn’t helped..
Press ctrl+F2 — nothing happens
Move screen and return (or press F2) — bookmarks is shownRemoving bookmarks has the same problem. Pressing ctrl+F2 doesn’t remove it, but after refreshing screen, it disappeared. So, bookmarks pointer is shown only after refreshing screen.
On any text file.
Registry fileNot a big deal but a little bit inconvenient.
QiaoJiao
ParticipantCan you type anything at all? Sounds like a read only mode
November 15, 2014 at 3:35 am in reply to: Why Comment/Uncomment Functionality Becomes Enabled Only When Line(s) Selected? #19626QiaoJiao
ParticipantShame on me, it was included in on of the new version.
October 8, 2014 at 12:34 pm in reply to: Why Comment/Uncomment Functionality Becomes Enabled Only When Line(s) Selected? #19416QiaoJiao
ParticipantSweet and simple (actually, totally based on Emura code with my brute force comment check).
I assigned it to ctrl+qif( document.selection.IsEmpty ) { editor.ExecuteCommandByID(4154); // select // if line has comment sign if ( document.selection.Text.substring(0,2) == '//' ) { // change to (0,1) and '#' if you use # editor.ExecuteCommandByID(4372); // uncomment } else { editor.ExecuteCommandByID(4371); // comment } document.selection.Collapse(); // unselect }
QiaoJiao
ParticipantBtw, when I deleted it, the first occurance was deleted, not which was selected.
QiaoJiao
ParticipantYep, I see it below, didn’t check it.
Thank you.
QiaoJiao
Participantwow, I asked this question 4 years ago – http://www.emeditor.com/forums/topic/js-configuration-highlight-without-language-tags/
shame on me :)QiaoJiao
ParticipantI found it
Highlight2 -> Special Syntax -> None (I used HTML Embedded)QiaoJiao
ParticipantIn properties you can use only minutes.
I will try write macro on Focus Lost.
QiaoJiao
ParticipantThank you! Now I see it.
QiaoJiao
ParticipantPerl is too messy, use Python.
This will solve a problem.QiaoJiao
ParticipantI’ve just found that it is possible to use command line options for this:
EmEditor /l 1234 D:file.txt
It is not a macro, but it is much more powerful for my case. I am using it with Python script that counts lines, selects random line and starts a program.
One difference is that SetActivePoint macro sets pointer to the bottom edge of a screen. And /l sets it to the middle.
QiaoJiao
ParticipantNo, I am not saying about wrapping in SV view. I am saying about wrapping after it. When you open usual file after SV view.
1. Open text file with long lines
2. Set wrapping to “by window”
3. Set view to SV
4. Set view back to normal (or open other file) – wrapping is set to “no wrap”.SV does not need wrapping. But it resets wrapping to “no wrap” for normal (not SV) view.
QiaoJiao
ParticipantThank you, it is exactly what I am looking for.
Actually, I need to jump to a random line. Here is a code for it:
var lines_total = document.GetLines();
var line_random = Math.floor((Math.random()*lines_total)+1);
document.selection.SetActivePoint(eePosLogical, 1, line_random);
QiaoJiao
ParticipantThe closest way is:
clipboardData.setData("Text", line_number);
editor.ExecuteCommandByID(4139);Then you have to press “ctrl+v” and “enter”.
April 13, 2011 at 9:05 am in reply to: Recognize Double-Byte Characters as URLs — cyrillic problem #9342QiaoJiao
Participantyep, works great! Thanks, Yutaka.
QiaoJiao
ParticipantI Found solution!
1 Check “clicking url select whole string”
2 file://c:something.txt-s:search_this — click it
3 launch macros (binded), that will get and parse selected text. It will open new file with given path and search and goto first match for -s parameter.
Only one additional step – launch script. Not a big deal.
Now it is all about macros possibilities, no core hacking.But I still think it would be great if it will be possible to make regexp text clickable and bind it to macros. file: and http: works well and they are not special.
- AuthorPosts