- Code: Select all
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.