Forum Replies Created

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • in reply to: want to indent block by one column #9427
    gning
    Participant

    Bringing back an old issue here… this problem is not fixed in 10.0.8 (x64). Here is my latest attempt at a macro to indent by one space… note that it tries to force the editor into indent-with-spaces-only mode:

    var icfg = Document.Config.Indent;
    var oldIC = icfg.IndentColumns;
    var oldTC = icfg.TabColumns;
    var oldIS = icfg.InsertSpaces;
    icfg.IndentColumns = icfg.TabColumns = 1;
    icfg.InsertSpaces = true;
    Document.Config.Save();
    Editor.ExecuteCommandByID(4358); // indent (as with Tab key)
    icfg.IndentColumns = oldIC;
    icfg.TabColumns = oldTC;
    icfg.InsertSpaces = oldIS;
    Document.Config.Save();

    With alerts, I have verified that the values of the column properties do change to 1… but the indent I end up with is still a tab character, not a space. Exactly as if I had just pressed the tab key without changing any settings.

    gning
    Participant

    Thanks. The macro basically works. But when I said “perceive a change of indent as a paragraph boundary”, what I meant was that if one set of lines is indented to a different depth from other lines that are adjacent to it, that the macro would see these as being two distinct paragraphs.

    Maybe that’s not necessary. In fact, I probably don’t need it. So I’ll probably just use your macro as it is, but without the last line.

    Sorry I asked the question and then forgot for so long to check back for the answers…

    Anyway, the object I had in mind was to combine that with a macro of my own for reflowing text in a selection. Put them together, and you get something to reflow the paragraph the cursor is in.

    Here is my reflow-selection macro:

    // Save current wrap setting:
    var stateNoWrap = editor.QueryStatusByID(4208); // No Wrap
    var stateWindowWrap = editor.QueryStatusByID(4210); // Wrap by Window
    var statePageWrap = editor.QueryStatusByID(4318); // Wrap by Page
    // Temporarily set Wrap by Characters mode:
    editor.ExecuteCommandByID(4209);
    // Reflow:
    document.selection.Format(eeFormatJoinLines);
    document.selection.Format(eeFormatSplitLines);
    // Restore previous wrap setting:
    if (stateNoWrap >= eeStatusLatched)
    editor.ExecuteCommandByID(4208);
    else if (stateWindowWrap >= eeStatusLatched)
    editor.ExecuteCommandByID(4210);
    else if (statePageWrap >= eeStatusLatched)
    editor.ExecuteCommandByID(4318);

    The neat thing about this macro as it stands now is that if you select multiple paragraphs, it preserves the spaces between then and reflows each one individually.

    gning
    Participant

    Thanks.

    Maybe I’ll try to make a version that perceives a change of indent to be a paragraph boundary…

    in reply to: how do I make sure it never writes a byte-order mark? #7594
    gning
    Participant

    Thank you.

    I think I’d better find or make a utility to scan files for BOMs.

    I think the problem happens when it loads files that contain only ASCII-7 and interprets them as UTF-8. I think one thing I can probably do that will help is to change the “opening encoding” for the configuration that these files get loaded with (which is “SQL”). I’ll change it from “system default” to “western european”. Will that prevent it from seeing ascii-7 as utf-8?

    in reply to: want to indent block by one column #7193
    gning
    Participant

    Well, I did find the Insert Spaces plugin, but that’s clumsy to use and only goes inward, not outward. Better than nothin’…

    in reply to: want to indent block by one column #7146
    gning
    Participant

    OK I upgraded to 8.0.4, and the macro still does the same thing — the values of IndentColumns and TabColumns don’t change when you assign to them.

    in reply to: want to indent block by one column #7092
    gning
    Participant

    It still indents by the full amount. Even if I just change the value and call Save() and don’t restore any old value, all indentation is still by the old amount.

    I’m using release 7.02, by the way.

    in reply to: want to indent block by one column #6992
    gning
    Participant

    I want to indent blocks by one column in addition to being able to indent them by the normal distance. I want two separate commands. Coarse and fine tuning, so to speak.

    in reply to: automatic paragraph formatting? #6205
    gning
    Participant

    Gah, after running that macro the display erroneously shows the paragraph’s content as selected when it isn’t. If you move the cursor through the “selected” area line by line, it redisplays each line correctly. Also, it sometimes moves the cursor point forward several lines for no reason.

    in reply to: automatic paragraph formatting? #6202
    gning
    Participant

    Hah, never mind, I figured it out… and congratulations on having a macro system that allowed me, in the first evening using it, to whomp up a perfectly good “reflow all paragraphs in selection” macro:

    var stateNoWrap = editor.QueryStatusByID(4208);
    var stateWindowWrap = editor.QueryStatusByID(4210);
    var statePageWrap = editor.QueryStatusByID(4318);
    editor.ExecuteCommandByID(4209);
    document.selection.Format(eeFormatJoinLines);
    document.selection.Format(eeFormatSplitLines);
    if (stateNoWrap >= eeStatusLatched)
    editor.ExecuteCommandByID(4208);
    else if (stateWindowWrap >= eeStatusLatched)
    editor.ExecuteCommandByID(4210);
    else if (statePageWrap >= eeStatusLatched)
    editor.ExecuteCommandByID(4318);

    That’s enough to persuade me to register.

    in reply to: automatic paragraph formatting? #6200
    gning
    Participant

    How does that work? It seems like the Split Lines command is always grayed out. The ability to quickly reflow a paragraph is the one thing I find myself missing from the old text editor I want to replace, UltraEdit.

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