mirror of
https://github.com/pyscript/pyscript.git
synced 2026-03-17 22:00:14 -04:00
In a Py-Repl, Shift Enter Shouldn't Insert Newline (#1094)
* Prevent shift-enter adding newlines in Py-Repl * Add test
This commit is contained in:
@@ -68,8 +68,8 @@ export function make_PyRepl(runtime: Runtime) {
|
||||
languageConf.of(python()),
|
||||
keymap.of([
|
||||
...defaultKeymap,
|
||||
{ key: 'Ctrl-Enter', run: this.execute.bind(this) },
|
||||
{ key: 'Shift-Enter', run: this.execute.bind(this) },
|
||||
{ key: 'Ctrl-Enter', run: this.execute.bind(this), preventDefault: true },
|
||||
{ key: 'Shift-Enter', run: this.execute.bind(this), preventDefault: true },
|
||||
]),
|
||||
];
|
||||
|
||||
|
||||
@@ -69,6 +69,9 @@ class TestPyRepl(PyScriptTest):
|
||||
assert self.console.log.lines[0] == self.PY_COMPLETE
|
||||
assert self.console.log.lines[-1] == "hello world"
|
||||
|
||||
# Shift-enter should not add a newline to the editor
|
||||
assert self.page.locator(".cm-line").count() == 1
|
||||
|
||||
def test_display(self):
|
||||
self.pyscript_run(
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user