PyDev has a 'Mark Occurrences' that I find useful.  However, I realized that it does not work when I use vi keystrokes (h,j,k,l) to move the cursor (I am using a vi-emulator plugin, and there are several vi and emacs plugins out there).  The mark occurrences feature works only when I use arrow keys or the mouse to move the cursor, and this strange behavior has been noted before me as well.  I wondered why, so I took a look into the code and found the logic in PyEdit.java:

       public void keyReleased(KeyEvent e) {
            if (e.character == '\0') {

                switch (e.keyCode) {
                    case SWT.ARROW_DOWN:
                    case SWT.ARROW_UP:
                    case SWT.ARROW_LEFT:
                    case SWT.ARROW_RIGHT:
                    case SWT.HOME:
                    case SWT.END:
                    case SWT.PAGE_UP:
                    case SWT.PAGE_DOWN:
                        int offset = getOffset();
                        if (offset != lastOffset) {
                            lastOffset = offset;

In the code, to the best of my knowledge, {notifyCursorPositionChanged} is the part that eventually triggers mark occurrences.  As the above logic filters for arrow keys and several others, obviously vi movement keys never make to the {notifyCursorPositionChanged}.

Now, this is not strictly a bug as PyDev works fine.  However, it makes me wonder why there is that keycode switch logic in the first place.  The {if (offset != lastOffset) } conditional already and correctly tests whether the cursor position has changed.  And this condition alone should be enough to trigger notifyCursorPositionChanged().  I simply do not understand the reason behind switch logic filter.

So, my question is, could we get rid of the switch logic completely and use the if conditional alone?  This would coincidentally solve my problem :) Please feel free to provide opinions -- this is my first time looking at the pydev source code, and I will be happy to be enlightened.

Best Regards,