1 Commits

Author SHA1 Message Date
messypy
8e704980c1 Fix history current visit labels
All checks were successful
build-windows-exe / build (push) Successful in 1m5s
2026-07-28 00:47:37 +09:00
2 changed files with 13 additions and 5 deletions

View File

@@ -1275,9 +1275,17 @@ func paintHistoryDetailPane(hwnd uintptr, app *guiApp) uintptr {
border = clrAccentGreen border = clrAccentGreen
} }
drawSettingsBox(hdc, row.Rect, fill, border) 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+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.Left+136, 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) 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) label := ellipsizeTextToWidth(hdc, row.WorldLabel, row.Rect.Right-row.Rect.Left-150, app.joinBoldHFont)
if label == "" { if label == "" {
label = "(unknown)" label = "(unknown)"
@@ -1373,12 +1381,12 @@ func isMidnight(t time.Time) bool {
func historyEntryTimeLabel(t time.Time, isEnd bool, current bool) string { func historyEntryTimeLabel(t time.Time, isEnd bool, current bool) string {
if t.IsZero() { if t.IsZero() {
if current { if current && isEnd {
return "now" return "now"
} }
return "" return ""
} }
if current { if current && isEnd {
return "now" return "now"
} }
if isEnd && isMidnight(t) { if isEnd && isMidnight(t) {

View File

@@ -3440,7 +3440,7 @@ func humanDurationLabel(started, ended time.Time, current bool) string {
} }
d := ended.Sub(started) d := ended.Sub(started)
if current { if current {
return formatDurationShort(d) + " active" return formatDurationShort(d)
} }
return formatDurationShort(d) return formatDurationShort(d)
} }