@fresh-editor/fresh-editor 0.2.23 → 0.2.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,6 +44,32 @@ interface ProcessHandle<T> extends PromiseLike<T> {
44
44
  type BufferId = number;
45
45
  /** Split identifier */
46
46
  type SplitId = number;
47
+ /**
48
+ * Payload delivered to handlers registered with `editor.on("mouse_click", ...)`.
49
+ *
50
+ * All coordinate fields are in cell (terminal character) units. `buffer_*`
51
+ * fields are `null` when the click did not land in any buffer panel.
52
+ */
53
+ interface MouseClickHookArgs {
54
+ /** Screen column (0-indexed). */
55
+ column: number;
56
+ /** Screen row (0-indexed). */
57
+ row: number;
58
+ /** Mouse button: "left", "right", "middle". */
59
+ button: string;
60
+ /** Modifier keys (e.g. "shift"). */
61
+ modifiers: string;
62
+ /** X offset of the content area the click landed in. */
63
+ content_x: number;
64
+ /** Y offset of the content area the click landed in. */
65
+ content_y: number;
66
+ /** Buffer under the click, or `null` when outside any buffer panel. */
67
+ buffer_id: number | null;
68
+ /** 0-indexed buffer row (line number) of the click, accounting for scroll. */
69
+ buffer_row: number | null;
70
+ /** 0-indexed byte column inside the buffer row. */
71
+ buffer_col: number | null;
72
+ }
47
73
  type TextPropertyEntry = {
48
74
  /**
49
75
  * Text content for this entry
@@ -308,6 +334,15 @@ type BufferInfo = {
308
334
  * The detected language for this buffer (e.g., "rust", "markdown", "text")
309
335
  */
310
336
  language: string;
337
+ /**
338
+ * Whether this tab was opened in "preview" (ephemeral) mode — true when
339
+ * opened via single-click in the file explorer and not yet committed
340
+ * (no edit, no double-click, no tab-click, no layout change). Plugins
341
+ * that react to buffer lifecycle events should generally treat preview
342
+ * buffers as transient; e.g. a diagnostics panel may want to skip
343
+ * refreshing itself for a preview tab.
344
+ */
345
+ is_preview: boolean;
311
346
  };
312
347
  type JsDiagnostic = {
313
348
  /**
@@ -1143,6 +1178,12 @@ interface EditorAPI {
1143
1178
  */
1144
1179
  getConfigDir(): string;
1145
1180
  /**
1181
+ * Get the persistent data directory path (DirectoryContext::data_dir).
1182
+ * Intended for plugin state that should outlive a single session — e.g.
1183
+ * review-diff comments keyed off git state.
1184
+ */
1185
+ getDataDir(): string;
1186
+ /**
1146
1187
  * Get themes directory path
1147
1188
  */
1148
1189
  getThemesDir(): string;
@@ -1276,6 +1317,17 @@ interface EditorAPI {
1276
1317
  */
1277
1318
  clearConcealsInRange(bufferId: number, start: number, end: number): boolean;
1278
1319
  /**
1320
+ * Add a collapsed fold range. Hides bytes [start, end) from
1321
+ * rendering — the line containing `start - 1` (the fold "header")
1322
+ * stays visible, while subsequent lines covered by the range are
1323
+ * skipped.
1324
+ */
1325
+ addFold(bufferId: number, start: number, end: number, placeholder?: string): boolean;
1326
+ /**
1327
+ * Clear every collapsed fold range on the buffer.
1328
+ */
1329
+ clearFolds(bufferId: number): boolean;
1330
+ /**
1279
1331
  * Add a soft break point for marker-based line wrapping
1280
1332
  */
1281
1333
  addSoftBreak(bufferId: number, namespace: string, position: number, indent: number): boolean;
@@ -1336,8 +1388,14 @@ interface EditorAPI {
1336
1388
  clearVirtualTextNamespace(bufferId: number, namespace: string): boolean;
1337
1389
  /**
1338
1390
  * Add a virtual line (full line above/below a position)
1391
+ *
1392
+ * The `options` object accepts:
1393
+ * * `fg`, `bg` — either an `[r, g, b]` array (each `0..=255`) or a
1394
+ * theme-key string (e.g. `"editor.line_number_fg"`). Theme keys
1395
+ * are resolved at render time so the line follows theme changes.
1396
+ * Both default to `null` (no foreground / transparent background).
1339
1397
  */
1340
- addVirtualLine(bufferId: number, position: number, text: string, fgR: number, fgG: number, fgB: number, bgR: number, bgG: number, bgB: number, above: boolean, namespace: string, priority: number): boolean;
1398
+ addVirtualLine(bufferId: number, position: number, text: string, options: Record<string, unknown>, above: boolean, namespace: string, priority: number): boolean;
1341
1399
  /**
1342
1400
  * Show a prompt and wait for user input (async)
1343
1401
  * Returns the user input or null if cancelled
@@ -1361,7 +1419,7 @@ interface EditorAPI {
1361
1419
  /**
1362
1420
  * Define a buffer mode (takes bindings as array of [key, command] pairs)
1363
1421
  */
1364
- defineMode(name: string, bindingsArr: string[][], readOnly?: boolean, allowTextInput?: boolean): boolean;
1422
+ defineMode(name: string, bindingsArr: string[][], readOnly?: boolean, allowTextInput?: boolean, inheritNormalBindings?: boolean): boolean;
1365
1423
  /**
1366
1424
  * Set the global editor mode
1367
1425
  */
@@ -1411,6 +1469,15 @@ interface EditorAPI {
1411
1469
  */
1412
1470
  setBufferCursor(bufferId: number, position: number): boolean;
1413
1471
  /**
1472
+ * Toggle whether the editor draws a native caret in this buffer.
1473
+ *
1474
+ * Buffer-group panel buffers default to `show_cursors = false`, which
1475
+ * also blocks all native movement actions in `action_to_events`. Plugins
1476
+ * that want native cursor motion in a panel (e.g. magit-style row
1477
+ * navigation) call this with `true` after `createBufferGroup` returns.
1478
+ */
1479
+ setBufferShowCursors(bufferId: number, show: boolean): boolean;
1480
+ /**
1414
1481
  * Set a line indicator in the gutter
1415
1482
  */
1416
1483
  setLineIndicator(bufferId: number, line: number, namespace: string, symbol: string, r: number, g: number, b: number, priority: number): boolean;