Freeze content on window resize: Lock reading column and scroll position

Preface

When reading long answers in the DeepSeek Harness (DSH) Web GUI, if you drag the window edge while reading, paragraphs re-wrap and the line your eyes are on often “jumps” away. This is not a scrollbar misfire: the conversation column width changes with the pane, and the browser still stores scrollTop in pixels, so after rewrapping the same value no longer points to the same text. DSH’s built-in resize handling will follow the tail or re-probe the current turn, but it won’t restore the reader’s original reading anchor.

The following introduces the community client plugin freeze-content-on-window-resize (maintainer nnnanann). It locks the conversation reading column width during window resize and tries to preserve the reading position during and after resizing, reducing line-jumping caused by long-text reflow.

What is this

freeze-content-on-window-resize is a client plugin for the DSH Web GUI: it locks the width of the conversation column you are reading and compensates the reading anchor on window resize, so long answers no longer fully reflow due to changes in window width.

The DSH ecosystem emphasizes “everything is a plugin”; community directories such as SkillHub are independent from DeepSeek / High-Flyer and are not official app stores. Before installing, review the source and license yourself — the plugin runs locally in the Web GUI within the current DSH process, with permissions identical to the host.

Background: why lines get “lost”

Behavior verified on DSH 0.2.0-rc.2 (win32) is roughly as follows (the plugin depends on DSH’s stable data-* attributes rather than hashed classes, so newer versions usually still work):

The conversation column sits inside a scroll container, and its content width is determined jointly by the pane and ResizeObserver. When no dragged width has been persisted locally, the width is roughly clamp(680px, 0.64 × pane, 920px), varying gradually with the window across a pane range of about 1063–1438px; every resize step may cause reflow. If the width has been dragged, the preference stored in localStorage["dsh.conversation.contentWidth"] is used, and it only shrinks again when the pane can no longer fit it.

Meanwhile scrollTop remains at the old pixel position, and after reflow the visual anchor shifts. The README provides a measurement example: when forced to narrow by about 140px, the reading line can shift by about 2417px; with anchor compensation enabled it can return to 0px offset (see repo docs/self-test.md for the method).

Core features

Mechanism Effect
Lock content width For the mounted reading column, fix width / min-width / max-width (with !important) at the same pixel width, so line wrapping no longer changes with the window; when the window narrows, horizontal scrolling appears instead of reflow.
Keep reading position Each column maintains a live anchor (the data-chat-anchor-key on the reading line and its offset relative to the top of the viewport); after resize or zoom, realign across two animation frames plus one delayed pass.

Additional notes (consistent with the README):

  1. When the view is in “follow tail” state ([data-chat-following-tail]), anchor compensation yields, letting DSH’s built-in follow-tail logic take over; width locking still applies.
  2. Conversation transcripts embedded in the sidebar still use the panel’s own width and are not affected by this plugin’s handling of the main reading column.
  3. After locking, widening the window no longer automatically widens the reading column (unlike stock DSH, which widens when clamp is not saturated). This is a deliberate trade-off: once the width is chosen it stays fixed; to change it, use the panel Width or DSH’s built-in drag handle.

Dependencies and environment:

  • Requires DSH with the Web GUI (desktop window or dsh web).
  • No extra npm dependencies, no build step; the client entry is the committed client/client.js (a hand-written bundle loaded via window.__ModuleLoader__.load).

Installation and activation

The profile name corresponds to the directory under ~/.dsh/profiles/; the doc examples use desktop, replace it with your own profile.

Recommended method (no manual clone needed):

dsh plugin --profile desktop add github:nnnanann/Deepseek-harness-freeze-content-on-window-resize

dsh plugin add passes the argument through to pnpm; any spec supported by pnpm can be tried. If the current DSH build does not accept the github: spec, use link: from a local checkout (the README also gives a git clone + link: example; clone steps are not expanded here).

After installation it writes to the profile’s package.json, appends freeze-content-on-window-resize to dsh.profile.bundles, and completes installation. An already-open GUI page can hot-load; generally no need to restart DSH.

Uninstall:

dsh plugin --profile desktop remove freeze-content-on-window-resize

Typical usage

UI controls

There is a ~26px, mostly-transparent lock button at the bottom-right of the window (fixed to the window; it may overlay the sidebar when the sidebar is open; it can be hidden in the panel). Clicking it opens the settings panel; the main items are as follows:

Panel item Meaning
Lock content width / 锁定内容宽度 Master switch; turning it off restores DSH default behavior.
Width / 宽度 A number or presets 620 / 680 / 748 / 820 / 920; on first run it adopts DSH’s current content width to avoid a jump at install time.
Keep reading position / 保持阅读位置 Anchor compensation switch.
Show this control / 显示此控件 Hide the bottom-right button.
Reset / 恢复默认 Restore default settings.

Panel text follows the DSH UI language; the plugin ships a Chinese-English dictionary and falls back to Chinese for other languages. Grey text under the switches explains the trade-off: once locked, text no longer reflows with window width; if the window narrows, horizontal scrolling appears.

Keyboard shortcuts

Shortcuts do not take effect when a text input is focused:

Shortcut Action
Alt+Shift+L Toggle width lock
Alt+Shift+W Cycle preset widths

DSH’s built-in column-width dragging (cursor: col-resize) still works: pressing and dragging releases the lock, and after releasing the pointer the dragged width becomes the new locked width.

Config storage

Settings are stored in the page localStorage under freeze-content-on-window-resize:config; width: 0 means “adopt DSH’s own width”, parsed and written with the actual value on first run. Example:

{ "lockWidth": true, "width": 748, "keepPosition": true, "showControl": true }

Console diagnostics

In the DevTools console:

__fcwr.status()
__fcwr.realign()
__fcwr.dispose()

At startup the console prints one line of log in the current language, e.g. locking the column width or width lock off. There is also a freeze-content-on-window-resize:boot stamp recording the revision, column width, and anchor, etc., for troubleshooting.

Use cases and notes

Suitable for: developers or everyday users who frequently read long answers in the DSH Web GUI, need split screens or frequent window resizing, and want stable line wrapping with minimal reading-position loss.

Notes:

  1. After the width is locked, simply making the window wider will not automatically widen the reading column; you need to consciously adjust Width or drag the DSH handle.
  2. On narrow windows horizontal scrolling may appear; this is the direct result of locked wrapping.
  3. The plugin only works at the client Web layer and does not modify the DSH server; for installation and updates use the dsh plugin command from the official README, and verify the MIT license and source code.
  4. The development validation baseline is DSH desktop 0.2.0-rc.2; on other versions, if the DOM or attributes change, verify yourself.

Implementation notes (brief)

The plugin does not depend on hashed classes; it mainly uses DSH stable attributes, e.g. [data-chat-flow] (column), [data-conversation-scroll] (outer scroll), [data-composer-seat], [data-chat-anchor-key], [data-chat-following-tail]. The width variable is only written back to the element that holds both the column and the relevant context, to avoid affecting sidebar transcripts.

Conclusion

freeze-content-on-window-resize uses “lock column width + anchor compensation” to deal with reflow and scroll misalignment in the DSH conversation area on resize, suitable for long-text reading scenarios. Installation and configuration follow the repo README.

  • Directory page: https://www.skillhub.cn/plugins/nnnanann/Deepseek-harness-freeze-content-on-window-resize
  • GitHub: https://github.com/nnnanann/Deepseek-harness-freeze-content-on-window-resize
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye