git_ui: Branch picker improvements (#26287)
- Truncate branch names based on the width of the picker - Use a footer for "Create branch" instead of a picker entry Still to do: - [x] Select the footer button when no matches and run the create logic on `enter` - [x] Make it possible to quickly select the footer button from the keyboard when there are matches Release Notes: - Git Beta: Removed limitation that made it impossible to create a branch from the branch picker when it too closely resembled an existing branch name
This commit is contained in:
parent
ed52e759d7
commit
013a646799
13 changed files with 184 additions and 120 deletions
|
@ -636,7 +636,7 @@ impl GitStore {
|
|||
|
||||
repository_handle
|
||||
.update(&mut cx, |repository_handle, _| {
|
||||
repository_handle.create_branch(branch_name)
|
||||
repository_handle.create_branch(&branch_name)
|
||||
})?
|
||||
.await??;
|
||||
|
||||
|
@ -656,7 +656,7 @@ impl GitStore {
|
|||
|
||||
repository_handle
|
||||
.update(&mut cx, |repository_handle, _| {
|
||||
repository_handle.change_branch(branch_name)
|
||||
repository_handle.change_branch(&branch_name)
|
||||
})?
|
||||
.await??;
|
||||
|
||||
|
@ -1695,7 +1695,8 @@ impl Repository {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn create_branch(&self, branch_name: String) -> oneshot::Receiver<Result<()>> {
|
||||
pub fn create_branch(&self, branch_name: &str) -> oneshot::Receiver<Result<()>> {
|
||||
let branch_name = branch_name.to_owned();
|
||||
self.send_job(|repo| async move {
|
||||
match repo {
|
||||
GitRepo::Local(git_repository) => git_repository.create_branch(&branch_name),
|
||||
|
@ -1720,7 +1721,8 @@ impl Repository {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn change_branch(&self, branch_name: String) -> oneshot::Receiver<Result<()>> {
|
||||
pub fn change_branch(&self, branch_name: &str) -> oneshot::Receiver<Result<()>> {
|
||||
let branch_name = branch_name.to_owned();
|
||||
self.send_job(|repo| async move {
|
||||
match repo {
|
||||
GitRepo::Local(git_repository) => git_repository.change_branch(&branch_name),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue