MCPcopy Create free account
hub / github.com/Noumena-Network/code / fullViewportRepaintFromHome

Function fullViewportRepaintFromHome

src/ink/log-update.ts:1011–1042  ·  view source on GitHub ↗
(
  frame: Frame,
  stylePool: StylePool,
  previousFrame?: Frame,
  options?: {
    clearRowsBeforeWrite?: boolean
    clearViewportBeforeWrite?: boolean
    forceClearViewportRemainder?: boolean
  },
)

Source from the content-addressed store, hash-verified

1009}
1010
1011function fullViewportRepaintFromHome(
1012 frame: Frame,
1013 stylePool: StylePool,
1014 previousFrame?: Frame,
1015 options?: {
1016 clearRowsBeforeWrite?: boolean
1017 clearViewportBeforeWrite?: boolean
1018 forceClearViewportRemainder?: boolean
1019 },
1020): Diff {
1021 const screen = new VirtualScreen({ x: 0, y: 0 }, frame.viewport.width)
1022 screen.diff.push({
1023 type: 'stdout',
1024 content: options?.clearViewportBeforeWrite
1025 ? ERASE_SCREEN + CURSOR_HOME
1026 : CURSOR_HOME,
1027 })
1028 // shouldClearViewportRemainder returns false on identical-dimension frames
1029 // (empty-row loop), leaving stale cells below content on ctrl+l spam.
1030 // Force ESC[J (clear-to-end) without an ESC[2J that would scroll content
1031 // into scrollback.
1032 const clearToViewportEnd =
1033 options?.forceClearViewportRemainder ||
1034 shouldClearViewportRemainder(previousFrame, frame)
1035 renderFrameSlice(screen, frame, 0, frame.screen.height, stylePool, {
1036 clearRowTails: !options?.clearRowsBeforeWrite,
1037 clearRowsBeforeWrite: options?.clearRowsBeforeWrite,
1038 clearToViewportEnd,
1039 previousFrame,
1040 })
1041 return screen.diff
1042}
1043
1044function fullRepaintFromPreviousOutputTop(
1045 prev: Frame,

Callers 3

renderMethod · 0.85

Calls 2

renderFrameSliceFunction · 0.85

Tested by

no test coverage detected