Thomas Mueller - 2026-10-02

Investigated with temporary logging in the formatter and a test package that logs the bookmark positions every 50 ms:

  • The IDE passes the bookmarks and the breakpoints to the formatter as offsets (via GetStoredOffsetsForFormatter), and GExperts maps all of them to the correct new lines.
  • Right after formatting, the bookmarks are on the correct lines, also after the IDE has put the formatted text into the editor.
  • Shortly afterwards (about 90 ms, on the first Format Source after starting the IDE about 1.3 s) the IDE moves the bookmarks again as if the text had not changed, or deletes them. Breakpoints are not affected.
  • This happens every time the file contains breakpoints, and on the first Format Source after starting the IDE even without breakpoints. On later runs without breakpoints the bookmarks survive.
  • If the formatter does not offer offset remapping at all, the IDE loses the breakpoints and most bookmarks.

So this appears to be an IDE problem, possibly in the bookmark handling Embarcadero added in Delphi 13 (formerly the Parnassus Bookmarks plugin). When the Code Formatter expert is called directly (its own shortcut or the GExperts editor popup menu) instead of through the IDE's Format Source, it has a workaround for the same IDE behaviour since revision #5778: it records the bookmarks again after the IDE has moved them. That workaround is not applied to the IDE integration for now.