Ask Your Question

forward-definition and backward-definition?

asked 2018-12-30 11:29:00 -0500

updated 2019-03-13 10:25:55 -0500

For many years my custom keybindings have contained bindings for forward-definition and backward-definition. Yet, those editor commands do not exist (v. 6.1), and they are not in any of my scripts files..

I am perplexed, because I shouldn't be able to bind a key to a command that doesn't exist (at least not using the Preferences dialog — I do sometimes edit the preferences file directly, but this doesn't seem like how I would have assigned keys to these particular definitions). Furthermore, as a (very, very) long-time Emacs user, where I use that command often, this is a command I think would use fairly regularly in Wing. (I am using Wing for the first time in quite a while, so I may just be confused or misremembering.) Did they ever exist? Where did they go?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2018-12-30 16:50:00 -0500

I don't see any evidence that they ever existed.  We log any changes to command set in the CHANGELOG.txt file and nothing seems to match this.  It might be that in the past we allowed entering non-existent command names in the prefs dialog or you had a script that implemented this.

edit flag offensive delete link more

answered 2018-12-30 19:26:00 -0500

updated 2019-03-06 22:27:11 -0500

Wingware Admin gravatar image

Well, "they are not in any of my scripts files" is not quite accurate. It wasn't in my version 6 scripts, and it wasn't in my version 5 scripts, but it was in my version 4 scripts!. I have always carried my preferences file over from version to version, so yes, I once had these defined and therefore was able to bind keys to them, so they were left in my preferences file.

I guess I'm wrong about having used this often in Wing, at least not for a very long time. My guess is that instead of trying to use these, I just used select-scope, then forward-character or backward-character to enter a different definition.

The way I had implemented long ago  was contorted and used internal calls that may even exist anymore. Simple definitions that more or less do what I want are:

def backward_definition():
  """ Move backward to the def or class prior to current line"""
  ed = wingapi.gApplication.GetActiveEditor()
  ed.ExecuteCommand('backward-char')           # clear selection

def forward_definition():
  """ Move forward to the def or class following the current line"""
  ed = wingapi.gApplication.GetActiveEditor()
  ed.ExecuteCommand('backward-char')           # clear selection

Is there a cleaner way to clear the selection than just using backward-char?

edit flag offensive delete link more


Using backward-char seems like the right way to do it.

Wingware Support gravatar imageWingware Support ( 2019-01-02 09:37:00 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-12-30 11:29:00 -0500

Seen: 9 times

Last updated: Mar 06