EmEditor (text editor) Forum Index
   Questions and Answers about Macros
     want to indent block by one column
Register To Post

Threaded | Oldest First Previous Topic | Next Topic | Bottom
Poster Thread
Yutaka
Posted on: 6/17/2011 8:17 am
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2397
Re: want to indent block by one column
Hi gning,

I will look into this issue in future versions.
Thanks for letting me know!


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

gning
Posted on: 6/16/2011 6:49 pm
Just popping in
Joined: 9/10/2008
From:
Posts: 17
Re: want to indent block by one column
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.
Yutaka
Posted on: 4/24/2009 2:09 pm
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2397
Re: want to indent block by one column
Quote:

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



This is a macro to change the tab/indent length. I hope this helps.


cfg = document.Config;
do {
    n = prompt( "Enter new indent/tab length in characters:", cfg.Indent.TabColumns );
} while( n <= 0 || n > 16 );
cfg.Indent.IndentColumns = cfg.Indent.TabColumns = n;
cfg.Save();


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

gning
Posted on: 4/23/2009 2:39 pm
Just popping in
Joined: 9/10/2008
From:
Posts: 17
Re: want to indent block by one column
Well, I did find the Insert Spaces plugin, but that's clumsy to use and only goes inward, not outward. Better than nothin'...
gning
Posted on: 4/14/2009 4:41 pm
Just popping in
Joined: 9/10/2008
From:
Posts: 17
Re: want to indent block by one column
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.
Yutaka
Posted on: 3/17/2009 2:49 pm
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2397
Re: want to indent block by one column
Quote:

gning wrote:
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.


How about TabColumns insread of IndentColumns?

Why do you still use 7.02? Can you try the newest version?


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

gning
Posted on: 3/17/2009 10:37 am
Just popping in
Joined: 9/10/2008
From:
Posts: 17
Re: want to indent block by one column
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.
Yutaka
Posted on: 2/24/2009 9:49 pm
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2397
Re: want to indent block by one column
Quote:

gning wrote:
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.


I see. Please try this:

cfg = Document.Config;
cfg.Indent.IndentColumns = 1;
cfg.Save();


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

gning
Posted on: 2/24/2009 7:49 pm
Just popping in
Joined: 9/10/2008
From:
Posts: 17
Re: want to indent block by one column
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.
Yutaka
Posted on: 2/24/2009 3:20 pm
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2397
Re: want to indent block by one column
Quote:

gning wrote:
I'm trying to indent and outdent blocks by a single column. I tried temporarily setting Document.Config.Indent.IndentColumns to 1 but the value stays unchanged, and likewise for TabColumns. The help seems to be saying that these properties are settable, but it won't do anything but indent by the previously set width.


Do you need to use a macro? If not, you can change indent/tab numbers in the Configuration Properties > General > Tab/Indent.


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

(1) 2 »
Threaded | Oldest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文