@dybai/dsh-editor 0.8.0 → 0.13.0

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.
@@ -13,9 +13,14 @@
13
13
  * - `settings` — the editor's behavior toggles (record key = setting name,
14
14
  * value = `{ value, updatedAt }`), written by the status-bar settings
15
15
  * panel; unknown-to-this-build keys are never read, so newer clients may
16
- * store more settings than this build knows.
16
+ * store more settings than this build knows;
17
+ * - `wrap_overrides` — the per-file-type word-wrap overrides (spec §6; record
18
+ * key = a glob matching `/^\*\.[a-z0-9]{1,16}$/`, value = `{ enabled,
19
+ * updatedAt }`), written by the settings center's word-wrap section; an
20
+ * empty set means "no overrides", so the client falls back to the global
21
+ * `wordWrap` setting.
17
22
  *
18
- * All tables share ONE monotonic `updatedAt` stamp carried by the unit's
23
+ * All four tables share ONE monotonic `updatedAt` stamp carried by the unit's
19
24
  * global singleton, round-tripped for compare-and-set updates.
20
25
  *
21
26
  * The module imports NOTHING on purpose: `kv` is a `StorageBackend` KvFacet
@@ -28,7 +33,8 @@
28
33
  * - the unit opens lazily on first use and the open is memoized (concurrent
29
34
  * callers share one `open` promise; a rejecting open forgets the memo so a
30
35
  * later call retries);
31
- * - every mutating call (`setModePreferences`, `setKeymap`) runs inside ONE
36
+ * - every mutating call (`setModePreferences`, `setKeymap`, `setSettings`,
37
+ * `setWrapOverrides`) runs inside ONE
32
38
  * internal write chain (promise queue) that serializes writes — the KV unit
33
39
  * does NOT serialize writes itself, and each write must read fresh state,
34
40
  * diff records, and restamp the global as one uninterrupted critical
@@ -37,11 +43,12 @@
37
43
  * honestly observe a write that settled a beat earlier.
38
44
  *
39
45
  * Shared CAS token: the unit's global `updatedAt` is the compare-and-set
40
- * guard for BOTH tables. A `setKeymap` write restamps the token, so a
46
+ * guard for ALL FOUR tables. A `setKeymap` write restamps the token, so a
41
47
  * concurrent `setModePreferences` carrying the older token fails its CAS with
42
- * `mode-preferences/conflict` (and symmetrically `keymap/conflict`) — the
43
- * client refetches and retries. That is intentional: one unit, one stamp, no
44
- * cross-table lost updates.
48
+ * `mode-preferences/conflict` (and symmetrically `keymap/conflict`,
49
+ * `settings/conflict`, `wrap-overrides/conflict`) — the client refetches and
50
+ * retries. That is intentional: one unit, one stamp, no cross-table lost
51
+ * updates.
45
52
  *
46
53
  * Failure policy: fail loud. A backend whose medium rejects (`loadAll` on an
47
54
  * unmounted backend, a closed unit) propagates that rejection to the caller.
@@ -56,11 +63,30 @@
56
63
  * the earlier `dsh-editor` / `modeAssociations` spellings were rejected by
57
64
  * `open()`, so NO data was ever persisted under them and this unit starts
58
65
  * fresh at version 1 with no migration surface.
66
+ *
67
+ * Versioning / appending the `wrap_overrides` table (0.11.0, spec §12):
68
+ * `version` is the ON-DISK FORMAT version, not a table-set schema version.
69
+ * The `json` backend validates only unit/table names
70
+ * (`dsh-storage-json/lib/index.js`, `validateDescriptor` ~L662), then compares
71
+ * the stored stamp with `descriptor.version` / `compatibleVersions`
72
+ * (`parse` ~L106; this descriptor uses the default `single` layout, so the
73
+ * whole-unit path applies). A table ABSENT from the stored document reads as
74
+ * an empty table, never an error (`parse` ~L113-117: `records === undefined`
75
+ * → `new Map()`), and the next write serializes every declared table
76
+ * (`serialize` ~L76-88) from the preserved state (`openSingleUnit` ~L191-196).
77
+ * Conclusion: appending a table at the SAME version 1 is accepted, `version`
78
+ * needs NO increment, and the existing three tables' records are preserved
79
+ * (verified against the live medium `%USERPROFILE%\.dsh\storages\dsh_editor.json`,
80
+ * stamped `version: 1`). Bumping `version` here would instead make `open()`
81
+ * reject that file with `version-mismatch` unless `compatibleVersions` vouched
82
+ * for it. Caveat: the table list is the read projection — a pre-0.11.0 build
83
+ * ignores `wrap_overrides`, and its next whole-unit write drops that table, so
84
+ * downgrading across 0.11.0 loses only the overrides.
59
85
  */
60
86
  const UNIT_DESCRIPTOR = Object.freeze({
61
87
  name: 'dsh_editor',
62
88
  version: 1,
63
- tables: Object.freeze(['mode_associations', 'keymap', 'settings']),
89
+ tables: Object.freeze(['mode_associations', 'keymap', 'settings', 'wrap_overrides']),
64
90
  hasGlobal: true
65
91
  });
66
92
 
@@ -70,9 +96,17 @@ const TABLE = 'mode_associations';
70
96
  const KEYMAP_TABLE = 'keymap';
71
97
  /** Table whose records are the behavior toggles: record key = setting name. */
72
98
  const SETTINGS_TABLE = 'settings';
99
+ /** Table whose records are the word-wrap overrides: record key = glob. */
100
+ const WRAP_OVERRIDES_TABLE = 'wrap_overrides';
73
101
 
74
- /** Setting names this build knows; unknown keys in a payload are rejected. */
75
- const SETTINGS_KEYS = new Set(['autoReloadClean', 'highlightActiveLine', 'showLineNumbers']);
102
+ /**
103
+ * Setting names this build knows; unknown keys in a payload are rejected.
104
+ * A KNOWN key absent from storage is never invented here — `getSettings`
105
+ * reports only the records actually stored, so the client can tell "unset"
106
+ * (e.g. `wordWrap`, which then falls back to its builtin per-file default)
107
+ * from an explicitly stored value.
108
+ */
109
+ const SETTINGS_KEYS = new Set(['autoReloadClean', 'highlightActiveLine', 'showLineNumbers', 'scrollBeyondLastLine', 'wordWrap', 'showWhitespaceSpaces', 'showWhitespaceTabs', 'showWhitespaceNewlines', 'indentMode', 'indentWidth']);
76
110
 
77
111
  /** Keymap action ids the editor framework owns (spec §6; `gotoLine` v0.6.0). */
78
112
  const KEYMAP_ACTIONS = new Set(['save', 'saveAll', 'deleteLines', 'gotoLine']);
@@ -80,6 +114,8 @@ const KEYMAP_ACTIONS = new Set(['save', 'saveAll', 'deleteLines', 'gotoLine']);
80
114
  const KEYMAP_CODE_RE = /^(Key[A-Z]|Digit[0-9])$/;
81
115
  /** Abstract modifier vocabulary for a keymap binding. */
82
116
  const KEYMAP_MODIFIERS = new Set(['primary', 'control', 'alt', 'shift', 'meta']);
117
+ /** Storable record-key shape for a word-wrap override: `*.` + 1-16 [a-z0-9] (spec §6). */
118
+ const WRAP_OVERRIDE_GLOB_RE = /^\*\.[a-z0-9]{1,16}$/;
83
119
 
84
120
  /**
85
121
  * Build the plain-Error stand-in for a DOMException AbortError; the storage
@@ -187,9 +223,32 @@ function isValidAssociations(associations) {
187
223
  return true;
188
224
  }
189
225
 
226
+ /** Valid `indentMode` values — mirror of src/settings.js type table (0.13.0). */
227
+ const INDENT_MODES = new Set(['auto', 'tabs', 'spaces']);
228
+ /** Valid `indentWidth` values — mirror of src/settings.js type table (0.13.0). */
229
+ const INDENT_WIDTHS = new Set([2, 4, 8]);
230
+
231
+ /**
232
+ * The per-key type table: whether `value` is legal for the known setting
233
+ * `key` — a mirror of src/settings.js type table (0.13.0), so the Host's
234
+ * write validation and read echo accept exactly the values the client's own
235
+ * validator accepts (the Host imports no client code; same values, own
236
+ * constants). `indentMode` is an enum, `indentWidth` is an enum of widths,
237
+ * every other known setting is a boolean.
238
+ * @param key - a known setting name (`SETTINGS_KEYS`).
239
+ * @param value - the value to check.
240
+ * @returns whether the value matches the key's type.
241
+ */
242
+ function isValidSettingValue(key, value) {
243
+ if (key === 'indentMode') return INDENT_MODES.has(value);
244
+ if (key === 'indentWidth') return INDENT_WIDTHS.has(value);
245
+ return typeof value === 'boolean';
246
+ }
247
+
190
248
  /**
191
249
  * Validate the settings payload: a plain object whose keys are all setting
192
- * names this build knows and whose values are all booleans. An EMPTY object
250
+ * names this build knows and whose values all match their per-key type (see
251
+ * `isValidSettingValue`). An EMPTY object
193
252
  * is valid — it means "reset to defaults" (full-set replace deletes every
194
253
  * stored record). Extra/unknown keys are rejected so a typo never silently
195
254
  * persists a setting this build would never read back.
@@ -200,7 +259,31 @@ function isValidSettings(settings) {
200
259
  if (settings === null || typeof settings !== 'object' || Array.isArray(settings)) return false;
201
260
  for (const key of Object.keys(settings)) {
202
261
  if (!SETTINGS_KEYS.has(key)) return false;
203
- if (typeof settings[key] !== 'boolean') return false;
262
+ if (!isValidSettingValue(key, settings[key])) return false;
263
+ }
264
+ return true;
265
+ }
266
+
267
+ /**
268
+ * Validate the word-wrap overrides payload: an array (an EMPTY array is valid
269
+ * — the full-set replace then deletes every record, i.e. resets to "no
270
+ * overrides") of `{ glob: /^\*\.[a-z0-9]{1,16}$/, enabled: boolean }`. A
271
+ * duplicated glob is rejected instead of letting the last entry win: one glob
272
+ * maps to exactly one override, so a duplicate is a client bug that would
273
+ * otherwise persist an arbitrary winner. Extra properties are tolerated (only
274
+ * the contract fields are read).
275
+ * @param overrides - the caller's payload.
276
+ * @returns whether the payload is storable.
277
+ */
278
+ function isValidWrapOverrides(overrides) {
279
+ if (!Array.isArray(overrides)) return false;
280
+ const globs = new Set();
281
+ for (const entry of overrides) {
282
+ if (entry === null || typeof entry !== 'object') return false;
283
+ if (typeof entry.glob !== 'string' || !WRAP_OVERRIDE_GLOB_RE.test(entry.glob)) return false;
284
+ if (globs.has(entry.glob)) return false; // duplicate glob
285
+ globs.add(entry.glob);
286
+ if (typeof entry.enabled !== 'boolean') return false;
204
287
  }
205
288
  return true;
206
289
  }
@@ -393,11 +476,15 @@ export function createPreferencesService({ kv, now }) {
393
476
  /**
394
477
  * Read the stored behavior settings (spec: the settings panel's
395
478
  * toggles). Settings this build knows but storage never wrote come
396
- * back absent — the client applies its own defaults; unknown keys
397
- * that somehow reached the medium (older bug, hand edit) are ignored.
479
+ * back absent — the client applies its own defaults; known keys whose
480
+ * record value fails the per-key type table (`isValidSettingValue`;
481
+ * hand edit, older bug) are ignored, and so is any unknown key that
482
+ * somehow reached the medium.
398
483
  * @param signal - caller cancellation (last parameter, SRC convention).
399
- * @returns `{ settings: { [name]: boolean }, updatedAt }` — `updatedAt`
400
- * is the SHARED token (see the module doc).
484
+ * @returns `{ settings: { [name]: boolean | 'auto'|'tabs'|'spaces' |
485
+ * 2|4|8 }, updatedAt }` — each echoed value matches its key's type in
486
+ * the per-key type table (booleans, plus the typed indent keys);
487
+ * `updatedAt` is the SHARED token (see the module doc).
401
488
  */
402
489
  async getSettings(signal) {
403
490
  throwIfAborted(signal);
@@ -408,7 +495,7 @@ export function createPreferencesService({ kv, now }) {
408
495
  const settings = {};
409
496
  for (const key of SETTINGS_KEYS) {
410
497
  const record = records[key];
411
- if (record !== null && typeof record === 'object' && typeof record.value === 'boolean') {
498
+ if (record !== null && typeof record === 'object' && isValidSettingValue(key, record.value)) {
412
499
  settings[key] = record.value;
413
500
  }
414
501
  }
@@ -420,8 +507,9 @@ export function createPreferencesService({ kv, now }) {
420
507
  * are deleted; `{}` resets to defaults), restamping the unit's SHARED
421
508
  * global `updatedAt`.
422
509
  * @param settings - the complete new set (keys ⊆ known setting names,
423
- * values all booleans); validated before the write chain, so an
424
- * invalid payload never touches storage.
510
+ * values matching their per-key type, see `isValidSettingValue`);
511
+ * validated before the write chain, so an invalid payload never
512
+ * touches storage.
425
513
  * @param expectedUpdatedAt - compare-and-set guard against the SHARED
426
514
  * token: when provided and not equal to the storage's current
427
515
  * `updatedAt`, the write rejects with `settings/conflict` and storage
@@ -457,6 +545,75 @@ export function createPreferencesService({ kv, now }) {
457
545
  });
458
546
  },
459
547
 
548
+ /**
549
+ * Read the stored per-file-type word-wrap overrides (spec §6).
550
+ * @param signal - caller cancellation (last parameter, SRC convention).
551
+ * @returns `{ overrides: [{ glob, enabled }] sorted by glob, updatedAt }`
552
+ * — `overrides` is empty before the first successful set (the client
553
+ * then falls back to the global `wordWrap` setting); `updatedAt` is the
554
+ * SHARED token (see the module doc).
555
+ */
556
+ async getWrapOverrides(signal) {
557
+ throwIfAborted(signal);
558
+ const unit = await openUnit();
559
+ const snapshot = await unit.loadAll();
560
+ throwIfAborted(signal);
561
+ const records = tableOf(snapshot, WRAP_OVERRIDES_TABLE);
562
+ const overrides = Object.keys(records)
563
+ .filter((glob) => {
564
+ const value = records[glob];
565
+ return value !== null && typeof value === 'object' && typeof value.enabled === 'boolean';
566
+ })
567
+ .sort()
568
+ .map((glob) => ({ glob, enabled: records[glob].enabled }));
569
+ return { overrides, updatedAt: globalUpdatedAt(snapshot.global) };
570
+ },
571
+
572
+ /**
573
+ * Replace the complete word-wrap override set (records absent from the
574
+ * array are deleted; `[]` resets to "no overrides"), restamping the
575
+ * unit's SHARED global `updatedAt` — which invalidates any pending
576
+ * associations / keymap / settings CAS against the older token.
577
+ * @param overrides - the complete new set
578
+ * (`[{ glob: /^\*\.[a-z0-9]{1,16}$/, enabled: boolean }]`, unique
579
+ * globs); validated before the write chain, so an invalid payload never
580
+ * touches storage.
581
+ * @param expectedUpdatedAt - compare-and-set guard against the SHARED
582
+ * token: when provided and not equal to the storage's current
583
+ * `updatedAt`, the write rejects with `wrap-overrides/conflict` and
584
+ * storage is untouched. Omit (or pass `undefined`) to write
585
+ * unconditionally.
586
+ * @param signal - caller cancellation (last parameter, SRC convention).
587
+ * @returns `{ updatedAt }` of the settled write.
588
+ */
589
+ async setWrapOverrides(overrides, expectedUpdatedAt, signal) {
590
+ if (!isValidWrapOverrides(overrides)) {
591
+ throw codedError('wrap-overrides/invalid');
592
+ }
593
+ throwIfAborted(signal);
594
+ return enqueue(async () => {
595
+ throwIfAborted(signal);
596
+ const unit = await openUnit();
597
+ const snapshot = await unit.loadAll();
598
+ const records = tableOf(snapshot, WRAP_OVERRIDES_TABLE);
599
+ const currentUpdatedAt = globalUpdatedAt(snapshot.global);
600
+ if (expectedUpdatedAt !== undefined && expectedUpdatedAt !== currentUpdatedAt) {
601
+ throw codedError('wrap-overrides/conflict');
602
+ }
603
+ const existingKeys = Object.keys(records);
604
+ if (existingKeys.length > 0) {
605
+ await unit.deleteRecords(WRAP_OVERRIDES_TABLE, existingKeys);
606
+ }
607
+ const updatedAt = now();
608
+ for (const { glob, enabled } of overrides) {
609
+ await unit.putRecord(WRAP_OVERRIDES_TABLE, glob, { enabled, updatedAt });
610
+ }
611
+ await unit.setGlobal({ updatedAt });
612
+ throwIfAborted(signal);
613
+ return { updatedAt };
614
+ });
615
+ },
616
+
460
617
  /**
461
618
  * Drain the write chain, close the unit when one was opened, and forget
462
619
  * the open so a later call reopens lazily. Idempotent; wired into the
package/index.js CHANGED
@@ -8,7 +8,8 @@
8
8
  * discovery claim `dshEditor/writeFile`, `dshEditor/getModePreferences`,
9
9
  * `dshEditor/setModePreferences`, `dshEditor/getKeymap`,
10
10
  * `dshEditor/setKeymap`, `dshEditor/getSettings`,
11
- * `dshEditor/setSettings` and `dshEditor/appendLogs` (the client log
11
+ * `dshEditor/setSettings`, `dshEditor/getWrapOverrides`,
12
+ * `dshEditor/setWrapOverrides` and `dshEditor/appendLogs` (the client log
12
13
  * channel's flush endpoint), so no generated Typert artifacts are needed.
13
14
  *
14
15
  * Deliberately imports no `@deepseek-ai/*` package: every capability comes
@@ -16,7 +17,7 @@
16
17
  * so the bundle loads under any profile node_modules layout. The service
17
18
  * bodies live in `host/write-service.js`, `host/preferences-service.js` and
18
19
  * `host/log-service.js` and are composed here onto one prototype that
19
- * carries all eight Remote markers; the log service's exporter is also
20
+ * carries all ten Remote markers; the log service's exporter is also
20
21
  * registered on `ctx.logger` inside the effect so this plugin's own Host
21
22
  * records persist through the same chain.
22
23
  *
@@ -145,7 +146,7 @@ export function apply(ctx) {
145
146
  error: console.error.bind(console)
146
147
  }
147
148
  });
148
- // One wire service: exactly the eight Remote-marked methods on one
149
+ // One wire service: exactly the ten Remote-marked methods on one
149
150
  // prototype, each delegating to its factory's closure.
150
151
  const service = Object.create({
151
152
  writeFile: files.writeFile,
@@ -155,6 +156,8 @@ export function apply(ctx) {
155
156
  setKeymap: preferences.setKeymap,
156
157
  getSettings: preferences.getSettings,
157
158
  setSettings: preferences.setSettings,
159
+ getWrapOverrides: preferences.getWrapOverrides,
160
+ setWrapOverrides: preferences.setWrapOverrides,
158
161
  appendLogs: (entries) => logService.appendEntries(entries)
159
162
  });
160
163
  const prototype = Object.getPrototypeOf(service);
@@ -189,6 +192,14 @@ export function apply(ctx) {
189
192
  method: 'setSettings',
190
193
  invocation: Object.freeze({ kind: 'direct' })
191
194
  }),
195
+ Object.freeze({
196
+ method: 'getWrapOverrides',
197
+ invocation: Object.freeze({ kind: 'direct' })
198
+ }),
199
+ Object.freeze({
200
+ method: 'setWrapOverrides',
201
+ invocation: Object.freeze({ kind: 'direct' })
202
+ }),
192
203
  Object.freeze({
193
204
  method: 'appendLogs',
194
205
  invocation: Object.freeze({ kind: 'direct' })
package/locale/en.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "File editor",
4
- "description": "Makes text files in the side pane editable: open a file, edit it in place, and save back to disk with Ctrl+S (rebindable from the status-bar keyboard icon), jump to a line with Ctrl+G, with stale-version conflict prompts and reload; external modifications and deletions are detected and surfaced."
4
+ "description": "Makes text files in the side pane editable: open a file, edit it in place, and save back to disk with Ctrl+S (rebindable in the settings center opened from the status-bar gear), jump to a line with Ctrl+G, with stale-version conflict prompts and reload; external modifications and deletions are detected and surfaced."
5
5
  },
6
6
  "action": {
7
7
  "save": "Save",
@@ -50,7 +50,6 @@
50
50
  "conflict": "Mode preferences changed elsewhere; reloaded, please retry."
51
51
  },
52
52
  "keymap": {
53
- "buttonTitle": "Editor shortcuts",
54
53
  "save": "Save",
55
54
  "saveAll": "Save all",
56
55
  "deleteLines": "Delete lines",
@@ -61,7 +60,7 @@
61
60
  "resetTitle": "Restore the default keys (Ctrl+S / Ctrl+Shift+S / Ctrl+D / Ctrl+G)",
62
61
  "duplicate": "That combo is already used by another action; pick another one.",
63
62
  "reserved": "This combination is reserved by the browser (e.g. close/new tab) and cannot be recorded",
64
- "reservedHint": "Browser-reserved combos (Ctrl/⌘+W, T, N, Q, …) cannot be recorded",
63
+ "reservedHint": "Browser-reserved combos (Ctrl/⌘+W, T, N, Q, etc.) and Tab indentation cannot be recorded",
65
64
  "writeFailed": "Failed to save shortcuts",
66
65
  "conflict": "Shortcuts changed elsewhere; reloaded, please retry."
67
66
  },
@@ -97,11 +96,50 @@
97
96
  "highlightActiveLineNote": "The built-in plain-text mode always honors this; other editor modes may declare support via their descriptor.",
98
97
  "showLineNumbers": "Show line numbers",
99
98
  "showLineNumbersTitle": "Draw the line-number column beside the content",
99
+ "scrollBeyondLastLine": "Scroll past last line",
100
+ "scrollBeyondLastLineTitle": "Keep scrollable blank space past the end of content so the last line can scroll to the top of the viewport",
101
+ "showWhitespaceGroup": "Show whitespace",
102
+ "showWhitespaceSpaces": "Show spaces",
103
+ "showWhitespaceSpacesTitle": "Render space characters as a light middle dot (·)",
104
+ "showWhitespaceSpacesNote": "Global setting; applies to every mounted editor immediately. Off by default.",
105
+ "showWhitespaceTabs": "Show tabs",
106
+ "showWhitespaceTabsTitle": "Render tab characters as a light arrow (→), padded to the next stop",
107
+ "showWhitespaceTabsNote": "Global setting; applies to every mounted editor immediately. Off by default.",
108
+ "showWhitespaceNewlines": "Show newlines",
109
+ "showWhitespaceNewlinesTitle": "Render each line break as a light return glyph (↵) at the end of its line; the trailing newline at end of file is not drawn",
110
+ "showWhitespaceNewlinesNote": "Global setting; applies to every mounted editor immediately. Off by default.",
111
+ "wordWrap": "Word wrap",
112
+ "wordWrapTitle": "Wrap overly long lines within the editor width",
113
+ "indentMode": "Indent style",
114
+ "indentModeTitle": "The indent unit the Tab key inserts: auto-detect the current file / fixed tabs / fixed spaces",
115
+ "indentModeAuto": "Auto detect",
116
+ "indentModeTabs": "Tabs",
117
+ "indentModeSpaces": "Spaces",
118
+ "indentWidth": "Indent width",
119
+ "indentWidthTitle": "Spaces per indent level in spaces mode",
120
+ "indentWidthNote": "Only applies in Spaces mode; also used as the fallback width when auto detect has no signal.",
100
121
  "on": "On",
101
122
  "off": "Off",
102
123
  "writeFailed": "Failed to save settings",
103
124
  "conflict": "Settings changed elsewhere; reloaded, please retry."
104
125
  },
126
+ "settingsCenter": {
127
+ "title": "Editor settings",
128
+ "close": "Close",
129
+ "section": {
130
+ "appearance": "Appearance",
131
+ "behavior": "Behavior",
132
+ "indent": "Indent",
133
+ "wrap": "Word wrap",
134
+ "keymap": "Shortcuts"
135
+ },
136
+ "wordWrapGlobalNote": "When unset, the per-extension default applies (md-like files wrap)",
137
+ "wrapOverrideLabel": "Word wrap for this type",
138
+ "wrapOverrideFollow": "Follow global",
139
+ "wrapOverrideOn": "Force on",
140
+ "wrapOverrideOff": "Force off",
141
+ "wrapOverrideNoExtension": "(no extension)"
142
+ },
105
143
  "status": {
106
144
  "lines": "lines",
107
145
  "chars": "chars"
package/locale/zh.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "文件编辑器",
4
- "description": "让分栏里的文本文件可以直接编辑:打开文件就地修改并保存到磁盘(Ctrl+S,可在状态栏键盘图标中改键),Ctrl+G 跳转到指定行,带版本冲突提示与重新加载;文件被外部修改或删除时主动提示。"
4
+ "description": "让分栏里的文本文件可以直接编辑:打开文件就地修改并保存到磁盘(Ctrl+S,可在状态栏齿轮打开的设置中心里改键),Ctrl+G 跳转到指定行,带版本冲突提示与重新加载;文件被外部修改或删除时主动提示。"
5
5
  },
6
6
  "action": {
7
7
  "save": "保存",
@@ -50,7 +50,6 @@
50
50
  "conflict": "模式偏好已被其他位置修改,已重新读取,请重试。"
51
51
  },
52
52
  "keymap": {
53
- "buttonTitle": "编辑器快捷键",
54
53
  "save": "保存",
55
54
  "saveAll": "保存全部",
56
55
  "deleteLines": "删行",
@@ -61,7 +60,7 @@
61
60
  "resetTitle": "把四个动作的键位恢复为默认(Ctrl+S / Ctrl+Shift+S / Ctrl+D / Ctrl+G)",
62
61
  "duplicate": "该组合已被其他动作占用,请换一个组合。",
63
62
  "reserved": "该组合被浏览器保留(如关闭/新建标签页),无法录制",
64
- "reservedHint": "浏览器保留组合(Ctrl/⌘+W、T、N、Q 等)无法录制",
63
+ "reservedHint": "浏览器保留组合(Ctrl/⌘+W、T、N、Q 等)与 Tab 缩进无法录制",
65
64
  "writeFailed": "保存快捷键失败",
66
65
  "conflict": "快捷键已被其他位置修改,已重新读取,请重试。"
67
66
  },
@@ -97,11 +96,50 @@
97
96
  "highlightActiveLineNote": "内置纯文本模式始终支持;其他编辑模式可经描述符 activeLine 声明遵循同一开关。",
98
97
  "showLineNumbers": "显示行号",
99
98
  "showLineNumbersTitle": "在内容左侧显示行号列",
99
+ "scrollBeyondLastLine": "滚动越过最后一行",
100
+ "scrollBeyondLastLineTitle": "在内容末尾之后保留可滚动空白,最后一行可滚动到视口顶部",
101
+ "showWhitespaceGroup": "显示空白字符",
102
+ "showWhitespaceSpaces": "显示空格",
103
+ "showWhitespaceSpacesTitle": "把空格字符显示为浅色间隔号 ·",
104
+ "showWhitespaceSpacesNote": "全局设置,对所有已挂载编辑器立即生效;默认关闭。",
105
+ "showWhitespaceTabs": "显示制表符",
106
+ "showWhitespaceTabsTitle": "把制表符显示为浅色箭头 → 并补位到停位",
107
+ "showWhitespaceTabsNote": "全局设置,对所有已挂载编辑器立即生效;默认关闭。",
108
+ "showWhitespaceNewlines": "显示换行符",
109
+ "showWhitespaceNewlinesTitle": "在每个行断的行尾显示浅色回车符 ↵(文件末尾的尾随换行不显示)",
110
+ "showWhitespaceNewlinesNote": "全局设置,对所有已挂载编辑器立即生效;默认关闭。",
111
+ "wordWrap": "自动换行",
112
+ "wordWrapTitle": "过长的行在编辑区宽度内自动折行显示",
113
+ "indentMode": "缩进模式",
114
+ "indentModeTitle": "Tab 键插入的缩进单位:自动探测当前文件 / 固定制表符 / 固定空格",
115
+ "indentModeAuto": "自动探测",
116
+ "indentModeTabs": "制表符",
117
+ "indentModeSpaces": "空格",
118
+ "indentWidth": "缩进宽度",
119
+ "indentWidthTitle": "空格模式下每级缩进的空格数",
120
+ "indentWidthNote": "仅「空格」模式生效;自动探测无信号时也用它作回退宽度。",
100
121
  "on": "开",
101
122
  "off": "关",
102
123
  "writeFailed": "保存设置失败",
103
124
  "conflict": "设置已被其他位置修改,已重新读取,请重试。"
104
125
  },
126
+ "settingsCenter": {
127
+ "title": "编辑器设置",
128
+ "close": "关闭",
129
+ "section": {
130
+ "appearance": "外观",
131
+ "behavior": "行为",
132
+ "indent": "缩进",
133
+ "wrap": "换行",
134
+ "keymap": "快捷键"
135
+ },
136
+ "wordWrapGlobalNote": "未设置时按扩展名默认(md 系开)",
137
+ "wrapOverrideLabel": "本类型换行",
138
+ "wrapOverrideFollow": "跟随全局",
139
+ "wrapOverrideOn": "强制开",
140
+ "wrapOverrideOff": "强制关",
141
+ "wrapOverrideNoExtension": "(无扩展名)"
142
+ },
105
143
  "status": {
106
144
  "lines": "行",
107
145
  "chars": "字符"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dybai/dsh-editor",
3
- "version": "0.8.0",
3
+ "version": "0.13.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "node --test index.test.js src/**/*.test.js host/**/*.test.js",