Forum Replies Created

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

    If there’s an issue that causes document.Config to not return the same object when referenced twice, or something like that, I do think it should be explicitly documented, with warnings on various settable config properties.

    (My macro does fully work now.)

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

    Hey, that did fix it! And I was sure I’d already tried it with a separate cfg variable. Thanks.

    Why would using a separate reference make a difference? Is accessing document.Config creating a separate object instance each time, or something?

    Now I just need to work out why my paragraph reflow has stopped working, when it worked correctly as long as the margins were wrong.

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

    I tried using the V8 engine. I made a clean Windows 10 install in a VM, installed Chrome, then did a full install of the latest 64 bit EmEditor, with registration. The V8 engine showed the same bug.

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

    As an aside, I had said “Even worse, IndentColumns contains 8 even though the actual indent in the active config is 4. (TabColumns is also incorrectly returning 8.)” Turns out this was incorrect — I was mistaken. The bug is just that the values are not settable in javascript, not that it was loading any incorrect value originally.

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

    Ooookay.

    Bug: assignment does not change value of IndentColumns, TabColumns, or MarginNormal

    var oldIC = document.Config.Indent.IndentColumns;
    var oldTC = document.Config.Indent.TabColumns;
    var oldMr = document.Config.General.MarginNormal;
    
    document.Config.Indent.IndentColumns = 1;
    document.Config.Indent.TabColumns = 1;
    document.Config.General.MarginNormal = oldMr - 8;
    document.Config.Save();
    
    alert("Indent size changed from " + oldIC + " to " + document.Config.Indent.IndentColumns +
          ", tab size changed from " + oldTC + " to " + document.Config.Indent.TabColumns +
          ", margin changed from " + oldMr + " to " + document.Config.General.MarginNormal + ", and config saved.");
    
    document.Config.General.MarginNormal = oldMr;
    document.Config.Indent.IndentColumns = oldIC;
    document.Config.Indent.TabColumns = oldTC;
    document.Config.Save();

    Expected result: alert shows new values, and indenting or reformatting a paragraph uses those new values.

    Actual result: alert shows values unchanged, and indenting or reformatting applies the old values.
    alert showing unchanged values

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

    I tried to see if it was the version of EmEditor that was the problem… I’d been using the v19 64-bit windows installer version, so I tried the v24 32-bit portable version as an alternative. It has the same bug, just like when I first encountered it in v7.

    Assuming that this feature maybe works for others but not for me, I also tried running it as an administrator to see if that made any difference. It didn’t.

    I’d totally forgotten that this was an old bug. I was rather surprised when I searched the forum for anyone else talking about this bug and found myself, back when I was still running Windows 2000 because I didn’t like XP. (Now I have Windows 10 Pro 22H2.)

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

    Revisiting an old thread… because after fifteen years I am still encountering the same ancient bug!

    I am trying to write a macro to reflow an indented paragraph. This requires measuring the indent, unindenting by that number of spaces, temporarily reducing the margin, reflowing, reindenting, and restoring the margin. It also requires temporarily setting the indent amount. And I still can’t set it to another value. I also can’t update MarginNormal.— when I assign a new value, the old value is still there when I read it back.

    Even worse, IndentColumns contains 8 even though the actual indent in the active config is 4. (TabColumns is also incorrectly returning 8.)

    I’m now on 19.8, and I could update to 24, but I don’t want any AI features.

    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 18 posts - 1 through 18 (of 18 total)