From 136f34fbafc781275d6b871faac44ce2b6c4da8a Mon Sep 17 00:00:00 2001 From: routersys Date: Sun, 1 Nov 2026 00:33:55 +0900 Subject: [PATCH] =?UTF-8?q?=E8=AA=AD=E3=81=BF=E5=8F=96=E3=82=8A=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E3=81=AE=E8=A1=A8=E7=A4=BA=E3=82=92=E5=88=B6=E9=99=90?= =?UTF-8?q?=E3=81=8C=E3=81=82=E3=82=8B=E3=81=A8=E3=81=8D=E3=81=A0=E3=81=91?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UndoTree.Tests/UndoTreeViewModelTests.cs | 29 ++++++++++++++++++++++-- UndoTree/Texts.csv | 7 +++--- UndoTree/UndoTreeView.xaml | 2 +- UndoTree/UndoTreeViewModel.cs | 17 +++++++++----- 4 files changed, 42 insertions(+), 13 deletions(-) diff --git a/UndoTree.Tests/UndoTreeViewModelTests.cs b/UndoTree.Tests/UndoTreeViewModelTests.cs index fd98d3e..0ffd10b 100644 --- a/UndoTree.Tests/UndoTreeViewModelTests.cs +++ b/UndoTree.Tests/UndoTreeViewModelTests.cs @@ -271,16 +271,41 @@ public sealed class UndoTreeViewModelTests } [Fact] - public void TheStatusLineShowsTheNodeCountAndTheSource() + public void TheStatusLineShowsOnlyTheNodeCountWhileEverythingWorks() { var (model, manager, document) = Open(); Histories.Edit(manager, () => document.X = 1); - Assert.Equal(string.Format(Texts.StatusLine, 2, Texts.SourceName), model.StatusText); + Assert.Equal(string.Format(Texts.StatusLine, 2), model.StatusText); + Assert.Null(model.StatusToolTip); Assert.True(model.IsSupported); } + [Fact] + public void TheWaysOfReadingThatSupportEverythingAreNotMentioned() + { + Assert.All([UndoRedoHistorySource.Name, UndoRedoHistorySource.Type], source => + { + Assert.Equal(string.Format(Texts.StatusLine, 3), UndoTreeViewModel.StatusTextOf(true, 3, source)); + Assert.Null(UndoTreeViewModel.StatusToolTipOf(true, source)); + }); + } + + [Fact] + public void AMirroredHistoryIsMarkedAsLimitedAndExplainsItself() + { + Assert.Equal(string.Format(Texts.StatusLimited, 3), UndoTreeViewModel.StatusTextOf(true, 3, UndoRedoHistorySource.Events)); + Assert.Equal(Texts.LimitedReason, UndoTreeViewModel.StatusToolTipOf(true, UndoRedoHistorySource.Events)); + } + + [Fact] + public void AnUnreadableHistoryLeavesTheStatusLineToTheNotice() + { + Assert.Empty(UndoTreeViewModel.StatusTextOf(false, 0, null)); + Assert.Null(UndoTreeViewModel.StatusToolTipOf(false, null)); + } + [Fact] public void ASecondViewOfTheSameManagerSharesTheHistory() { diff --git a/UndoTree/Texts.csv b/UndoTree/Texts.csv index 93117f9..215951c 100644 --- a/UndoTree/Texts.csv +++ b/UndoTree/Texts.csv @@ -23,12 +23,11 @@ OperationAndMore,,{0}ほか{1}件,{0} and {1} more,{0} 等另外 {1} 项,{0} 等 Operation,,操作,Operation,操作,操作,작업,Operación,عملية,Operasi UnnamedTarget,,対象,Target,对象,物件,대상,Objetivo,الهدف,Target ListChange,,項目を{0}件追加、{1}件削除,"Items added {0}, removed {1}",添加 {0} 项,删除 {1} 项,新增 {0} 項,刪除 {1} 項,"항목 추가 {0}, 삭제 {1}","Elementos añadidos {0}, eliminados {1}",تمت إضافة {0} وحذف {1},"Item ditambah {0}, dihapus {1}" -SourceName,,名前で読み取り,Read by name,按名称读取,依名稱讀取,이름으로 읽기,Leído por nombre,القراءة بالاسم,Dibaca menurut nama -SourceType,,型で読み取り,Read by type,按类型读取,依型別讀取,형식으로 읽기,Leído por tipo,القراءة بالنوع,Dibaca menurut tipe -SourceEvents,,イベントから複製(ブランチ間の移動とチェリーピックは不可),Mirrored from events (branch moves and cherry-picking are unavailable),从事件复制(无法移动到其他分支或 cherry-pick),從事件複製(無法移動到其他分支或 cherry-pick),이벤트에서 복제 (브랜치 간 이동과 체리픽 불가),Replicado desde eventos (sin cambio de rama ni cherry-pick),منسوخ من الأحداث (لا يمكن الانتقال بين الفروع أو cherry-pick),Disalin dari peristiwa (pindah cabang dan cherry-pick tidak tersedia) Unsupported,,このバージョンのYMM4では履歴を読み取れません。,The history cannot be read in this version of YMM4.,此版本的 YMM4 无法读取历史记录。,此版本的 YMM4 無法讀取歷史記錄。,이 버전의 YMM4에서는 기록을 읽을 수 없습니다.,No se puede leer el historial en esta versión de YMM4.,لا يمكن قراءة السجل في هذا الإصدار من YMM4.,Riwayat tidak dapat dibaca di YMM4 versi ini. BranchUnavailable,,この履歴では、別のブランチへの移動とチェリーピックはできません。,Moving to another branch and cherry-picking are not available for this history.,此历史记录无法移动到其他分支,也无法 cherry-pick。,此歷史記錄無法移動到其他分支,也無法 cherry-pick。,이 기록에서는 다른 브랜치로 이동하거나 체리픽할 수 없습니다.,En este historial no se puede cambiar a otra rama ni usar cherry-pick.,لا يمكن الانتقال إلى فرع آخر أو استخدام cherry-pick في هذا السجل.,Pada riwayat ini tidak dapat berpindah ke cabang lain atau menggunakan cherry-pick. -StatusLine,,{0}件 / {1},{0} entries / {1},{0} 项 / {1},{0} 項 / {1},{0}개 / {1},{0} entradas / {1},{0} إدخال / {1},{0} entri / {1} +StatusLine,,{0}件,{0} entries,{0} 项,{0} 項,{0}개,{0} entradas,{0} إدخال,{0} entri +StatusLimited,,{0}件 / 制限あり,{0} entries / Limited,{0} 项 / 功能受限,{0} 項 / 功能受限,{0}개 / 제한됨,{0} entradas / Limitado,{0} إدخال / وظائف محدودة,{0} entri / Terbatas +LimitedReason,,イベントから履歴を複製しているため、ブランチ間の移動とチェリーピックはできません。,"The history is mirrored from events, so moving between branches and cherry-picking are not available.",由于是从事件复制历史记录,无法在分支之间移动,也无法 cherry-pick。,由於是從事件複製歷史記錄,無法在分支之間移動,也無法 cherry-pick。,이벤트에서 기록을 복제하고 있어 브랜치 간 이동과 체리픽을 할 수 없습니다.,"El historial se replica desde eventos, por lo que no se puede cambiar de rama ni usar cherry-pick.",يتم نسخ السجل من الأحداث، لذلك لا يمكن الانتقال بين الفروع أو استخدام cherry-pick.,"Riwayat disalin dari peristiwa, sehingga tidak dapat berpindah antar cabang atau menggunakan cherry-pick." ConflictDeadTarget,,{0} / {1}: 対象が存在しないためスキップしました,{0} / {1}: skipped because the target no longer exists,{0} / {1}:对象已不存在,已跳过,{0} / {1}:物件已不存在,已略過,{0} / {1}: 대상이 없어 건너뛰었습니다,{0} / {1}: omitido porque el objetivo ya no existe,{0} / {1}: تم التخطي لأن الهدف لم يعد موجودًا,{0} / {1}: dilewati karena target sudah tidak ada ConflictSameSkipped,,{0} / {1}: 現在の位置で既に変更されているためスキップしました,{0} / {1}: skipped because it was already changed here,{0} / {1}:已在当前位置更改,已跳过,{0} / {1}:已在目前位置變更,已略過,{0} / {1}: 현재 위치에서 이미 변경되어 건너뛰었습니다,{0} / {1}: omitido porque ya se modificó aquí,{0} / {1}: تم التخطي لأنه تغيّر هنا بالفعل,{0} / {1}: dilewati karena sudah diubah di sini ConflictSameApplied,,{0} / {1}: 現在の位置で既に変更されていたため、操作の値で上書きしました,"{0} / {1}: already changed here, overwritten with the value of the operation",{0} / {1}:已在当前位置更改,已用该操作的值覆盖,{0} / {1}:已在目前位置變更,已用該操作的值覆蓋,{0} / {1}: 현재 위치에서 이미 변경되어 작업의 값으로 덮어썼습니다,"{0} / {1}: ya se modificó aquí, sobrescrito con el valor de la operación",{0} / {1}: تغيّر هنا بالفعل وتمت الكتابة فوقه بقيمة العملية,"{0} / {1}: sudah diubah di sini, ditimpa dengan nilai operasi" diff --git a/UndoTree/UndoTreeView.xaml b/UndoTree/UndoTreeView.xaml index b6cae21..0aa42fa 100644 --- a/UndoTree/UndoTreeView.xaml +++ b/UndoTree/UndoTreeView.xaml @@ -292,7 +292,7 @@ - + diff --git a/UndoTree/UndoTreeViewModel.cs b/UndoTree/UndoTreeViewModel.cs index 299b279..5407226 100644 --- a/UndoTree/UndoTreeViewModel.cs +++ b/UndoTree/UndoTreeViewModel.cs @@ -35,6 +35,8 @@ internal class UndoTreeViewModel : Bindable, IToolViewModel, ITimelineToolViewMo public string StatusText { get; private set => Set(ref field, value); } = string.Empty; + public string? StatusToolTip { get; private set => Set(ref field, value); } + public string ResultText { get; private set => Set(ref field, value, nameof(ResultText), nameof(HasResult)); } = string.Empty; public bool HasResult => ResultText.Length > 0; @@ -198,14 +200,16 @@ internal class UndoTreeViewModel : Bindable, IToolViewModel, ITimelineToolViewMo return string.Join(Environment.NewLine, lines); } - static string SourceText(UndoRedoHistorySource? source) => source switch + internal static string StatusTextOf(bool isSupported, int count, UndoRedoHistorySource? source) => (isSupported, source) switch { - UndoRedoHistorySource.Name => Texts.SourceName, - UndoRedoHistorySource.Type => Texts.SourceType, - UndoRedoHistorySource.Events => Texts.SourceEvents, - _ => Texts.Unsupported, + (false, _) => string.Empty, + (true, UndoRedoHistorySource.Events) => string.Format(Texts.StatusLimited, count), + _ => string.Format(Texts.StatusLine, count), }; + internal static string? StatusToolTipOf(bool isSupported, UndoRedoHistorySource? source) + => isSupported && source == UndoRedoHistorySource.Events ? Texts.LimitedReason : null; + UndoTreeNodeViewModel? NodeOf(object? parameter) => parameter as UndoTreeNodeViewModel ?? SelectedNode; bool CanJump(UndoTreeNodeViewModel? node) @@ -283,7 +287,8 @@ internal class UndoTreeViewModel : Bindable, IToolViewModel, ITimelineToolViewMo SyncSettings(); RebuildRows(); - StatusText = history.IsSupported ? string.Format(Texts.StatusLine, history.Count, SourceText(history.Source)) : Texts.Unsupported; + StatusText = StatusTextOf(history.IsSupported, history.Count, history.Source); + StatusToolTip = StatusToolTipOf(history.IsSupported, history.Source); OnPropertyChanged(nameof(IsSupported)); if (UndoTreeSettings.Default.FollowCurrent && !Filter.IsActive) SelectCurrent();