Skip to content

Commit dc2e8ec

Browse files
committed
✨ feat!: add breaking changes
1 parent 9a12c2c commit dc2e8ec

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/keys/key_list.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ pub struct KeysList {
5151
pub open_commit: GituiKeyEvent,
5252
pub open_conventional_commit: GituiKeyEvent,
5353
pub open_commit_editor: GituiKeyEvent,
54+
pub breaking: GituiKeyEvent,
5455
pub open_help: GituiKeyEvent,
5556
pub open_options: GituiKeyEvent,
5657
pub move_left: GituiKeyEvent,
@@ -150,6 +151,7 @@ impl Default for KeysList {
150151
open_commit: GituiKeyEvent::new(KeyCode::Char('c'), KeyModifiers::empty()),
151152
open_conventional_commit: GituiKeyEvent::new(KeyCode::Char('C'), KeyModifiers::SHIFT),
152153
open_commit_editor: GituiKeyEvent::new(KeyCode::Char('e'), KeyModifiers::CONTROL),
154+
breaking: GituiKeyEvent::new(KeyCode::Char('b'), KeyModifiers::empty()),
153155
open_help: GituiKeyEvent::new(KeyCode::Char('h'), KeyModifiers::empty()),
154156
open_options: GituiKeyEvent::new(KeyCode::Char('o'), KeyModifiers::empty()),
155157
move_left: GituiKeyEvent::new(KeyCode::Left, KeyModifiers::empty()),

src/popups/conventional_commit.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ pub struct ConventionalCommitPopup {
374374
key_config: SharedKeyConfig,
375375
is_visible: bool,
376376
is_insert: bool,
377+
is_breaking: bool,
377378
query: Option<String>,
378379
selected_index: usize,
379380
options: Vec<CommitType>,
@@ -399,6 +400,7 @@ impl ConventionalCommitPopup {
399400
query_results_type: CommitType::iter().collect_vec(),
400401
query_results_more_info: Vec::new(),
401402
is_insert: false,
403+
is_breaking: false,
402404
query: None,
403405
is_visible: false,
404406
key_config: env.key_config.clone(),
@@ -499,6 +501,7 @@ impl ConventionalCommitPopup {
499501
self.key_config.keys.move_down,
500502
self.key_config.keys.move_up,
501503
self.key_config.keys.exit_popup,
504+
self.key_config.keys.breaking,
502505
self.key_config.keys.exit,
503506
self.key_config.keys.insert,
504507
]
@@ -608,7 +611,8 @@ impl ConventionalCommitPopup {
608611
self.queue.push(crate::queue::InternalEvent::OpenCommit);
609612
self.queue.push(
610613
crate::queue::InternalEvent::AddCommitMessage(format!(
611-
"{emoji} {commit_type}{} {short_msg}",
614+
"{emoji} {commit_type}{}{} {short_msg}",
615+
if self.is_breaking { "!" } else { "" },
612616
if short_msg.is_empty() { "" } else { ":" },
613617
)),
614618
);
@@ -646,6 +650,14 @@ impl DrawableComponent for ConventionalCommitPopup {
646650
},
647651
self.theme.title(true),
648652
))
653+
.title(if self.is_breaking {
654+
Span::styled(
655+
"[BREAKING]",
656+
self.theme.title(true),
657+
)
658+
} else {
659+
"".into()
660+
})
649661
.title(if self.is_insert {
650662
Span::styled(
651663
"[INSERT]",
@@ -759,6 +771,11 @@ impl Component for ConventionalCommitPopup {
759771
}
760772
}
761773
}
774+
} else if key_match(
775+
key,
776+
self.key_config.keys.breaking,
777+
) {
778+
self.is_breaking = !self.is_breaking;
762779
} else if key_match(
763780
key,
764781
self.key_config.keys.popup_down,

0 commit comments

Comments
 (0)