Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #7638
    dw7832
    Participant

    I’m currently struggling to set the properties of the active configuration of a file in a macro:

    // toggle show spaces
    if (document.Config.Mark.ShowSpaces) {
    document.Config.Mark.ShowSpaces = false;
    } else {
    document.Config.Mark.ShowSpaces = true;
    }

    and

    with (document.Config.Indent) {
    TabColumns = 4;
    InsertSpaces = true;
    WrapIndent = true; }
    document.Config.Save();

    Neither of these give an error message but when alert()-ing the properties they are not changed nor does EmEditor act like they’ve changed. Can anybody shed any light?

    Thank you in advance.

    #7639
    Yutaka Emura
    Keymaster

    dw7832 wrote:
    I’m currently struggling to set the properties of the active configuration of a file in a macro:

    // toggle show spaces
    if (document.Config.Mark.ShowSpaces) {
    document.Config.Mark.ShowSpaces = false;
    } else {
    document.Config.Mark.ShowSpaces = true;
    }

    and

    with (document.Config.Indent) {
    TabColumns = 4;
    InsertSpaces = true;
    WrapIndent = true; }
    document.Config.Save();

    Neither of these give an error message but when alert()-ing the properties they are not changed nor does EmEditor act like they’ve changed. Can anybody shed any light?

    Thank you in advance.

    Please try this way:


    cfg = document.Config;
    if (cfg.Mark.ShowSpaces) {
    cfg.Mark.ShowSpaces = false;
    } else {
    cfg.Mark.ShowSpaces = true;
    }
    cfg.Save();

    #7651
    Dino
    Participant

    Thanks, this works. A bit slow, however. I personally think this “show spaces” should be triggered by the Marks button. All these “marks” are also customized in one place, why aren’t they shown in one place? In many editors showing line breaks and spaces is done by the same button.

    #7654
    Yutaka Emura
    Keymaster

    Dino wrote:
    Thanks, this works. A bit slow, however. I personally think this “show spaces” should be triggered by the Marks button. All these “marks” are also customized in one place, why aren’t they shown in one place? In many editors showing line breaks and spaces is done by the same button.

    I will consider the option to customize which marks can be trigerred by the button. Thanks!

    #8516
    derekcohen
    Participant

    Can we have a button to toggle line numbers on and off?

    #8517
    Yutaka Emura
    Keymaster

    Hello derekcohen,

    Yes, it is included in v10 RC.

    #8846
    derekcohen
    Participant

    can I have a macro to toggle word wrap between none and window (ie between Control+1 and Control+3)?

    thanks

    Derek

    #8853
    Yutaka Emura
    Keymaster

    Hello Derek,

    Here is the macro to toggle between no wrap and wrap by window.


    if( editor.QueryStatusByID( 4210 ) & eeStatusLatched ){
    editor.ExecuteCommandByID( 4208 ); // no wrap
    }
    else {
    editor.ExecuteCommandByID( 4210 ); // by window
    }

    #8860
    derekcohen
    Participant

    thanks

    #8862
    Yutaka Emura
    Keymaster

    You are welcome!

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.