Forum Replies Created

Viewing 25 posts - 1 through 25 (of 33 total)
  • Author
    Posts
  • in reply to: Jump to a random line in the selection #27201
    QiaoJiao
    Participant

    My 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);
    in reply to: Jump to a random line in the selection #27200
    QiaoJiao
    Participant

    Yes, execty this. GetTopPointY is the magic I was looking for. Thanks a lot.

    “–” in code is messed up with formating, should be “-“.

    in reply to: Jump to a random line in the selection #27193
    QiaoJiao
    Participant

    I 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.

    in reply to: Selected text link on link is not clickable #23958
    QiaoJiao
    Participant

    Thanks, 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 life

    in reply to: Search results (search in files) are unclickable #22577
    QiaoJiao
    Participant

    Thats 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.

    in reply to: Search results (search in files) are unclickable #22573
    QiaoJiao
    Participant

    Please 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.

    in reply to: Export language spelling files with new words #19956
    QiaoJiao
    Participant

    ok, thank you

    It would be great if emeditor have export option for this

    in reply to: Where is Toggle filter Toolbar keyboard shortcut? #19855
    QiaoJiao
    Participant

    noman9607, thanks, I didn’t expected it in the “view”

    QiaoJiao
    Participant

    I 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 shown

    Removing 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 file

    Not a big deal but a little bit inconvenient.

    in reply to: CTRL + V (Paste) does'nt work anymore #19639
    QiaoJiao
    Participant

    Can you type anything at all? Sounds like a read only mode

    QiaoJiao
    Participant

    Shame on me, it was included in on of the new version.

    QiaoJiao
    Participant

    Sweet and simple (actually, totally based on Emura code with my brute force comment check).
    I assigned it to ctrl+q

    if( 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
    }
    in reply to: Highlight HTML tag is not the same as set in options #17806
    QiaoJiao
    Participant

    Btw, when I deleted it, the first occurance was deleted, not which was selected.

    in reply to: Highlight HTML tag is not the same as set in options #17805
    QiaoJiao
    Participant

    Yep, I see it below, didn’t check it.

    Thank you.

    in reply to: Highlight is not working for Ruby #17784
    QiaoJiao
    Participant

    wow, I asked this question 4 years ago – http://www.emeditor.com/forums/topic/js-configuration-highlight-without-language-tags/
    shame on me :)

    in reply to: Highlight is not working for Ruby #17783
    QiaoJiao
    Participant

    I found it
    Highlight2 -> Special Syntax -> None (I used HTML Embedded)

    in reply to: Autosave every change or every second #16957
    QiaoJiao
    Participant

    In properties you can use only minutes.

    I will try write macro on Focus Lost.

    in reply to: Disable grab text, or change shortcut key #11032
    QiaoJiao
    Participant

    Thank you! Now I see it.

    in reply to: When the "Comment" character is part of the syntax #10720
    QiaoJiao
    Participant

    Perl is too messy, use Python.
    This will solve a problem.

    in reply to: Jump to a given line #10703
    QiaoJiao
    Participant

    I’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.

    in reply to: Seperated value view resets wrap to no-wrap #10701
    QiaoJiao
    Participant

    No, 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.

    in reply to: Jump to a given line #10667
    QiaoJiao
    Participant

    Thank 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);
    in reply to: Jump to a given line #10665
    QiaoJiao
    Participant

    The closest way is:

    clipboardData.setData("Text", line_number); 
    editor.ExecuteCommandByID(4139);

    Then you have to press “ctrl+v” and “enter”.

    QiaoJiao
    Participant

    yep, works great! Thanks, Yutaka.

    in reply to: Anchor link to a first search result #9336
    QiaoJiao
    Participant

    I 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.

Viewing 25 posts - 1 through 25 (of 33 total)