File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Tools/wasm/emscripten/web_example Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 145145
146146 class WasmTerminal {
147147 constructor ( ) {
148+ try {
149+ this . history = JSON . parse ( sessionStorage . getItem ( '__python_wasm_repl.history' ) ) ;
150+ this . historyBuffer = this . history . slice ( ) ;
151+ } catch ( e ) {
152+ this . history = [ ] ;
153+ this . historyBuffer = [ ] ;
154+ }
148155 this . reset ( ) ;
149156
150157 this . xterm = new Terminal ( {
172179 this . inputStartCursor = null ;
173180
174181 this . cursorPosition = 0 ;
175- this . history = [ ] ;
176- this . historyBuffer = [ ] ;
177182 this . historyIndex = - 1 ;
178183 this . beforeHistoryNav = "" ;
179184 }
319324 this . xterm . write ( "\x1b[" + suffix . length + "D" ) ;
320325 }
321326 this . cursorPosition += count ;
322- this . updateHistory ( false ) ;
327+ this . updateHistory ( ) ;
323328 }
324329
325330 handleCursorErase ( ) {
477482 this . historyBuffer . push ( value . slice ( 0 , - 1 ) ) ;
478483 this . historyIndex = - 1 ;
479484 this . cursorPosition = 0 ;
485+ try {
486+ sessionStorage . setItem ( '__python_wasm_repl.history' , JSON . stringify ( this . history ) ) ;
487+ } catch ( e ) {
488+ }
480489 }
481490 resolve ( value ) ;
482491 } ;
You can’t perform that action at this time.
0 commit comments