EmEditor (text editor) Forum Index
   EmEditor Core Enhancement Suggestions
     Request: selection length in status bar
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
shaohao
Posted on: 2/23/2008 4:58 am
Not too shy to talk
Joined: 11/12/2006
From:
Posts: 21
Re: Request: selection length in status bar
I just wrote a more complex Macro for the selected text status.


anchorX = document.selection.GetAnchorPointX(eePosLogical);
anchorY = document.selection.GetAnchorPointY(eePosLogical);
activeX = document.selection.GetActivePointX(eePosLogical);
activeY = document.selection.GetActivePointY(eePosLogical);

lines = 0;
chars  = document.selection.text.length;
if ( chars != 0) { // really select something
	if ( activeY > anchorY) {
		lines = activeY - anchorY + 1;
		if ( activeX == 1) lines--;
	} else if ( activeY < anchorY) {
		lines = anchorY - activeY + 1;
		if ( anchorX == 1) lines--;
	} else /* activeY == anchorY */ {
		lines = 1;
	}
}

status = "Selected: " + lines + "lines, " + chars + " chars";
Yutaka
Posted on: 2/23/2008 10:53 am
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2401
Re: Request: selection length in status bar
Good job!


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

« 1 (2)
Threaded | Newest First Previous Topic | Next Topic | Top


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