eset/ipyida

Unfocused widget fix

kvnesterov opened this issue · 2 comments

Focus is lost when the ipyida widget is created or hotkey is pressed with existing widget.
Tested on Linux platform with IDA 7.3/IDA 7.4 (Python 3.7)

There is a dirty solution to focus on text area:

diff --git a/ipyida/ida_plugin.py b/ipyida/ida_plugin.py
index 19ca64e..4bccde7 100644
--- a/ipyida/ida_plugin.py
+++ b/ipyida/ida_plugin.py
@@ -29,6 +29,7 @@ class IPyIDAPlugIn(idaapi.plugin_t):
         if self.widget is None:
             self.widget = ida_qtconsole.IPythonConsole(self.kernel.connection_file)
         self.widget.Show()
+        self.widget.ipython_widget.children()[2].setFocus()
 
     def term(self):
         if self.widget:

That's a good idea! I'll try to iterate over ipython_widget.children()s to find the right widget instead of hardcoding the child index.

I made a fix (12e88a8) that will be included in the next release. Pressing <Shift-.> from anywhere seems to always bring to cursor back to the prompt. I didn't realize how annoying it was to have to use the mouse to clic in the prompt after using the keyboard shortcut. Thanks for reporting :)