Skip to content

Commit

Permalink
Merge pull request #448 from CryZe/split-columns-segment-time-formatter
Browse files Browse the repository at this point in the history
Use `SegmentTime` Formatter for Segment Time Columns
  • Loading branch information
CryZe authored Oct 1, 2021
2 parents 54cdd3d + 9eb4966 commit 1209a3b
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 66 deletions.
14 changes: 7 additions & 7 deletions src/component/splits/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl Clear for ColumnState {
enum ColumnFormatter {
Time,
Delta,
PossibleTimeSave,
SegmentTime,
}

pub fn update_state(
Expand Down Expand Up @@ -184,12 +184,12 @@ pub fn update_state(
method,
),
SemanticColor::Default,
ColumnFormatter::Time,
ColumnFormatter::SegmentTime,
),
ColumnStartWith::PossibleTimeSave => (
possible_time_save::calculate(timer, segment_index, comparison, false),
SemanticColor::Default,
ColumnFormatter::PossibleTimeSave,
ColumnFormatter::SegmentTime,
),
},
false,
Expand All @@ -209,7 +209,7 @@ pub fn update_state(
"{}",
Delta::with_decimal_dropping().format(column_value)
),
ColumnFormatter::PossibleTimeSave => {
ColumnFormatter::SegmentTime => {
write!(state.value, "{}", SegmentTime::new().format(column_value))
}
};
Expand Down Expand Up @@ -302,20 +302,20 @@ fn column_update_value(
(SegmentTime, false) => (
analysis::previous_segment_time(timer, segment_index, method),
SemanticColor::Default,
ColumnFormatter::Time,
ColumnFormatter::SegmentTime,
),
(SegmentTime, true) => (
analysis::live_segment_time(timer, segment_index, method),
SemanticColor::Default,
ColumnFormatter::Time,
ColumnFormatter::SegmentTime,
),

(SegmentDelta | SegmentDeltaWithFallback, false) => {
let delta = analysis::previous_segment_delta(timer, segment_index, comparison, method);
let (value, formatter) = if delta.is_none() && column.update_with.has_fallback() {
(
analysis::previous_segment_time(timer, segment_index, method),
ColumnFormatter::Time,
ColumnFormatter::SegmentTime,
)
} else {
(delta, ColumnFormatter::Delta)
Expand Down
Loading

0 comments on commit 1209a3b

Please sign in to comment.