Revision history [back]
Work around needed. How to repeat last command in the debug console, despite there was an 'undo' ?
I have a custom script that I associate with a key shortcut. The script sends the selected commented code to the debug console and runs it. I've been using this script or equivalent since wingide 3, long time! the current script I use is this:
from __future__ import with_statement
import os.path, sys
sys.path += [
os.path.dirname(__file__),
os.path.join(os.path.dirname(__file__), 'third_party.zip'),
]
import wingapi
def comment_evaluate_sel_in_debug_probe(editor=None):
'''
Evaluate a commented selection in debug probe, do `select-more` if no selection.
Suggested key combination: `Ctrl-Alt-D`
'''
if editor is None:
editor = wingapi.gApplication.GetActiveEditor()
assert isinstance(editor, wingapi.CAPIEditor)
wingapi.gApplication.ExecuteCommand('comment-toggle')
wingapi.gApplication.ExecuteCommand('evaluate-sel-in-debug-console')
editor.ExecuteCommand('undo')
This works as intended. However, in the latest version of wingide 10, once the code is executed in the debug console, if I press the up arrow to repeat the last command the code snipped is not there. I have to select it again from the editor and run the script again.
It used to be possible to press the up arrow and get the last piece of code that run in the debug console using this script. Maybe something changed in how the debug console history works? Or is there an alternative way of doing what I want? Maybe different steps in the script that don't require an 'undo' at the end?
Work around needed. How to repeat last command in the debug console, despite there was an 'undo' ?
I have a custom script that I associate with a key shortcut. The script sends the selected commented code to the debug console and runs it. I've been using this script or equivalent since wingide 3, long time! the current script I use is this:
from __future__ import with_statement
import os.path, sys
sys.path += [
os.path.dirname(__file__),
os.path.join(os.path.dirname(__file__), 'third_party.zip'),
]
import wingapi
def comment_evaluate_sel_in_debug_probe(editor=None):
'''
Evaluate a commented selection in debug probe, do `select-more` if no selection.
Suggested key combination: `Ctrl-Alt-D`
'''
if editor is None:import os.path, sys
sys.path += [
os.path.dirname(__file__),
os.path.join(os.path.dirname(__file__), 'third_party.zip'),
]
import wingapi
def comment_evaluate_sel_in_debug_probe(editor=None):
'''
Evaluate a commented selection in debug probe, do `select-more` if no selection.
Suggested key combination: `Ctrl-Alt-D`
'''
if editor is None:
editor = wingapi.gApplication.GetActiveEditor()
assert isinstance(editor, wingapi.CAPIEditor)
wingapi.gApplication.ExecuteCommand('comment-toggle')
wingapi.gApplication.ExecuteCommand('evaluate-sel-in-debug-console')
editor.ExecuteCommand('undo')
editor = wingapi.gApplication.GetActiveEditor()
assert isinstance(editor, wingapi.CAPIEditor)
wingapi.gApplication.ExecuteCommand('comment-toggle')
wingapi.gApplication.ExecuteCommand('evaluate-sel-in-debug-console')
editor.ExecuteCommand('undo')
This works as intended. However, in the latest version of wingide 10, once the code is executed in the debug console, if I press the up arrow to repeat the last command the code snipped is not there. I have to select it again from the editor and run the script again.
It used to be possible to press the up arrow and get the last piece of code that run in the debug console using this script. Maybe something changed in how the debug console history works? Or is there an alternative way of doing what I want? Maybe different steps in the script that don't require an 'undo' at the end?