diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/repl.js | 13 | ||||
| -rw-r--r-- | docs/try.html | 1 |
2 files changed, 12 insertions, 2 deletions
diff --git a/docs/repl.js b/docs/repl.js index 7180ec53..cf7a9071 100644 --- a/docs/repl.js +++ b/docs/repl.js @@ -86,11 +86,12 @@ sysvals.setplot = (x,w) => { startPlot(); setPlot(x,w); } let keymode=0; // 1 for prefix let prefix='\\'; +let modified=ev=>ev.shiftKey||ev.ctrlKey||ev.altKey||ev.metaKey; doc.code.onkeydown = ev => { let k = ev.which; if (16<=k && k<=20) { return; - } if (k==13 && (ev.shiftKey||ev.ctrlKey||ev.altKey||ev.metaKey)) { // *-enter + } if (k==13 && modified(ev)) { // *-enter repl(); return false; } if (keymode) { keymode = 0; @@ -128,6 +129,7 @@ let setPrefix = () => { let c = Array.from(d)[1]; let t = d.slice(1+c.length).replace(';','\n'); let k = revkeys[c]; if (k) t += '\n'+prefix+(k==='"'?'"':k); + x.hashelp = i < 64; x.title = primhelp[c] = t; }); } @@ -135,7 +137,14 @@ setPrefix(); doc.kb.onmousedown = ev => { let t = ev.target; if (t.nodeName === 'SPAN') { - return typeChar(doc.code, t.textContent, ev); + if (ev.button || modified(ev)) { + let name = t.title.toLowerCase().replace(/ |\n\\.*/g,'') + .replace(/[\n/]/g,'_'); + if (t.hashelp) window.open('help/'+name+'.html'); + return false; + } else { + return typeChar(doc.code, t.textContent, ev); + } } } diff --git a/docs/try.html b/docs/try.html index 65b462f4..5b4526b9 100644 --- a/docs/try.html +++ b/docs/try.html @@ -32,6 +32,7 @@ <ul> <li>Documentation links for primitives are <a href="doc/primitive.html#functions">here</a>.</li> <li>You can type special characters with a back<em>slash</em> prefix, as shown by hovering over the character bar above. Customize the prefix with the input at the right.</li> + <li>Right- or modified click on a primitive to go to its help page!</li> <li>Any modifier with enter will execute, not just shift.</li> <li>The code window is vertically resizeable.</li> </ul> |
