-
Notifications
You must be signed in to change notification settings - Fork 8
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
Move last pasted item to the top of the drop down list #7
base: master
Are you sure you want to change the base?
Move last pasted item to the top of the drop down list #7
Conversation
textInserter.insert(activeEditor.selection.start, text); // Insert text from list | ||
|
||
// Move the last pasted item to the top of the list. | ||
clipboardArray.push(clipboardArray.splice(clipboardArray.indexOf(text), 1)[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we also need to remove the item from the array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are only moving the element to the top of the array. I don't understand what @heldersepu refers to. Can you be more specific please? Thanks,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hamparawa I might be confused...
I don't see where you move clipboardArray.push
only adds, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never mind I just noticed the nested splice
...
it looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Push does the addition. But before that the array is spliced on the index of the text. (which effectively remove the element). This is a usual way of moving an element to the back of an array.
@aefernandes Is this project still being maintained? |
This PR attempts to fix the issue #5