Skip to content
Merged
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
21 changes: 21 additions & 0 deletions capi/src/run_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,27 @@ pub extern "C" fn RunEditor_select_segment_group(this: &mut RunEditor, group_ind
this.select_segment_group(group_index).is_ok()
}

/// Toggles the native segment group with the provided index as part of the
/// current selection without clearing other selected rows. Returns <FALSE> if
/// the group doesn't exist.
#[unsafe(no_mangle)]
pub extern "C" fn RunEditor_toggle_segment_group_selection(
this: &mut RunEditor,
group_index: usize,
) -> bool {
this.toggle_segment_group_selection(group_index).is_ok()
}

/// Extends the current selection through the entire native segment group with
/// the provided index. Returns <FALSE> if the group doesn't exist.
#[unsafe(no_mangle)]
pub extern "C" fn RunEditor_select_segment_group_range(
this: &mut RunEditor,
group_index: usize,
) -> bool {
this.select_segment_group_range(group_index).is_ok()
}

/// Removes the selected native segment groups, while keeping all segments.
#[unsafe(no_mangle)]
pub extern "C" fn RunEditor_remove_selected_segment_groups(this: &mut RunEditor) -> bool {
Expand Down
12 changes: 5 additions & 7 deletions capi/src/splits_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,12 @@ pub extern "C" fn SplitsComponent_set_always_show_last_split(
this.settings_mut().always_show_last_split = always_show_last_split;
}

/// If the last segment is to always be shown, this determines whether to
/// show a more pronounced separator in front of the last segment, if it is
/// not directly adjacent to the segment shown right before it in the
/// scrolling window.
/// Whether to show a pronounced separator before a row when one or more rows
/// immediately before it are omitted from the scrolling window.
#[unsafe(no_mangle)]
pub extern "C" fn SplitsComponent_set_separator_last_split(
pub extern "C" fn SplitsComponent_set_show_gap_separators(
this: &mut SplitsComponent,
separator_last_split: bool,
show_gap_separators: bool,
) {
this.settings_mut().separator_last_split = separator_last_split;
this.settings_mut().show_gap_separators = show_gap_separators;
}
32 changes: 13 additions & 19 deletions src/component/splits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ pub struct Settings {
/// Specifies whether thin separators should be shown between the individual
/// segments shown by the component.
pub show_thin_separators: bool,
/// If the last segment is to always be shown, this determines whether to
/// show a more pronounced separator in front of the last segment, if it is
/// not directly adjacent to the segment shown right before it in the
/// scrolling window.
pub separator_last_split: bool,
/// Whether to show a pronounced separator before a row when one or more
/// rows immediately before it are omitted from the scrolling window.
#[serde(alias = "separator_last_split")]
pub show_gap_separators: bool,
/// If not every segment is shown in the scrolling window of segments, then
/// this determines whether the final segment is always to be shown, as it
/// contains valuable information about the total duration of the chosen
Expand Down Expand Up @@ -250,7 +249,7 @@ impl Settings {
visual_split_count: 16,
split_preview_count: 1,
show_thin_separators: true,
separator_last_split: true,
show_gap_separators: true,
always_show_last_split: true,
fill_with_blank_space: true,
display_two_rows: false,
Expand Down Expand Up @@ -508,15 +507,12 @@ impl Component {
// A gap between projected row indices means that the scrolling
// window omitted one or more logical rows. Communicate that gap on
// the following row so every renderer can show the same pronounced
// separator without reconstructing the scrolling logic. The
// existing setting continues to control gaps before the final row;
// gaps within the list always identify hidden group content.
// separator without reconstructing the scrolling logic. Apply the
// setting here, where all omissions are known, so it consistently
// controls gaps inside groups and before the locked final row.
let has_gap = previous_displayed_index
.is_some_and(|previous_index| displayed_index > previous_index + 1);
let is_final_row = displayed_index + 1 == displayed_len;
state.show_separator_before = has_gap
&& (!is_final_row
|| (always_show_last_split && self.settings.separator_last_split));
state.show_separator_before = self.settings.show_gap_separators && has_gap;
previous_displayed_index = Some(displayed_index);

state.icon = *image_cache
Expand Down Expand Up @@ -647,13 +643,11 @@ impl Component {
self.settings.show_thin_separators.into(),
),
Field::new(
Text::SplitsShowSeparatorBeforeLastSplit
Text::SplitsShowGapSeparators.resolve(lang).into(),
Text::SplitsShowGapSeparatorsDescription
.resolve(lang)
.into(),
Text::SplitsShowSeparatorBeforeLastSplitDescription
.resolve(lang)
.into(),
self.settings.separator_last_split.into(),
self.settings.show_gap_separators.into(),
),
Field::new(
Text::SplitsAlwaysShowLastSplit.resolve(lang).into(),
Expand Down Expand Up @@ -820,7 +814,7 @@ impl Component {
1 => self.settings.visual_split_count = value.into_uint().unwrap() as _,
2 => self.settings.split_preview_count = value.into_uint().unwrap() as _,
3 => self.settings.show_thin_separators = value.into(),
4 => self.settings.separator_last_split = value.into(),
4 => self.settings.show_gap_separators = value.into(),
5 => self.settings.always_show_last_split = value.into(),
6 => self.settings.fill_with_blank_space = value.into(),
7 => self.settings.display_two_rows = value.into(),
Expand Down
25 changes: 25 additions & 0 deletions src/component/splits/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,31 @@ fn current_group_header_stays_visible_when_group_rows_scroll() {
.collect::<Vec<_>>(),
[false, true, false, true]
);

component.settings_mut().show_gap_separators = false;
let state = component.state(
&mut image_cache,
&timer.snapshot(),
&Default::default(),
Lang::English,
);
assert!(
state
.splits
.iter()
.all(|split| !split.show_separator_before)
);
}

#[test]
fn old_last_split_separator_setting_deserializes_as_gap_separators() {
let settings: Settings =
serde_json::from_value(serde_json::json!({ "separator_last_split": false })).unwrap();
assert!(!settings.show_gap_separators);

let serialized = serde_json::to_value(settings).unwrap();
assert_eq!(serialized["show_gap_separators"], false);
assert!(serialized.get("separator_last_split").is_none());
}

#[test]
Expand Down
5 changes: 4 additions & 1 deletion src/layout/parser/splits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ pub fn settings(reader: &mut Reader, component: &mut Component) -> Result<()> {
}
"ShowBlankSplits" => parse_bool(reader, |b| settings.fill_with_blank_space = b),
"SeparatorLastSplit" => {
parse_bool(reader, |b| settings.separator_last_split = b)
// LiveSplit's XML format still uses the historical
// name. Map it to the generalized setting while keeping
// that external format backwards compatible.
parse_bool(reader, |b| settings.show_gap_separators = b)
}
"Display2Rows" => parse_bool(reader, |b| settings.display_two_rows = b),
"ShowColumnLabels" => parse_bool(reader, |b| settings.show_column_labels = b),
Expand Down
6 changes: 3 additions & 3 deletions src/localization/brazilian_portuguese.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ pub const fn resolve(text: Text) -> &'static str {
Text::SplitsShowThinSeparatorsDescription => {
"Indica se separadores finos devem ser mostrados entre as linhas de segmentos."
}
Text::SplitsShowSeparatorBeforeLastSplit => "Mostrar separador antes do último split",
Text::SplitsShowSeparatorBeforeLastSplitDescription => {
"Se o último segmento for sempre mostrado, isto determina se mostrar um separador mais pronunciado antes do último segmento, caso não seja adjacente ao segmento anterior na janela."
Text::SplitsShowGapSeparators => "Mostrar separadores de lacunas",
Text::SplitsShowGapSeparatorsDescription => {
"Determina se um separador mais destacado deve ser exibido antes de uma linha quando uma ou mais linhas imediatamente anteriores são omitidas da janela de rolagem."
}
Text::SplitsAlwaysShowLastSplit => "Mostrar sempre o último split",
Text::SplitsAlwaysShowLastSplitDescription => {
Expand Down
6 changes: 3 additions & 3 deletions src/localization/chinese_simplified.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ pub const fn resolve(text: Text) -> &'static str {
}
Text::SplitsShowThinSeparators => "显示细分隔线",
Text::SplitsShowThinSeparatorsDescription => "指定是否在分段行之间显示细分隔线。",
Text::SplitsShowSeparatorBeforeLastSplit => "在最后一段前显示分隔线",
Text::SplitsShowSeparatorBeforeLastSplitDescription => {
"若最后一段始终显示,则当其不与上一段相邻时,是否在其前显示更明显的分隔线。"
Text::SplitsShowGapSeparators => "显示省略行分隔线",
Text::SplitsShowGapSeparatorsDescription => {
"指定当滚动窗口中紧邻的一行或多行被省略时,是否在下一行前显示更明显的分隔线。"
}
Text::SplitsAlwaysShowLastSplit => "始终显示最后一段",
Text::SplitsAlwaysShowLastSplitDescription => {
Expand Down
6 changes: 3 additions & 3 deletions src/localization/dutch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ pub const fn resolve(text: Text) -> &'static str {
Text::SplitsShowThinSeparatorsDescription => {
"Geeft aan of dunne scheiders tussen segmentrijen moeten worden getoond."
}
Text::SplitsShowSeparatorBeforeLastSplit => "Scheider voor laatste split tonen",
Text::SplitsShowSeparatorBeforeLastSplitDescription => {
"Als het laatste segment altijd wordt getoond, bepaalt dit of een duidelijke scheider vóór het laatste segment wordt getoond wanneer het niet direct aansluit op het vorige segment in het venster."
Text::SplitsShowGapSeparators => "Scheiders bij overgeslagen rijen tonen",
Text::SplitsShowGapSeparatorsDescription => {
"Bepaalt of een duidelijkere scheider vóór een rij wordt getoond wanneer één of meer direct voorafgaande rijen uit het scrollvenster zijn weggelaten."
}
Text::SplitsAlwaysShowLastSplit => "Laatste split altijd tonen",
Text::SplitsAlwaysShowLastSplitDescription => {
Expand Down
6 changes: 3 additions & 3 deletions src/localization/english.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,9 @@ pub const fn resolve(text: Text) -> &'static str {
Text::SplitsShowThinSeparatorsDescription => {
"Specifies whether thin separators should be shown between the individual segment rows."
}
Text::SplitsShowSeparatorBeforeLastSplit => "Show Separator Before Last Split",
Text::SplitsShowSeparatorBeforeLastSplitDescription => {
"If the last segment is to always be shown, this determines whether to show a more pronounced separator in front of the last segment, if it is not directly adjacent to the segment shown right before it in the scrolling window."
Text::SplitsShowGapSeparators => "Show Gap Separators",
Text::SplitsShowGapSeparatorsDescription => {
"Whether to show a pronounced separator before a row when one or more rows immediately before it are omitted from the scrolling window."
}
Text::SplitsAlwaysShowLastSplit => "Always Show Last Split",
Text::SplitsAlwaysShowLastSplitDescription => {
Expand Down
6 changes: 3 additions & 3 deletions src/localization/french.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,9 @@ pub const fn resolve(text: Text) -> &'static str {
Text::SplitsShowThinSeparatorsDescription => {
"Indique si des séparateurs fins doivent être affichés entre les lignes de segments."
}
Text::SplitsShowSeparatorBeforeLastSplit => "Afficher un séparateur avant le dernier split",
Text::SplitsShowSeparatorBeforeLastSplitDescription => {
"Si le dernier segment est toujours affiché, indique si un séparateur plus prononcé doit être montré avant lui lorsqu’il n’est pas adjacent au segment précédent."
Text::SplitsShowGapSeparators => "Afficher les séparateurs d’écart",
Text::SplitsShowGapSeparatorsDescription => {
"Indique si un séparateur plus prononcé doit être affiché avant une ligne lorsqu’une ou plusieurs lignes juste avant sont omises de la fenêtre de défilement."
}
Text::SplitsAlwaysShowLastSplit => "Toujours afficher le dernier split",
Text::SplitsAlwaysShowLastSplitDescription => {
Expand Down
6 changes: 3 additions & 3 deletions src/localization/german.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,9 @@ pub const fn resolve(text: Text) -> &'static str {
Text::SplitsShowThinSeparatorsDescription => {
"Legt fest, ob dünne Trennlinien zwischen den einzelnen Segmentzeilen angezeigt werden."
}
Text::SplitsShowSeparatorBeforeLastSplit => "Trennlinie vor letztem Split anzeigen",
Text::SplitsShowSeparatorBeforeLastSplitDescription => {
"Wenn das letzte Segment immer angezeigt werden soll, bestimmt dies, ob vor dem letzten Segment eine deutlichere Trennlinie angezeigt wird, wenn es im Scrollfenster nicht direkt neben dem vorherigen Segment liegt."
Text::SplitsShowGapSeparators => "Trennlinien bei Lücken anzeigen",
Text::SplitsShowGapSeparatorsDescription => {
"Legt fest, ob vor einer Zeile eine deutlichere Trennlinie angezeigt wird, wenn im Scrollfenster unmittelbar davor eine oder mehrere Zeilen ausgelassen werden."
}
Text::SplitsAlwaysShowLastSplit => "Letzten Split immer anzeigen",
Text::SplitsAlwaysShowLastSplitDescription => {
Expand Down
6 changes: 3 additions & 3 deletions src/localization/italian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ pub const fn resolve(text: Text) -> &'static str {
Text::SplitsShowThinSeparatorsDescription => {
"Indica se mostrare separatori sottili tra le righe dei segmenti."
}
Text::SplitsShowSeparatorBeforeLastSplit => "Mostra separatore prima dell’ultimo split",
Text::SplitsShowSeparatorBeforeLastSplitDescription => {
"Se l’ultimo segmento deve essere sempre mostrato, questa opzione determina se mostrare un separatore più marcato prima dell’ultimo segmento quando non è adiacente al precedente nella finestra scorrevole."
Text::SplitsShowGapSeparators => "Mostra separatori per le righe omesse",
Text::SplitsShowGapSeparatorsDescription => {
"Determina se mostrare un separatore più marcato prima di una riga quando una o più righe immediatamente precedenti sono omesse dalla finestra scorrevole."
}
Text::SplitsAlwaysShowLastSplit => "Mostra sempre l’ultimo split",
Text::SplitsAlwaysShowLastSplitDescription => {
Expand Down
6 changes: 3 additions & 3 deletions src/localization/japanese.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ pub const fn resolve(text: Text) -> &'static str {
}
Text::SplitsShowThinSeparators => "細い区切り線を表示",
Text::SplitsShowThinSeparatorsDescription => "区間の間に細い区切り線を表示するかどうか。",
Text::SplitsShowSeparatorBeforeLastSplit => "最後のスプリット前の区切り線を表示",
Text::SplitsShowSeparatorBeforeLastSplitDescription => {
"最後の区間を常に表示する場合、スクロール窓で直前の区間と隣接しないときに強調区切り線を表示するかどうかを指定します。"
Text::SplitsShowGapSeparators => "省略箇所の区切り線を表示",
Text::SplitsShowGapSeparatorsDescription => {
"スクロール窓で直前の1行以上が省略されている場合、その次の行の前に強調区切り線を表示するかどうかを指定します。"
}
Text::SplitsAlwaysShowLastSplit => "最後のスプリットを常に表示",
Text::SplitsAlwaysShowLastSplitDescription => {
Expand Down
6 changes: 3 additions & 3 deletions src/localization/korean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,9 @@ pub const fn resolve(text: Text) -> &'static str {
Text::SplitsShowThinSeparatorsDescription => {
"세그먼트 행 사이에 얇은 구분선을 표시할지 지정합니다."
}
Text::SplitsShowSeparatorBeforeLastSplit => "마지막 스플릿 앞 구분선 표시",
Text::SplitsShowSeparatorBeforeLastSplitDescription => {
"마지막 세그먼트를 항상 표시하는 경우, 스크롤 창에서 바로 앞 세그먼트와 인접하지 않을 때 더 두드러진 구분선을 표시할지 지정합니다."
Text::SplitsShowGapSeparators => "생략 구간 구분선 표시",
Text::SplitsShowGapSeparatorsDescription => {
"스크롤 창에서 바로 앞의 한 개 이상의 행이 생략된 경우 다음 행 앞에 더 두드러진 구분선을 표시할지 지정합니다."
}
Text::SplitsAlwaysShowLastSplit => "마지막 스플릿 항상 표시",
Text::SplitsAlwaysShowLastSplitDescription => {
Expand Down
4 changes: 2 additions & 2 deletions src/localization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,8 @@ pub(crate) enum Text {
SplitsUpcomingSegmentsDescription,
SplitsShowThinSeparators,
SplitsShowThinSeparatorsDescription,
SplitsShowSeparatorBeforeLastSplit,
SplitsShowSeparatorBeforeLastSplitDescription,
SplitsShowGapSeparators,
SplitsShowGapSeparatorsDescription,
SplitsAlwaysShowLastSplit,
SplitsAlwaysShowLastSplitDescription,
SplitsFillWithBlankSpace,
Expand Down
6 changes: 3 additions & 3 deletions src/localization/polish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,9 @@ pub const fn resolve(text: Text) -> &'static str {
Text::SplitsShowThinSeparatorsDescription => {
"Określa, czy wyświetlać cienkie separatory pomiędzy poszczególnymi wierszami segmentów."
}
Text::SplitsShowSeparatorBeforeLastSplit => "Pokaż separator przed ostatnim splitem",
Text::SplitsShowSeparatorBeforeLastSplitDescription => {
"Jeśli ostatni segment ma być zawsze widoczny, to określa, czy pokazywać bardziej wyraźny separator przed ostatnim segmentem, jeśli nie sąsiaduje bezpośrednio z poprzednim segmentem w oknie przewijania."
Text::SplitsShowGapSeparators => "Pokaż separatory luk",
Text::SplitsShowGapSeparatorsDescription => {
"Określa, czy przed wierszem pokazywać bardziej wyraźny separator, gdy w oknie przewijania pominięto co najmniej jeden bezpośrednio poprzedzający wiersz."
}
Text::SplitsAlwaysShowLastSplit => "Zawsze pokazuj ostatni split",
Text::SplitsAlwaysShowLastSplitDescription => {
Expand Down
6 changes: 3 additions & 3 deletions src/localization/portuguese.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ pub const fn resolve(text: Text) -> &'static str {
Text::SplitsShowThinSeparatorsDescription => {
"Indica se separadores finos devem ser mostrados entre as linhas de segmentos."
}
Text::SplitsShowSeparatorBeforeLastSplit => "Mostrar separador antes do último split",
Text::SplitsShowSeparatorBeforeLastSplitDescription => {
"Se o último segmento for sempre mostrado, isto determina se mostrar um separador mais pronunciado antes do último segmento, caso não seja adjacente ao segmento anterior na janela."
Text::SplitsShowGapSeparators => "Mostrar separadores de lacunas",
Text::SplitsShowGapSeparatorsDescription => {
"Determina se deve ser mostrado um separador mais pronunciado antes de uma linha quando uma ou mais linhas imediatamente anteriores são omitidas da janela de deslocamento."
}
Text::SplitsAlwaysShowLastSplit => "Mostrar sempre o último split",
Text::SplitsAlwaysShowLastSplitDescription => {
Expand Down
Loading
Loading