Skip to content

Commit

Permalink
improvements to web console page
Browse files Browse the repository at this point in the history
  • Loading branch information
refaktor committed Feb 29, 2024
1 parent 7629233 commit e4c132f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 2 additions & 0 deletions main_wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func InitRyeShell(this js.Value, args []js.Value) any {
ctx := ps.Ctx
ps.Ctx = env.NewEnv(ctx)
ES = ps
evaldo.ShowResults = false
/* bloc k := loader.LoadString(" ", false)
switch val := block.(type) {
case env.Block:
Expand All @@ -145,6 +146,7 @@ func RyeEvalShellLine(this js.Value, args []js.Value) any {
sig := false
subc := false

evaldo.ShowResults = false
code := args[0].String()
multiline := len(code) > 1 && code[len(code)-1:] == " "

Expand Down
25 changes: 13 additions & 12 deletions wasm/ryeshell/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
font-family: mono;
font-size: 13px;
border: 1px solid #c6c6c6;
width: 340px;
width: 360px;
background-color: #f1f1f1;
}
#code_static1, #code_static2, .code_s {
Expand Down Expand Up @@ -228,8 +228,8 @@

<body onload="onLoadX()" class='page page-default-single'><!doctype html>

<h3 style="font-family: mono; font-weight: normal; font-size: 14px; color: #999; padding: 0px 10px;">Rye shell</h3>
<div id="terminal" style="width: 600px; padding: 10px; borde: 1px solid gray; background-color: #111; " ></div>
<h3 style="font-family: mono; font-weight: normal; font-size: 14px; color: #999; padding: 0px 10px;">Rye console (web)</h3>
<div id="terminal" style="width: 620px; padding: 10px; borde: 1px solid gray; background-color: #111; " ></div>
<script>

let theme = {
Expand All @@ -255,10 +255,11 @@ <h3 style="font-family: mono; font-weight: normal; font-size: 14px; color: #999;
}

term = new Terminal({
windowsMode: ['Windows', 'Win16', 'Win32', 'WinCE'].indexOf(navigator.platform) >= 0,
fontFamily: '"Cascadia Code", Menlo, monospace',
fontSize: 13,
convertEol: true,
windowsMode: ['Windows', 'Win16', 'Win32', 'WinCE'].indexOf(navigator.platform) >= 0,
fontFamily: '"Cascadia Code", Menlo, monospace',
fontSize: 13,
convertEol: true,
rows: 30,
})

// term.setOption('theme', theme)
Expand All @@ -274,7 +275,10 @@ <h3 style="font-family: mono; font-weight: normal; font-size: 14px; color: #999;
// var term = new Terminal();
term.open(document.getElementById('terminal'));
term.focus()
term.writeln("Welcome to Rye console in the browser. It's still work in progress. Have fun.")
term.writeln("Welcome to Rye web console. It's a work in progress. Visit \033[38;5;14mryelang.org\33[0m for more.")
term.writeln("- \033[38;5;246mtype in lsp (list parent context) too see some functions, or ls to see yours \033[0m-")
term.writeln("--------------------------------------------------------------------------------")

var currLine = "";
var entries = [];
term.onKey((ev) => {
Expand Down Expand Up @@ -304,11 +308,8 @@ <h3 style="font-family: mono; font-weight: normal; font-size: 14px; color: #999;
term.focus();
}
}
setTimeout(2000, function () {
sendToTerminal("Welcome to Rye web console", term);
});
</script>

<br/>
<button onclick="sendToTerminal('print 123', term)">hello world</button>
</body>
</html>
Expand Down

0 comments on commit e4c132f

Please sign in to comment.