Skip to content
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

Conventional Commit Popup #2486

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
18fa349
compiles
tkr-sh Jan 14, 2025
24998b2
wip
tkr-sh Jan 14, 2025
8461184
CodeStyle
tkr-sh Jan 14, 2025
4fe9878
wip
tkr-sh Jan 14, 2025
451d25c
🚧 wip
tkr-sh Jan 15, 2025
6149b73
✨ feat: move cursor to end
tkr-sh Jan 15, 2025
656306d
✨ feat: when 1 possible value => next
tkr-sh Jan 15, 2025
7f01b0a
🐛 fix: when there are no default msg => no `:`
tkr-sh Jan 15, 2025
0da4025
💬 fix: appropriate title for widget
tkr-sh Jan 15, 2025
491bebb
🐛 fix: bad display for selection of commit type
tkr-sh Jan 15, 2025
b112792
✨ feat: use proper char for shortcut char
tkr-sh Jan 15, 2025
637f834
🐛 fix: made shortcuts work
tkr-sh Jan 15, 2025
b79e6cb
🔇 debug: remove logs
tkr-sh Jan 15, 2025
562b210
🐛 fix: close instead of enter
tkr-sh Jan 15, 2025
557bc88
🔇 refactor: remove doc
tkr-sh Jan 15, 2025
d00ffda
✨ feat: filtering on query working
tkr-sh Jan 15, 2025
732e0b9
♻️ ref: make selected lines take 100% width
tkr-sh Jan 15, 2025
ca041d7
✨ feat: add commands indication
tkr-sh Jan 15, 2025
66d3b59
✨ feat: "INSERT" text when in insert mode
tkr-sh Jan 15, 2025
736263e
♻️ refactor: put next_step actions in fn
tkr-sh Jan 15, 2025
d3d75b6
🎨 style: style
tkr-sh Jan 15, 2025
fe22a15
✨ feat: new more_info (Formatted)
tkr-sh Jan 15, 2025
0ee2242
✨ feat!: add breaking changes
tkr-sh Jan 15, 2025
366f08e
♻️ refactor: remove .unwrap()
tkr-sh Jan 15, 2025
580e28f
⚠️ fix: warning / clippy
tkr-sh Jan 15, 2025
96000cb
✨ feat: optional gitmojis
tkr-sh Jan 15, 2025
f811413
✏️ fix: s/Commit emoji/Conventional commit
tkr-sh Jan 15, 2025
a3284e5
🩹 fix: cursor to end
tkr-sh Jan 15, 2025
2d7cc74
🔊 debug: add logs
tkr-sh Jan 15, 2025
20d5a2c
♻️ refactor: add dead_code back
tkr-sh Jan 15, 2025
8d72f28
✏️ fix: s/commit_emoij/conventional_commit
tkr-sh Jan 15, 2025
15ad7d0
✏️ fix: typo
tkr-sh Jan 15, 2025
4c59e63
✏️ fix: typo
tkr-sh Jan 15, 2025
57dc1ae
🏗️ refactor: move "Conventional Commit"
tkr-sh Jan 15, 2025
f1c86d9
📝 docs: move comments to doc ones
tkr-sh Jan 15, 2025
29fbfc9
⚠️ fix: warning
tkr-sh Jan 15, 2025
9645901
🐛 fix: when empty, don't panic with []
tkr-sh Jan 15, 2025
12b2c92
💅 style: fmt
tkr-sh Jan 15, 2025
b4270f5
♻️ refactor: use consts instead of magic &str
tkr-sh Jan 15, 2025
d054086
♻️ refactor: use Borrow<str> instead of &str
tkr-sh Jan 15, 2025
5c92e33
♻️ refactor: rm duplicated code
tkr-sh Jan 15, 2025
ae1af08
🐛 fix: bug when 1 res != open commit
tkr-sh Jan 15, 2025
ae06c25
🩹 fix: remove unused reference
tkr-sh Jan 15, 2025
40f8077
🩹 fix:previously inverted order of commit title
tkr-sh Jan 16, 2025
8465c3f
🐛 fix: clamp max depending on phase
tkr-sh Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ serde = "1.0"
shellexpand = "3.1"
simplelog = { version = "0.12", default-features = false }
struct-patch = "0.8"
strum = "0.26.3"
syntect = { version = "5.2", default-features = false, features = [
"parsing",
"default-syntaxes",
Expand All @@ -76,8 +77,9 @@ chrono = { version = "0.4", default-features = false, features = ["clock"] }
maintenance = { status = "actively-developed" }

[features]
default = ["ghemoji", "regex-fancy", "trace-libgit", "vendor-openssl"]
default = ["ghemoji", "regex-fancy", "trace-libgit", "vendor-openssl", "gitmoji"]
ghemoji = ["gh-emoji"]
gitmoji = []
# regex-* features are mutually exclusive.
regex-fancy = ["syntect/regex-fancy", "two-face/syntect-fancy"]
regex-onig = ["syntect/regex-onig", "two-face/syntect-onig"]
Expand Down
18 changes: 15 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use crate::{
popup_stack::PopupStack,
popups::{
AppOption, BlameFilePopup, BranchListPopup, CommitPopup,
CompareCommitsPopup, ConfirmPopup, CreateBranchPopup,
CreateRemotePopup, ExternalEditorPopup, FetchPopup,
FileRevlogPopup, FuzzyFindPopup, HelpPopup,
CompareCommitsPopup, ConfirmPopup, ConventionalCommitPopup,
CreateBranchPopup, CreateRemotePopup, ExternalEditorPopup,
FetchPopup, FileRevlogPopup, FuzzyFindPopup, HelpPopup,
InspectCommitPopup, LogSearchPopupPopup, MsgPopup,
OptionsPopup, PullPopup, PushPopup, PushTagsPopup,
RemoteListPopup, RenameBranchPopup, RenameRemotePopup,
Expand Down Expand Up @@ -93,6 +93,7 @@ pub struct App {
update_remote_url_popup: UpdateRemoteUrlPopup,
remotes_popup: RemoteListPopup,
rename_branch_popup: RenameBranchPopup,
conventional_commit_popup: ConventionalCommitPopup,
select_branch_popup: BranchListPopup,
options_popup: OptionsPopup,
submodule_popup: SubmodulesListPopup,
Expand Down Expand Up @@ -200,6 +201,9 @@ impl App {
update_remote_url_popup: UpdateRemoteUrlPopup::new(&env),
remotes_popup: RemoteListPopup::new(&env),
rename_branch_popup: RenameBranchPopup::new(&env),
conventional_commit_popup: ConventionalCommitPopup::new(
&env,
),
select_branch_popup: BranchListPopup::new(&env),
tags_popup: TagListPopup::new(&env),
options_popup: OptionsPopup::new(&env),
Expand Down Expand Up @@ -481,6 +485,7 @@ impl App {
msg_popup,
confirm_popup,
commit_popup,
conventional_commit_popup,
blame_file_popup,
file_revlog_popup,
stashmsg_popup,
Expand Down Expand Up @@ -520,6 +525,7 @@ impl App {
stashmsg_popup,
help_popup,
inspect_commit_popup,
conventional_commit_popup,
compare_commits_popup,
blame_file_popup,
file_revlog_popup,
Expand Down Expand Up @@ -738,6 +744,12 @@ impl App {
}
InternalEvent::Update(u) => flags.insert(u),
InternalEvent::OpenCommit => self.commit_popup.show()?,
InternalEvent::AddCommitMessage(s) => {
self.commit_popup.set_msg(s);
}
InternalEvent::OpenConventionalCommit => {
self.conventional_commit_popup.show()?;
}
InternalEvent::RewordCommit(id) => {
self.commit_popup.open(Some(id))?;
}
Expand Down
6 changes: 6 additions & 0 deletions src/components/textinput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ impl TextInputComponent {
}
}

pub fn move_cursor_to_end(&mut self) {
if let Some(ta) = &mut self.textarea {
ta.move_cursor(CursorMove::End);
}
}

///
pub const fn with_input_type(
mut self,
Expand Down
6 changes: 6 additions & 0 deletions src/keys/key_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ pub struct KeysList {
pub quit: GituiKeyEvent,
pub exit_popup: GituiKeyEvent,
pub open_commit: GituiKeyEvent,
pub open_conventional_commit: GituiKeyEvent,
pub open_commit_editor: GituiKeyEvent,
pub breaking: GituiKeyEvent,
pub open_help: GituiKeyEvent,
pub open_options: GituiKeyEvent,
pub move_left: GituiKeyEvent,
Expand Down Expand Up @@ -128,6 +130,7 @@ pub struct KeysList {
pub commit_history_next: GituiKeyEvent,
pub commit: GituiKeyEvent,
pub newline: GituiKeyEvent,
pub insert: GituiKeyEvent,
}

#[rustfmt::skip]
Expand All @@ -146,7 +149,9 @@ impl Default for KeysList {
quit: GituiKeyEvent::new(KeyCode::Char('q'), KeyModifiers::empty()),
exit_popup: GituiKeyEvent::new(KeyCode::Esc, KeyModifiers::empty()),
open_commit: GituiKeyEvent::new(KeyCode::Char('c'), KeyModifiers::empty()),
open_conventional_commit: GituiKeyEvent::new(KeyCode::Char('C'), KeyModifiers::SHIFT),
open_commit_editor: GituiKeyEvent::new(KeyCode::Char('e'), KeyModifiers::CONTROL),
breaking: GituiKeyEvent::new(KeyCode::Char('b'), KeyModifiers::empty()),
open_help: GituiKeyEvent::new(KeyCode::Char('h'), KeyModifiers::empty()),
open_options: GituiKeyEvent::new(KeyCode::Char('o'), KeyModifiers::empty()),
move_left: GituiKeyEvent::new(KeyCode::Left, KeyModifiers::empty()),
Expand Down Expand Up @@ -175,6 +180,7 @@ impl Default for KeysList {
stashing_save: GituiKeyEvent::new(KeyCode::Char('s'), KeyModifiers::empty()),
stashing_toggle_untracked: GituiKeyEvent::new(KeyCode::Char('u'), KeyModifiers::empty()),
stashing_toggle_index: GituiKeyEvent::new(KeyCode::Char('i'), KeyModifiers::empty()),
insert: GituiKeyEvent::new(KeyCode::Char('i'), KeyModifiers::empty()),
stash_apply: GituiKeyEvent::new(KeyCode::Char('a'), KeyModifiers::empty()),
stash_open: GituiKeyEvent::new(KeyCode::Right, KeyModifiers::empty()),
stash_drop: GituiKeyEvent::new(KeyCode::Char('D'), KeyModifiers::SHIFT),
Expand Down
5 changes: 5 additions & 0 deletions src/popups/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ impl CommitPopup {
}
}

pub fn set_msg(&mut self, msg: String) {
self.input.set_text(msg);
self.input.move_cursor_to_end();
}

///
pub fn update(&mut self) {
self.git_branch_name.lookup().ok();
Expand Down
Loading