#9286

webern
Member

// File: Select_Paragraph.jsee
// Autor: Dmitry Pirozhkov
// Date: 23.Nov.2006
// Info: Macro to select the entire paragraph.
// Requires: EmEditor Professional v.7.00 or later
// Usage: Place the cursor anywhere within a paragraph you wish to select. Run this macro.

var blankLine = "^$"; //the paragraph delimiter
var y1;

with (document.selection) {

if (document.GetLine(GetActivePointY(eePosLogical), eeGetLineWithNewLines).length<=2) {
alert ("Please, place the cursor on the non-blank line.");
Quit();
}

if (!Find(blankLine, eeFindPrevious | eeFindReplaceQuiet | eeFindReplaceRegExp)) {
y1 = 1;
} else y1 = GetActivePointY(eePosLogical)+1;

if (!Find(blankLine, eeFindNext | eeFindReplaceQuiet | eeFindReplaceRegExp)) {
EndOfDocument();
}

SetActivePoint(eePosLogical, 1, y1, true);
StartOfLine(true,eeLineHomeText);
//to perceive an indent as the paragraph boundary
}