@@ -230,7 +230,7 @@ export default function Window({ application, session }) {
230
230
let compiler_rust = null ;
231
231
let builder_python = null ;
232
232
233
- async function runCode ( { format } ) {
233
+ async function runCode ( ) {
234
234
button_run . set_sensitive ( false ) ;
235
235
236
236
term_console . clear ( ) ;
@@ -240,9 +240,7 @@ export default function Window({ application, session }) {
240
240
try {
241
241
await panel_ui . update ( ) ;
242
242
243
- if ( format ) {
244
- await formatCode ( ) ;
245
- }
243
+ await formatCode ( ) ;
246
244
247
245
await compile ( ) ;
248
246
} catch ( err ) {
@@ -346,7 +344,7 @@ export default function Window({ application, session }) {
346
344
name : "run" ,
347
345
} ) ;
348
346
action_run . connect ( "activate" , ( ) => {
349
- runCode ( { format : true } ) . catch ( console . error ) ;
347
+ runCode ( ) . catch ( console . error ) ;
350
348
} ) ;
351
349
window . add_action ( action_run ) ;
352
350
application . set_accels_for_action ( "win.run" , [ "<Control>Return" ] ) ;
@@ -380,7 +378,7 @@ export default function Window({ application, session }) {
380
378
window . present ( ) ;
381
379
382
380
const documents = Object . values ( langs ) . map ( ( lang ) => lang . document ) ;
383
- async function load ( { run } ) {
381
+ async function load ( ) {
384
382
panel_ui . stop ( ) ;
385
383
previewer . stop ( ) ;
386
384
documents . forEach ( ( document ) => document . stop ( ) ) ;
@@ -397,15 +395,11 @@ export default function Window({ application, session }) {
397
395
398
396
await previewer . useInternal ( ) ;
399
397
400
- if ( run ) {
401
- await runCode ( { format : false } ) ;
402
- } else {
403
- term_console . clear ( ) ;
404
- panel_ui . start ( ) ;
405
- await panel_ui . update ( ) ;
406
- previewer . start ( ) ;
407
- await previewer . update ( true ) ;
408
- }
398
+ term_console . clear ( ) ;
399
+ panel_ui . start ( ) ;
400
+ await panel_ui . update ( ) ;
401
+ previewer . start ( ) ;
402
+ await previewer . update ( true ) ;
409
403
410
404
documents . forEach ( ( document ) => {
411
405
document . start ( ) ;
@@ -414,7 +408,7 @@ export default function Window({ application, session }) {
414
408
term_console . scrollToEnd ( ) ;
415
409
}
416
410
417
- return { load, window } ;
411
+ return { load, window, runCode } ;
418
412
}
419
413
420
414
async function setGtk4PreferDark ( dark ) {
0 commit comments