-
Notifications
You must be signed in to change notification settings - Fork 331
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
Support multi-selection in file lists #1136
Conversation
Shift-click behaviour is not ideal. Failed to simulate shift-click behaviour on Google Drive. Issues: 1. Can't deselect when shift click direction changes Other issues: 1. IStatusFile object equality checking leads to a lot of duplicate codes 2. File status changes is not immediately reflected in FileList state, leading to invalid commands in context menu
…egory (git status)
…a simple click, handle partially staged files for shift clicks
…pply to selected files
@fcollonval |
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.
Thanks a lot @BoscoCHW
I have a couple of suggestions - mainly related to API and algorithm simplification.
On Thursday, I will explain how to create integration tests for this PR.
…e staging selecting all files
…reflect if all files are marked
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.
Thanks
We are almost there. I have made some additional suggestions. And I found a bug. In simple staging mode, when clicking on a file item button the mark status changed (it should not). This can be solved by stopping the event propagation.
Co-authored-by: Frédéric Collonval <[email protected]>
Co-authored-by: Frédéric Collonval <[email protected]>
Co-authored-by: Frédéric Collonval <[email protected]>
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.
Let's add some doc strings then merge 😉
src/components/GitStage.tsx
Outdated
@@ -41,6 +41,8 @@ export interface IGitStageProps { | |||
* Row renderer | |||
*/ | |||
rowRenderer: (props: ListChildComponentProps) => JSX.Element; | |||
|
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.
/** | |
* Optional select all element | |
*/ |
} | ||
}; | ||
|
||
markUntilFile = (file: Git.IStatusFile): void => { |
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.
markUntilFile = (file: Git.IStatusFile): void => { | |
/** | |
* Mark files from the latest selected to this one | |
* | |
* @param file The current clicked-on file | |
*/ | |
markUntilFile = (file: Git.IStatusFile): void => { |
src/components/FileList.tsx
Outdated
* @param file | ||
* @param options |
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.
* @param file | |
* @param options | |
* @param file The current clicked-on file | |
* @param options Selection options |
} | ||
}; | ||
|
||
toggleAllFiles = (files: Git.IStatusFile[]): void => { |
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.
toggleAllFiles = (files: Git.IStatusFile[]): void => { | |
/** | |
* Set mark status from all selected button | |
* | |
* @param files Files to toggle | |
*/ | |
toggleAllFiles = (files: Git.IStatusFile[]): void => { |
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.
Thanks a lot. Let's merge and release 😉
@all-contributors please add @BoscoCHW for code |
I've put up a pull request to add @BoscoCHW! 🎉 |
@all-contributors please add @iflinda for code |
I've put up a pull request to add @iflinda! 🎉 |
Fixes #379
Implement Control- and Shift-Click file selection
Shift-click behaviour is not ideal. Failed to simulate shift-click behaviour on Google Drive.
Issues:
Other issues: