F1: cosmetics: regex error reason, one date format, Close Tab
- Find shows a bad regex as "invalid pattern: unclosed group": the search crate keeps only the parser's reason, the UI drops the invalid-params prefix (userMessage). - Dates read YYYY-MM-DD / YYYY-MM-DD HH:mm in local time everywhere (i18n formatDate/formatDateTime): Log, stash list, blame, recovery. - buffer.close is "Close Tab" in the palette as in the menu; an engine test keeps palette labels starting with their menu item's wording. - Docs: architecture, install (Jump List), localization parity, checklist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1b6bd1f870
commit
33a7185d75
18 changed files with 147 additions and 52 deletions
|
|
@ -27,7 +27,7 @@
|
|||
import { RangeSet, RangeSetBuilder, StateEffect, StateField, type EditorState, type Extension, type Text } from "@codemirror/state";
|
||||
import { EditorView, GutterMarker, ViewPlugin, gutter, showTooltip, type PluginValue, type Tooltip, type ViewUpdate } from "@codemirror/view";
|
||||
import { runWaiting, type JsonValue } from "../../ipc";
|
||||
import { t } from "../../i18n";
|
||||
import { formatDate, formatDateTime, t } from "../../i18n";
|
||||
import type { AssistBuffer } from "./assist";
|
||||
|
||||
/** Delay between the last edit and the query. */
|
||||
|
|
@ -154,18 +154,13 @@ export function ageLevel(iso: string, now: number): number {
|
|||
}
|
||||
|
||||
/**
|
||||
* A short local date, `YYYY-MM-DD`.
|
||||
* A short local date, `YYYY-MM-DD` ({@link formatDate}).
|
||||
*
|
||||
* @param iso - ISO 8601 date.
|
||||
* @returns the date, or the input when it cannot be read.
|
||||
*/
|
||||
export function shortDate(iso: string): string {
|
||||
const date = new Date(iso);
|
||||
if (Number.isNaN(date.getTime())) {
|
||||
return iso;
|
||||
}
|
||||
const pad = (n: number): string => String(n).padStart(2, "0");
|
||||
return `${String(date.getFullYear())}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
||||
return formatDate(iso);
|
||||
}
|
||||
|
||||
/** The text and look of one annotated line. */
|
||||
|
|
@ -343,9 +338,7 @@ function hoverCard(line: BlameLine): { dom: HTMLElement; message: HTMLElement }
|
|||
head.textContent = t("editor.blame.notCommitted");
|
||||
message.textContent = t("editor.blame.notCommittedHint");
|
||||
} else {
|
||||
const date = new Date(line.date);
|
||||
const when = Number.isNaN(date.getTime()) ? line.date : date.toLocaleString();
|
||||
head.textContent = t("editor.blame.byLine", { hash: line.hash.slice(0, 8), author: line.author, date: when });
|
||||
head.textContent = t("editor.blame.byLine", { hash: line.hash.slice(0, 8), author: line.author, date: formatDateTime(line.date) });
|
||||
message.textContent = messages.get(line.hash) ?? line.summary;
|
||||
const hint = document.createElement("div");
|
||||
hint.className = "lt-blame-tooltip__hint";
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* failures, they are listed until the dialog is closed.
|
||||
*/
|
||||
import { nextTick, onMounted, onUnmounted, ref, watch } from "vue";
|
||||
import { t } from "../../i18n";
|
||||
import { formatDateTime, t } from "../../i18n";
|
||||
import { useRecoveryStore } from "./recovery";
|
||||
|
||||
const recovery = useRecoveryStore();
|
||||
|
|
@ -55,7 +55,7 @@ watch(
|
|||
* @param savedAt - ms since the Unix epoch.
|
||||
*/
|
||||
function formatTime(savedAt: number): string {
|
||||
return new Date(savedAt).toLocaleString();
|
||||
return formatDateTime(savedAt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
import { RefreshCw, X } from "@lucide/vue";
|
||||
import { computed, nextTick, onBeforeUnmount, ref } from "vue";
|
||||
import { t } from "../../../i18n";
|
||||
import { formatDateTime, t } from "../../../i18n";
|
||||
import { useProjectStore } from "../../../stores/project";
|
||||
import { SHORT_HASH } from "../changes/changes";
|
||||
import { refBadges, useLogStore, type CommitFile, type CommitFileStatus } from "./log";
|
||||
|
|
@ -138,16 +138,12 @@ function rowAt(index: number): GraphRow | null {
|
|||
}
|
||||
|
||||
/**
|
||||
* A date for the list: the local date and time, short.
|
||||
* A date for the list: the local date and time, `YYYY-MM-DD HH:mm`.
|
||||
*
|
||||
* @param iso - ISO 8601 date.
|
||||
*/
|
||||
function shortDate(iso: string): string {
|
||||
const date = new Date(iso);
|
||||
if (Number.isNaN(date.getTime())) {
|
||||
return iso;
|
||||
}
|
||||
return date.toLocaleString(undefined, { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" });
|
||||
return formatDateTime(iso);
|
||||
}
|
||||
|
||||
/** Applies the typed filters now. */
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import { Archive } from "@lucide/vue";
|
|||
import { nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
||||
import { useModalsStore } from "../../../commands/modals";
|
||||
import { useCommandsStore } from "../../../commands/store";
|
||||
import { t } from "../../../i18n";
|
||||
import { formatDateTime, t } from "../../../i18n";
|
||||
import { useStashStore, type StashEntry } from "./stash";
|
||||
|
||||
const stash = useStashStore();
|
||||
|
|
@ -57,16 +57,12 @@ function refName(entry: StashEntry): string {
|
|||
}
|
||||
|
||||
/**
|
||||
* A date for the list: the local date and time, short.
|
||||
* A date for the list: the local date and time, `YYYY-MM-DD HH:mm`.
|
||||
*
|
||||
* @param iso - ISO 8601 date.
|
||||
*/
|
||||
function shortDate(iso: string): string {
|
||||
const date = new Date(iso);
|
||||
if (Number.isNaN(date.getTime())) {
|
||||
return iso;
|
||||
}
|
||||
return date.toLocaleString(undefined, { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" });
|
||||
return formatDateTime(iso);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue