visitRows method
- void visitor()
Visits the live row iterator for this render state.
The rows exposed to visitor remain valid until this render state is
updated again.
Implementation
void visitRows(void Function(VtRenderRowCursor row) visitor) {
_ensureOpen();
final iterator = calloc<bindings.GhosttyRenderStateRowIterator>();
try {
_checkResult(
bindings.ghostty_render_state_row_iterator_new(ffi.nullptr, iterator),
'ghostty_render_state_row_iterator_new',
);
final iteratorHandle = iterator.value;
_checkResult(
bindings.ghostty_render_state_get(
_handle,
bindings
.GhosttyRenderStateData
.GHOSTTY_RENDER_STATE_DATA_ROW_ITERATOR,
iterator.cast(),
),
'ghostty_render_state_get',
);
while (bindings.ghostty_render_state_row_iterator_next(iteratorHandle)) {
visitor(VtRenderRowCursor._(iteratorHandle));
}
} finally {
final iteratorHandle = iterator.value;
if (iteratorHandle != ffi.nullptr) {
bindings.ghostty_render_state_row_iterator_free(iteratorHandle);
}
calloc.free(iterator);
}
}