Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Make arrow-key selection in completion widget "roll over" #5771

Merged

Conversation

jnsebgosselin
Copy link
Member

@jnsebgosselin jnsebgosselin commented Nov 16, 2017

Fixes #5763


What this does:

  • When focus is on the CompletionWidget and the Up arrow key is clicked while already at the top of the list, go to the bottom of the list.
  • When focus is on the CompletionWidget and the Down arrow key is clicked while already at the bottom of the list, return at the top of the list.

rollover_completionlist

- If up arrow and already at the top, go at the last item.
- If down arrow and already at bottom, go at the first item.
@@ -174,7 +174,12 @@ def keyPressEvent(self, event):
elif key in (Qt.Key_Up, Qt.Key_Down, Qt.Key_PageUp, Qt.Key_PageDown,
Qt.Key_Home, Qt.Key_End,
Qt.Key_CapsLock) and not modifier:
QListWidget.keyPressEvent(self, event)
if key == Qt.Key_Up and self.currentRow() == 0:
self.setCurrentRow(self.count()-1)
Copy link
Member

@goanpeca goanpeca Nov 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.setCurrentRow(self.count() - 1) (spaces :-p)

@ccordoba12 ccordoba12 added this to the v4.0beta1 milestone Nov 16, 2017
@ccordoba12 ccordoba12 merged commit 9cc75ad into spyder-ide:master Nov 16, 2017
@jnsebgosselin jnsebgosselin deleted the make_CompletionWidget_rollover branch November 17, 2017 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants