You are here: PSPad forum > English discussion forum > selected last-inserted text
Posted by: jd | Date: 03/02/2011 05:12 | IP: IP Logged
Is there an easy way to select the last inserted text?
For example, let's say I insert a block of text and then want to indent it; or replace it again; or whatever.
If not, how about adding a command to do this?
Thanks...
-- jeff
Posted by: vbr | Date: 03/02/2011 22:25 | IP: IP Logged
jd:Is there an easy way to select the last inserted text?For example, let's say I insert a block of text and then want to indent it; or replace it again; or whatever.
If not, how about adding a command to do this?
Thanks...
-- jeff
Hi,
it can be done fairly easily with pspad scripting (if WSH is activated and working), e.g. the following code can be copied to the script folder, and after "recompiling scripts" the menu item and shortcut should be available.
hth,
vbr
Quote:////// ...\PSPad\Script\JScript\my_scripts.js /////////
var module_name = "my_scripts";
var module_ver = "0.1";function paste_and_select(){
if (editorsCount()<1){return;}
var actEd = newEditor();
actEd.assignActiveEditor();var origCaretX = actEd.caretX();
var origCaretY = actEd.caretY();
runPSPadAction("aPaste");
actEd.setBlockBegin(origCaretX, origCaretY);
actEd.setBlockEnd(actEd.caretX(), actEd.caretY());
}function Init(){
addMenuItem("paste and select", "", "paste_and_select", "Ctrl+Alt+Shift+V");// labels and shortcuts can be modified
}
Posted by: jd | Date: 03/03/2011 02:56 | IP: IP Logged
Hi vbr, that is a clever approach. I tried it and it does work, so thanks for creating the script.
I'd still like to see better integrated with PSPad. There are times that an insertion is done by PSPad (for example, if you click on the color palette, PSPad will insert a color code) and I'd also like to be able to select that text that PSPad just inserted.
-- jeff
Editor PSPad - freeware editor, © 2001 - 2013 Jan Fiala
Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák