Skip to content

Commit

Permalink
fix updates after promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
forgottosave committed Nov 9, 2024
1 parent 361654e commit ed5bdf9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 3 additions & 5 deletions src/core/OSTreeTUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ OSTreeTUI::OSTreeTUI (const std::string& repo, const std::vector<std::string> st
* For a general list of To-Dos refer to https://github.com/AP-Sensing/ostree-tui/pull/21
*
* TODO bug fixes:
* > updates (update commit-list when promoting)
* > keyboard functionality (especially in-app navigation)
*/

Expand Down Expand Up @@ -94,12 +93,12 @@ OSTreeTUI::OSTreeTUI (const std::string& repo, const std::vector<std::string> st
return true;
}
// switch through commits
if (event == Event::ArrowUp || event == Event::Character('k')) {
if (event == Event::ArrowUp) {
scrollOffset = std::min(0, scrollOffset + 4);
selectedCommit = -scrollOffset / 4;
return true;
}
if (event == Event::ArrowDown || event == Event::Character('j')) {
if (event == Event::ArrowDown) {
scrollOffset -= 4;
selectedCommit = -scrollOffset / 4;
return true;
Expand Down Expand Up @@ -160,10 +159,9 @@ OSTreeTUI::OSTreeTUI (const std::string& repo, const std::vector<std::string> st
return true;
}
// refresh repository
if (event == Event::AltR || refresh) {
if (event == Event::AltR) {
refresh_repository();
notificationText = " Refreshed Repository Data ";
refresh = false;
return true;
}
// exit
Expand Down
2 changes: 0 additions & 2 deletions src/core/OSTreeTUI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,9 @@ class OSTreeTUI {
// view states
int scrollOffset{0};
bool inPromotionSelection{false};
bool refresh{false};
std::string promotionHash{""};
std::string promotionBranch{""};

private:
// view constants
int logSize{45};
int footerSize{1};
Expand Down
8 changes: 6 additions & 2 deletions src/core/commit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ class CommitComponentImpl : public ComponentBase, public WindowOptions {
ostreetui.ostreeRepo.promoteCommit(hash, ostreetui.promotionBranch, {}, newSubject, true);
resetWindow();
ostreetui.inPromotionSelection = false;
ostreetui.refresh = true;
ostreetui.scrollOffset = 0;
ostreetui.selectedCommit = 0;
ostreetui.screen.PostEvent(Event::AltR);
return true;
}
// cancel
Expand Down Expand Up @@ -336,7 +338,9 @@ class CommitComponentImpl : public ComponentBase, public WindowOptions {
}
ostreetui.ostreeRepo.promoteCommit(hash, ostreetui.promotionBranch, metadataStrings, newSubject, true);
resetWindow();
ostreetui.refresh = true;
ostreetui.scrollOffset = 0;
ostreetui.selectedCommit = 0;
ostreetui.screen.PostEvent(Event::AltR);
}) | color(Color::Green) | flex,
})
});
Expand Down

0 comments on commit ed5bdf9

Please sign in to comment.