EmEditor (text editor) Forum Index
   Questions and Answers about Macros
     anybody got a macro or other tool that can do Select Paragraph?
Register To Post

Flat Previous Topic | Next Topic
Poster Thread
gning
Posted on: 6/16/2011 9:48 am
Just popping in
Joined: 9/10/2008
From:
Posts: 17
Re: 2 gning
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.
Flat Previous Topic | Next Topic


Subject Poster Date
   anybody got a macro or other tool that can do Select Paragraph? gning 2/25/2011 12:00 pm
     Re: anybody got a macro or other tool that can do Select Paragraph? webern 2/26/2011 1:49 pm
       Re: anybody got a macro or other tool that can do Select Paragraph? shx 2/28/2011 9:02 am
         2 shx webern 2/28/2011 10:45 am
           Re: 2 shx gning 2/28/2011 11:42 am
             Re: 2 gning webern 2/28/2011 11:40 pm
             » Re: 2 gning gning 6/16/2011 9:48 am

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