Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* crash when opening submodule ([#2895](https://github.com/gitui-org/gitui/issues/2895))
* when staging the last file in a directory, the first item after the directory is no longer skipped [[@Tillerino](https://github.com/Tillerino)] ([#2748](https://github.com/gitui-org/gitui/issues/2748))
* index-out-of-bounds panic when unstaging lines near the end of a diff ([#2953](https://github.com/gitui-org/gitui/issues/2953))
* tabs in commit messages are rendered as spaces instead of being dropped or garbling the commit list and details view [[@costajohnt](https://github.com/costajohnt)] ([#3036](https://github.com/gitui-org/gitui/issues/3036))

## [0.28.1] - 2026-03-21

Expand Down
5 changes: 4 additions & 1 deletion src/components/commit_details/compare_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::{
CommandBlocking, CommandInfo, Component, DrawableComponent,
EventState,
},
string_utils::tabs_to_spaces,
strings::{self},
ui::style::SharedTheme,
};
Expand Down Expand Up @@ -88,7 +89,9 @@ impl CompareDetailsComponent {
Cow::from(
data.message
.as_ref()
.map(|msg| msg.subject.clone())
.map(|msg| {
tabs_to_spaces(msg.subject.clone())
})
.unwrap_or_default(),
),
self.theme.text(true, false),
Expand Down
17 changes: 15 additions & 2 deletions src/components/commit_details/details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{
EventState, ScrollType,
},
keys::{key_match, SharedKeyConfig},
string_utils::tabs_to_spaces,
strings::{self, order},
ui::style::SharedTheme,
};
Expand Down Expand Up @@ -81,15 +82,17 @@ impl DetailsComponent {
width: usize,
) -> WrappedCommitMessage<'_> {
let width = width.max(1);
let wrapped_title = bwrap::wrap!(&message.subject, width)
let subject = tabs_to_spaces(message.subject.clone());
let wrapped_title = bwrap::wrap!(&subject, width)
.lines()
.map(String::from)
.map(Cow::from)
.collect();

if let Some(ref body) = message.body {
let body = tabs_to_spaces(body.clone());
let wrapped_message: Vec<Cow<'_, str>> =
bwrap::wrap!(body, width)
bwrap::wrap!(&body, width)
.lines()
.map(String::from)
.map(Cow::from)
Expand Down Expand Up @@ -486,6 +489,16 @@ mod tests {
]
);
}

#[test]
fn test_textwrap_tabs() {
let message = CommitMessage::from("subj\tx\n\nPR:\t123");

assert_eq!(
get_wrapped_lines(&message, 50),
vec!["subj x", "", "PR: 123"]
);
}
}

#[cfg(test)]
Expand Down
6 changes: 5 additions & 1 deletion src/components/revision_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{
keys::{key_match, SharedKeyConfig},
popups::{BlameFileOpen, FileRevOpen},
queue::{InternalEvent, Queue, StackablePopupOpen},
string_utils::tabs_to_spaces,
strings::{self, order, symbol},
try_or_popup,
ui::{self, common_nav, style::SharedTheme},
Expand Down Expand Up @@ -357,7 +358,10 @@ impl RevisionFilesComponent {
let _ignore =
write!(title, " {{{}}}", c.id.get_short_string());

c.message.lines().next()
c.message
.lines()
.next()
.map(|m| tabs_to_spaces(m.to_string()))
});

if let Some(message) = message {
Expand Down
3 changes: 2 additions & 1 deletion src/components/utils/logitems.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::string_utils::tabs_to_spaces;
use asyncgit::sync::{CommitId, CommitInfo};
use chrono::{DateTime, Duration, Local, Utc};
use indexmap::IndexSet;
Expand Down Expand Up @@ -41,7 +42,7 @@ impl From<CommitInfo> for LogEntry {
};

let author = c.author;
let msg = c.message;
let msg = tabs_to_spaces(c.message);

// Replace markdown emojis with Unicode equivalent
#[cfg(feature = "ghemoji")]
Expand Down