#20803
LifeTimer
Participant

Sorry for not providing enough details. After trying to put together a PoC, it appears that the problem is a bit more specific than I first thought.

My external tool is indeed a terminal program, and it’s using the Output Bar.

Here is a PoC that you can use to reproduce this bug-like behavior:

Run the following Python script as an External Tool:

import sys
import time

print "Starting processing, arrow keys (cursor handling) won't work correctly in the editor from this point."
sys.stdout.flush()
for line in iter(lambda: sys.stdin.readline(), ""):
	print ("You entered: " + line).strip()
	sys.stdout.flush()
	time.sleep(2)
print "Processing complete, now the arrow keys (cursor handling) will work again."

Using the following external tool settings for it:

Command: C:\Python27\python.exe (or whatever your Python path is)
Arguments: C:\your\script\path\emeditor_bug_poc.py
Use Output Bar: Yes (checked)
Input: Custom: $(CurText)
All other fields empty/default.

Now simply select multiple rows of text in the editor, and then run this external tool (either by using a shortcut or by executing it from the menu, it doesn’t matter).

For my test, I selected the following rows:

111
222
333
444
555
666
777

Now, while it is running, try to move the cursor with the arrow keys (first click in the editor to get the GUI focus there), or insert text into the document. You will see that the cursor turns “grey”, and in my case it jumps all over the place when I press some arrow keys, even to positions outside of lines, where it could not normally be placed. Also, all characters you enter in the document end up in the output bar instead of the document, even though GUI focus is still in the document.

It also seems that this only happens when I define the custom input as “$(CurText)”, or at least not when I define it as the same static contents that I’m selecting when using “$(CurText)” (i.e. 111, 222, 333, as described above), so this might be an important clue to reproduce and solve this too.

In my original (non-PoC) use-case where I discovered this behavior, the cursor just freezes completely instead and becomes impossible to move at all, but I guess it depends on the input behavior of the external tool program that is running. It seems like somehow the input of the running program is mixed together with the actions performed in the document anyway, which does indeed seem like some kind of bug, or at least a problem for the user.