selectWord() acting strange with open file tabs not displayed

Help with writing and running scripts

selectWord() acting strange with open file tabs not displayed

Postby lbj29 » Mon Mar 21, 2011 11:14 am

activeDocument.selectWord() appears to be selecting the word that used to be at the cursor rather than the one that is currently there. Below is a sample script:

Code: Select all
UltraEdit.activeDocument.selectWord();
var cmd = UltraEdit.activeDocument.selection;
UltraEdit.activeDocument.write("command = '" + cmd + "'");

I have assigned this script to Alt-3. If I position the cursor to the right of a word and press Alt-3, it does what I expect. However, if I type a new word and then press Alt-3, it selects a string equal in length to the new word, but using characters from what was there before. Note that if I type a new word, change focus from the file and change back again, then it works.

It is a little difficult to get an exact handle on what is happening (try it -- you'll see), but it seems like it is (partially) working on an "old version" of the file that gets refreshed when you change focus.

Am I using selectWord incorrectly? Is there something else I need?

I am new to both JS and UltraEdit. Also, I am actually using UEStudio (v10.30).


Update on 2011-03-22:

After seeing that it had something to do with my set up, I experimented and found that hiding the "Open File Tabs" appears to make a difference. I normally have them hidden and I have the problem. When I un-hid them, the anomaly disappeared. The problem is that I don't really want them -- they take too much room and the Workspace Manager gives me the control I need.

Thanks
lbj29
Newbie
 
Posts: 2
Joined: Mon Mar 21, 2011 10:56 am

Re: selectWord() acting strange with open file tabs not displayed

Postby Mofi » Tue Mar 22, 2011 6:01 am

You are right. With hiding the Open File Tabs bar the command fails. I can reproduce that. Please report this issue by email to IDM support.

In the meantime you could reenable with View - Views/Lists - Open File Tabs, click with right mouse button on a tab and uncheck from context menu File Tabs - Dockable, click once again with right mouse button on a tab and choose File Tabs - Single Line - scrollable to use smallest standard open file tabs bar. You could reduce the used height a little bit more by setting a small font size as described at Font size for the File Tabs and the List Views
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4062
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: selectWord() acting strange with open file tabs not displayed

Postby lbj29 » Tue Mar 22, 2011 7:49 am

Mofi,

I will report this bug to IDM.

Your suggestions about minimizing the size taken by the file tabs were great. It is now small enough that I don't mind it so much.

Thanks for your help!
lbj29
Newbie
 
Posts: 2
Joined: Mon Mar 21, 2011 10:56 am


Return to Scripts

cron