Forum Replies Created

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • in reply to: New Line at EOF on Save #18716
    Shavok
    Participant

    This is the modified macro I’m working with that covers things quite nicely:

    Redraw = false;
    
    xPos = document.selection.GetActivePointX(eePosLogical);
    yPos = document.selection.GetActivePointY(eePosLogical);
    
    nLines = document.GetLines();
    str = document.GetLine(nLines);
    if(str.length != 0) {
    	document.selection.EndOfDocument();
        document.selection.NewLine();
        document.selection.SelectLine();
        document.selection.Delete();
    }
    
    bExtendSelection = false;
    document.selection.SetActivePoint(eePosLogical, xPos, yPos, bExtendSelection);

    I wasn’t clear enough with the example I showed – it should be:

    for i in range(1, 10, 1):
    ~~~~print i
    ~~~~<----where the line starts

    This indentation is perfectly natural if you are going to have additional commands in Python. But on saving the expectation should be:

    for i in range(1, 10, 1):
    ~~~~print i
    <----where the line starts

    Answering your question – yes, I do have line numbers enabled.

    in reply to: New Line at EOF on Save #18714
    Shavok
    Participant

    Okay, okay…fair point :)

    The error I picked up with your 0.02 was using the Python syntax (so with Auto Intent in place).

    With the following command:

    for i in range(1, 10, 1):
        print i  # line ends here

    If I pressed enter again it would create a tabbed space. Using your macro – it too create a space in the last line then, so:

    for i in range(1, 10, 1):
        print i
        ~~~~ # where the line starts

    As mentioned – this was not the case with the previous 0.01 code.

    in reply to: New Line at EOF on Save #18711
    Shavok
    Participant

    I like the addition of keeping the cursor where it should be, however I tested your 0.02 version and it does not work with the Auto Indentation activated (unlike the previous one 0.01).

    in reply to: New Line at EOF on Save #18709
    Shavok
    Participant

    I like! Thank you :)

    in reply to: New Line at EOF on Save #18707
    Shavok
    Participant

    Great! This works very well (and looking at the code, can understand how it works).

    The indent “problem” would only occur now and then and the main point of this auto-eof-line is a general good practice.

    May I put this forward as a suggestion?

    Thanks!

    in reply to: New Line at EOF on Save #18705
    Shavok
    Participant

    Thanks for the reply!

    So I’ve started on a macro but my coding on this is very weak…

    The intention:

    • Check if there’s a blank line at the end of the document
    • If not, then make a new line

    I’ve only got the last part nailed so far…

    document.selection.EndOfDocument();
    document.selection.NewLine();
    

    Can you please assist on the “if” part?

    in reply to: External Tools – Using the Output Bar #18632
    Shavok
    Participant

    Thanks! This worked perfectly.

    On closer inspection I see this actually opens up the cmd.exe process. So by introducing this “hack” we actually close the previous cmd.exe then?

    Works quite nicely.

    in reply to: Multiple Select #18078
    Shavok
    Participant

    Perfect! It’s now working as expected. Thanks!

    in reply to: Multiple Select #18074
    Shavok
    Participant

    Ah, I see how you work it. So our selection is the actual space (hence the highlighted area).

    While the behaviour is “as expected” – Multiple Select – of the spaces between words. Would it not be more intuitive to incorporate a Multiple Edit instead. The behaviour feels easier to work with as experienced with Sublime or Notepad++.

    See how the multi-edit works here: http://notepad-plus-plus.org/features/multi-editing.html

    Thanks for the help Stefan though – appreciate the quick assistance.

    in reply to: PYthon IDE – External Tools #18072
    Shavok
    Participant

    I’ve found the solution – rather than getting too technical of having too many things in the “arguments” line, I used the following:
    “/k autopep8 $(FilenameEx) “–in-place””

    Works like a charm!

    in reply to: Multiple Select #18071
    Shavok
    Participant

    Okay, I can see how to “properly” use this as it was intended. Actually I was looking for something along the lines of rather than selecting the full work the multiple select is more like a multiple placement of the carat instead. So if I had the following:

    The quick brown cat jumps over the lazy dog

    I could multiple select the cursor at the end of “cat” and “dog” and then simply type “s” resulting in:

    The quick brown cats jumps over the lazy dogs

    in reply to: Insert Numbering – Padding #18070
    Shavok
    Participant

    Nice! A sneaky way to do it. Thank you :)

Viewing 12 posts - 1 through 12 (of 12 total)