From fca191b850fc175896d5780415499dae9a116721 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Sat, 25 Oct 2025 10:48:02 +0200 Subject: [PATCH] Simplifies note prompt selection and timestamp formatting Refactors cursor handling to use setCursor instead of setSelection when collapsing selections Improves timestamp generation by using environment's default locale automatically instead of manually specifying language Enhances code clarity and simplifies locale handling for timestamp formatting --- commands/notePrompts.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/commands/notePrompts.ts b/commands/notePrompts.ts index d703d42..2bbd3d8 100644 --- a/commands/notePrompts.ts +++ b/commands/notePrompts.ts @@ -98,7 +98,7 @@ export class NotePromptsCommand { const to = editor.getCursor('to'); const hasSelection = from.line !== to.line || from.ch !== to.ch; if (hasSelection) { - editor.setSelection(from, from); + editor.setCursor(from); } const cursor = editor.getCursor(); // refreshed after collapse const currentLine = editor.getLine(cursor.line) ?? ''; @@ -146,9 +146,8 @@ export class NotePromptsCommand { * @returns Formatted markdown string ready for insertion */ private formatPrompts(prompts: string[]): string { - // Use user's locale for timestamp formatting to respect regional preferences - const locale = navigator?.language ?? 'en-US'; - const timestamp = new Intl.DateTimeFormat(locale, { + // Let Intl pick the default environment locale automatically + const timestamp = new Intl.DateTimeFormat(undefined, { year: 'numeric', month: 'short', day: 'numeric',