KetraTerm
API · DevelopmentAll versions

withCommandLine

open fun <T> withCommandLine(action: (revision: Long, snapshot: TerminalShellCommandLineSnapshot?) -> T): T?

Runs a short conditional-edit action under the producer's revision guard. The revision must change for every authoritative editing update, including changes away from and back to an equal snapshot. The callback must finish before another producer update can become visible.

Session calls this with terminal mutation serialized, before acquiring its input admission monitor. Implementations must not acquire terminal state while holding an independent producer guard. Do not invoke external listeners under that guard. Return null without invoking action when this atomic capability is unsupported; ordinary activeCommandLine reads still work.