MCPcopy Index your code
hub / github.com/RustPython/RustPython / selectBuffer

Function selectBuffer

wasm/notebook/src/editor.js:53–68  ·  view source on GitHub ↗
(editor, buffers, name)

Source from the content-addressed store, hash-verified

51CodeMirror.defineMIME('text/x-notebook', 'notebook');
52
53function selectBuffer(editor, buffers, name) {
54 var buf = buffers[name];
55 if (buf.getEditor()) buf = buf.linkedDoc({ sharedHist: true });
56 var old = editor.swapDoc(buf);
57 var linked = old.iterLinkedDocs(function (doc) {
58 linked = doc;
59 });
60 if (linked) {
61 // Make sure the document in buffers is the one the other view is looking at
62 for (var name in buffers)
63 if (buffers[name] == old) buffers[name] = linked;
64 old.unlinkDoc(linked);
65 }
66 editor.focus();
67 // console.log(editor.getValue());
68}
69
70function openBuffer(buffers, name, text, mode, buffersDropDown, buffersList) {
71 buffers[name] = CodeMirror.Doc(text, mode);

Callers 2

index.jsFile · 0.90
newBufFunction · 0.85

Calls 1

focusMethod · 0.45

Tested by

no test coverage detected