mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 17:08:21 +00:00
fix filetree content not showing tabs (fixes #874)
This commit is contained in:
parent
e500302b8b
commit
6524af65a1
4 changed files with 17 additions and 6 deletions
|
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## Fixed
|
||||
- fix commit msg being broken inside tag list ([#871](https://github.com/extrawurst/gitui/issues/871))
|
||||
- fix filetree file content not showing tabs correctly ([#874](https://github.com/extrawurst/gitui/issues/874))
|
||||
|
||||
## [0.17.0] - 2021-08-21
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ use super::{
|
|||
Direction, DrawableComponent, ScrollType,
|
||||
};
|
||||
use crate::{
|
||||
components::{CommandInfo, Component, EventState},
|
||||
components::{
|
||||
tabs_to_spaces, CommandInfo, Component, EventState,
|
||||
},
|
||||
keys::SharedKeyConfig,
|
||||
queue::{Action, InternalEvent, NeedsUpdate, Queue, ResetItem},
|
||||
strings, try_or_popup,
|
||||
|
|
@ -425,13 +427,11 @@ impl DiffComponent {
|
|||
// weird eof missing eol line
|
||||
format!("{}\n", trimmed)
|
||||
};
|
||||
//TODO: allow customize tabsize
|
||||
let content = Cow::from(filled.replace("\t", " "));
|
||||
|
||||
Spans::from(vec![
|
||||
left_side_of_line,
|
||||
Span::styled(
|
||||
content,
|
||||
Cow::from(tabs_to_spaces(filled)),
|
||||
theme.diff_line(line.line_type, selected),
|
||||
),
|
||||
])
|
||||
|
|
|
|||
|
|
@ -312,3 +312,12 @@ where
|
|||
.alignment(Alignment::Left)
|
||||
.wrap(Wrap { trim: true })
|
||||
}
|
||||
|
||||
//TODO: allow customize tabsize
|
||||
pub fn tabs_to_spaces(input: String) -> String {
|
||||
if input.contains('\t') {
|
||||
input.replace("\t", " ")
|
||||
} else {
|
||||
input
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use super::{
|
||||
CommandBlocking, CommandInfo, Component, DrawableComponent,
|
||||
EventState,
|
||||
tabs_to_spaces, CommandBlocking, CommandInfo, Component,
|
||||
DrawableComponent, EventState,
|
||||
};
|
||||
use crate::{
|
||||
keys::SharedKeyConfig,
|
||||
|
|
@ -104,6 +104,7 @@ impl SyntaxTextComponent {
|
|||
//TODO: fetch file content async aswell
|
||||
match sync::tree_file_content(CWD, item) {
|
||||
Ok(content) => {
|
||||
let content = tabs_to_spaces(content);
|
||||
self.async_highlighting.spawn(
|
||||
AsyncSyntaxJob::new(
|
||||
content.clone(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue