Commit Graph
6 Commits
Author SHA1 Message Date
dotCooCoo 9c636b9036 Scripts: a character style applied to an empty frame styles text set later
CharacterStyle.applyTo returned early on any empty range, so on an empty
text frame it never reached charStyle.apply, which restyles the stored
runs of empty text. It now passes an empty frame through and keeps the
no-op only for an empty range inside text.
2026-11-22 03:42:21 -08:00
dotCooCoo 997375be0d Scripts: a batch keeps one copy of the style lists for its style objects
While a script runs a `command.batch`, the session kept the style lists
of every step that changed them, so each such step also made the next
edit copy the whole list. The session now keeps one copy of each open
document's lists, as the last step left them, and records the names of
the styles a step removed or renamed and the documents a step reverted.
The style objects check those names, so a style that a batch removes and
makes again, or renames and names back, is still a different style.
2026-11-21 22:27:14 -08:00
dotCooCoo c7671c615b Scripts: style objects see a style a batch removes and adds again
- A style object goes stale when the steps of one `command.batch` remove
  its style and add another under the same name, as it does when separate
  `vc.run` calls do. The session notes each batch step's style lists while
  a script runs, and the style objects check each of them.
- `add(name)` with all 4,096 style slots of the run taken throws before it
  adds the style; with one slot left it adds it.
- `typename` of a removed style's `characterAttributes` or
  `paragraphAttributes` throws `Stale style`, as its other members do.
- The style load commands refuse `data` over 64 MB without copying it.
- docs/mcp.md states the 64 MB limit for `data` and decoded `dataBase64`;
  docs/gaps.md G6 and the docs/roadmap.md M13 row list the script text
  and style members.
2026-11-21 21:02:47 -08:00
dotCooCoo de11e1e755 Scripts: style objects made before File > Revert go stale
A style object kept working after file.revert when the file read back held a style with the same name. Each style object now keeps the document's revert count, as text ranges do, and one made before a revert throws Stale style. The range style lists follow the per-paragraph entries of the text model, and the host name table lists the style classes.
2026-11-21 18:47:00 -08:00
dotCooCoo a2063cea75 Scripts: a style change that is put back keeps its style object
A removal or rename whose result cannot reach the script is put back,
and style objects now follow a command only once it is kept. A failed
atomic object-model call puts style objects back with the documents.
2026-11-21 18:10:38 -08:00
dotCooCoo 69448d0c23 Scripts: character and paragraph styles for scripts
document.characterStyles and document.paragraphStyles list a document's
styles, the Normal style first, and add, find and remove them. Each
CharacterStyle and ParagraphStyle has a name, its attributes, applyTo
with clearingOverrides, and remove; setting an attribute redefines the
style through charStyle.setAttrs or paraStyle.setAttrs. A text range's
characterStyles and paragraphStyles list the styles its text is in.

Style names are trimmed and must have 1 to 256 characters and no
control characters, one run names at most 4,096 styles, and a style
object throws Stale style once its style is removed or renamed by a
command. ParagraphStyle.characterAttributes is not available yet.

charStyle.load, paraStyle.load and textStyle.loadAll refuse a file
larger than 64 MB without reading it in full.
2026-11-21 18:10:34 -08:00