Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
John Giorshev committed Jul 2, 2024
1 parent dce17be commit 9d7dae6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/choose.bash
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ch_hist() {
}

ch_branch() {
local branch="$(git branch | grep -i -- "$*" | choose -re --tui-select '^\*' --sub '^[ *] ' '' --sort-reverse --delimit-not-at-end -p 'git switch')"
local branch="$(git branch | grep -i -- "$*" | choose -re --tui-select '^\*' --sub '^[ *] ' '' --sort-reverse --delimit-not-at-end -p 'swap branch')"
if [ -n "$branch" ]; then
git checkout "$branch"
fi
Expand Down
11 changes: 9 additions & 2 deletions src/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,15 @@ struct choose_output {
} else {
const choose::CreateTokensResult& first = std::get<choose::CreateTokensResult>(o);
const choose::CreateTokensResult& second = std::get<choose::CreateTokensResult>(other.o);
return first.initial_selected_token->buffer == second.initial_selected_token->buffer && //
std::equal(first.tokens.begin(), first.tokens.end(), second.tokens.begin(), second.tokens.end(), [](const choose::Token& lhs, const choose::Token& rhs) -> bool { //
if (first.initial_selected_token.has_value() != second.initial_selected_token.has_value()) {
return false;
}
if (first.initial_selected_token.has_value()) {
if (first.initial_selected_token->buffer != second.initial_selected_token->buffer) {
return false;
}
}
return std::equal(first.tokens.begin(), first.tokens.end(), second.tokens.begin(), second.tokens.end(), [](const choose::Token& lhs, const choose::Token& rhs) -> bool { //
return lhs.buffer == rhs.buffer;
});
}
Expand Down

0 comments on commit 9d7dae6

Please sign in to comment.