дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 17:47:08 +02:00
fix(database): select the matching cell when navigating into a CSV file shown as Data (#8067)
Find in Files, Go to Line and other navigation into a CSV file on its Data tab moved the caret in the hidden Text editor only. The table now maps the revealed offset to its record and field the way the CSV parser reads the file (quotes, CRLF, blank lines, header row), scrolls to that cell wherever local sorting put it, selects it and takes the focus; a row hidden by a filter is left alone. Fixes #8043
Цей коміт міститься в:
1 джерело
551328c901
коміт
4a41b14992
7 files changed
+142
-3
No files matched your search
@@ -9,6 +9,10 @@ export type CsvMode = "text" | "data";
|
||||
export const useCsvModes = create<Record<string, CsvMode | undefined>>(() => ({}));
|
||||
export const useCsvSourceHidden = (tabId: string) => useCsvModes((s) => s[tabId] === "data");
|
||||
|
||||
/** The last caret a navigation placed in each CSV file's text (Find in Files, Go to Line…). */
|
||||
export const useCsvReveals = create<Record<string, { offset: number; seq: number } | undefined>>(() => ({}));
|
||||
let revealSeq = 0;
|
||||
|
||||
/** Bumped when a CSV file's text changes. */
|
||||
export const useCsvVersions = create<Record<string, number | undefined>>(() => ({}));
|
||||
const bump = (path: string) => useCsvVersions.setState((s) => ({ [path]: (s[path] ?? 0) + 1 }));
|
||||
@@ -27,6 +31,8 @@ export function registerCsvLiveSource(): () => void {
|
||||
bump(ctx.path);
|
||||
}
|
||||
update(u: ViewUpdate) {
|
||||
if (u.transactions.some((tr) => tr.isUserEvent("select.reveal")))
|
||||
useCsvReveals.setState({ [ctx.path]: { offset: u.state.selection.main.head, seq: ++revealSeq } });
|
||||
if (!u.docChanged) return;
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => bump(ctx.path), TEXT_DELAY);
|
||||
|
||||
Reference in new issue
Заблокувати користувача