MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / onStateChanged

Method onStateChanged

tools/xsbug/CodeView.js:284–306  ·  view source on GitHub ↗
(code, state)

Source from the content-addressed store, hash-verified

282 this.data.at = undefined;
283 }
284 onStateChanged(code, state) {
285 if (state) {
286 let line = state.line;
287 if (line) {
288 let offset = code.hitOffset(0, code.lineHeight * (line - 1));
289 let from = code.findLineBreak(offset, false);
290 let to = code.findLineBreak(offset, true);
291 code.select(from, to - from);
292 this.onReveal(code);
293 }
294 else {
295 let selection = state.selection;
296 if (selection) {
297 code.select(selection.offset, selection.length);
298 let scroll = state.scroll;
299 if (scroll)
300 code.container.scroll = scroll;
301 else
302 this.onReveal(code);
303 }
304 }
305 }
306 }
307 onStateChanging(code) {
308 this.data.state = {
309 scroll: code.container.scroll,

Callers 5

onDisplayingMethod · 0.95
onDirectoryChangedMethod · 0.95
activateMethod · 0.45
activateMethod · 0.45
onStringChangedMethod · 0.45

Calls 2

onRevealMethod · 0.95
selectMethod · 0.45

Tested by

no test coverage detected