EmEditor (text editor) Forum Index
   Questions and Answers about Macros
     How to make replaced text automatically selected
Register To Post

Flat Previous Topic | Next Topic
Poster Thread
Yutaka
Posted on: 9/26/2010 10:09 am
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2401
Re: How to make replaced text automatically selected
Hello chjfth,

There is no easy way to do this, but I wrote this code for you:

if( document.selection.Find( "<(.+)>", eeFindReplaceRegExp | eeFindNext) ){
    x1 = document.selection.GetTopPointX( eePosLogical );
    y1 = document.selection.GetTopPointY( eePosLogical );
    x2 = document.selection.GetBottomPointX( eePosLogical );
    y2 = document.selection.GetBottomPointY( eePosLogical );

    sLine1 = document.GetLine( y2 );
    document.selection.Replace( "<(.+)>", "@\\1", eeFindReplaceRegExp);
    sLine2 = document.GetLine( y2 );
    x2 += sLine2.length - sLine1.length;
    
    document.selection.SetActivePoint( eePosLogical, x1, y1 );
    document.selection.SetActivePoint( eePosLogical, x2, y2, true );
} 


I am sorry, but this code doesn't support eeReplaceSelOnly flag. I still hope this helps.


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

Flat Previous Topic | Next Topic


Subject Poster Date
   How to make replaced text automatically selected chjfth 9/25/2010 9:13 pm
   » Re: How to make replaced text automatically selected Yutaka 9/26/2010 10:09 am
       Re: How to make replaced text automatically selected chjfth 9/26/2010 6:55 pm
         Re: How to make replaced text automatically selected snovic 11/25/2010 3:00 am
           Re: How to make replaced text automatically selected Yutaka 11/26/2010 10:03 am
             Re: How to make replaced text automatically selected snovic 11/27/2010 7:21 am
               Re: How to make replaced text automatically selected Yutaka 11/28/2010 12:42 pm
                 Re: How to make replaced text automatically selected snovic 11/29/2010 4:20 am
                   Re: How to make replaced text automatically selected Yutaka 11/29/2010 12:49 pm
                     Re: How to make replaced text automatically selected snovic 12/1/2010 1:01 am
                       Re: How to make replaced text automatically selected Yutaka 12/1/2010 7:47 am

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