From 8e704980c13087909ac46a4e2eb2554e32b1fb48 Mon Sep 17 00:00:00 2001 From: messypy Date: Tue, 28 Jul 2026 00:47:37 +0900 Subject: [PATCH] Fix history current visit labels --- cmd/vrc_osc_gui/history_view_windows.go | 16 ++++++++++++---- cmd/vrc_osc_gui/window_windows.go | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cmd/vrc_osc_gui/history_view_windows.go b/cmd/vrc_osc_gui/history_view_windows.go index 5b9e008..bcff799 100644 --- a/cmd/vrc_osc_gui/history_view_windows.go +++ b/cmd/vrc_osc_gui/history_view_windows.go @@ -1275,9 +1275,17 @@ func paintHistoryDetailPane(hwnd uintptr, app *guiApp) uintptr { border = clrAccentGreen } drawSettingsBox(hdc, row.Rect, fill, border) + duration := humanDurationLabel(row.Start, row.End, row.Current) + durationWidth := measureTextWidth(hdc, duration, app.hFont) + durationX := row.Rect.Right - 12 - durationWidth + if durationX < row.Rect.Left+260 { + durationX = row.Rect.Left + 260 + } drawPaneText(hdc, row.Rect.Left+12, y+6, "入室 "+historyEntryTimeLabel(row.Start, false, row.Current), app.hFont, clrMutedText) - drawPaneText(hdc, row.Rect.Left+146, y+6, "退室 "+historyEntryTimeLabel(row.End, true, row.Current), app.hFont, clrMutedText) - drawPaneText(hdc, row.Rect.Right-110, y+6, humanDurationLabel(row.Start, row.End, row.Current), app.hFont, clrMutedText) + drawPaneText(hdc, row.Rect.Left+136, y+6, "退室 "+historyEntryTimeLabel(row.End, true, row.Current), app.hFont, clrMutedText) + if durationX+durationWidth < row.Rect.Right-8 { + drawPaneText(hdc, durationX, y+6, duration, app.hFont, clrMutedText) + } label := ellipsizeTextToWidth(hdc, row.WorldLabel, row.Rect.Right-row.Rect.Left-150, app.joinBoldHFont) if label == "" { label = "(unknown)" @@ -1373,12 +1381,12 @@ func isMidnight(t time.Time) bool { func historyEntryTimeLabel(t time.Time, isEnd bool, current bool) string { if t.IsZero() { - if current { + if current && isEnd { return "now" } return "" } - if current { + if current && isEnd { return "now" } if isEnd && isMidnight(t) { diff --git a/cmd/vrc_osc_gui/window_windows.go b/cmd/vrc_osc_gui/window_windows.go index e0ea441..eef537f 100644 --- a/cmd/vrc_osc_gui/window_windows.go +++ b/cmd/vrc_osc_gui/window_windows.go @@ -3440,7 +3440,7 @@ func humanDurationLabel(started, ended time.Time, current bool) string { } d := ended.Sub(started) if current { - return formatDurationShort(d) + " active" + return formatDurationShort(d) } return formatDurationShort(d) }