@@ -9,11 +9,6 @@ import ./lifecycle
99import ../ Objects / frameobject
1010import ../ Parser / [lexer, parser]
1111pyInit (@ [])
12- proc subsNonbreakingSpace (s: var string ) =
13- # # The leading space, if with following spaces, in on contenteditable element
14- # # will become `U+00A0` (whose utf-8 encoding is c2a0)
15- s = s.replace (" \xc2\xa0 " , " " )
16-
1712
1813var finished = true
1914var rootCst: ParseNode
@@ -36,24 +31,22 @@ var prompt: kstring
3631
3732let
3833 suitHeight = (StyleAttr .height, kstring " wrap-content" ) # XXX: still too height
39- preserveSpaces = (whiteSpace, kstring " pre" ) # ensure spaces remained
40- monospace = (StyleAttr .font_family, kstring " monospace" )
4134template oneReplLineNode (editable: static [bool ]; promptExpr, editExpr): VNode {.dirty .} =
4235 buildHtml:
4336 tdiv (class= " line" , style= style (
4437 (display, kstring " flex" ), # make children within one line
4538 suitHeight,
4639 )):
47- p (class= " prompt" , style= style (
48- suitHeight, monospace, preserveSpaces,
40+ pre (class= " prompt" , style= style (
41+ suitHeight,
4942 )):
5043 promptExpr
5144
52- p (class= " edit" , contenteditable= editable, style= style (
45+ pre (class= " edit" , contenteditable= editable, style= style (
5346 (flex, kstring " 1" ), # without this, it becomes uneditable
5447 (border, kstring " none" ),
5548 (outline, kstring " none" ),
56- suitHeight, monospace, preserveSpaces,
49+ suitHeight,
5750 )):
5851 editExpr
5952# TODO : arrow-up / arrow-down for history
@@ -91,7 +84,6 @@ proc createDom(): VNode =
9184 proc onKeydown (ev: Event , n: VNode ) =
9285 if KeyboardEvent (ev).keyCode == 13 :
9386 var input = $ n.dom.textContent
94- input.subsNonbreakingSpace
9587 pushHistory (prompt, input)
9688 interactivePython (input)
9789 n.dom.innerHTML = kstring " "
0 commit comments