Fix bug when using print() in Shell, add tag to Shell window title indicating selected language
This commit is contained in:
parent
8a5cdb94d1
commit
ceaa9be060
@ -231,6 +231,7 @@ public class CodeRunner {
|
|||||||
res = "";
|
res = "";
|
||||||
}
|
}
|
||||||
String result = res + sw.getBuffer().toString().trim();
|
String result = res + sw.getBuffer().toString().trim();
|
||||||
|
sw.getBuffer().setLength(0);
|
||||||
return result;
|
return result;
|
||||||
} catch (ScriptException ex) {
|
} catch (ScriptException ex) {
|
||||||
return formatEx(ex);
|
return formatEx(ex);
|
||||||
|
@ -75,6 +75,8 @@ public class Interpreter extends javax.swing.JInternalFrame {
|
|||||||
private AutoCompletion jsac = new AutoCompletion(jscomp);
|
private AutoCompletion jsac = new AutoCompletion(jscomp);
|
||||||
private AutoCompletion pyac = new AutoCompletion(pycomp);
|
private AutoCompletion pyac = new AutoCompletion(pycomp);
|
||||||
|
|
||||||
|
private Interpreter thisobject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form Interpreter
|
* Creates new form Interpreter
|
||||||
*
|
*
|
||||||
@ -82,6 +84,7 @@ public class Interpreter extends javax.swing.JInternalFrame {
|
|||||||
* "default".
|
* "default".
|
||||||
*/
|
*/
|
||||||
public Interpreter(String useLang) {
|
public Interpreter(String useLang) {
|
||||||
|
thisobject = this;
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
// Setup code runner
|
// Setup code runner
|
||||||
@ -96,8 +99,10 @@ public class Interpreter extends javax.swing.JInternalFrame {
|
|||||||
javascriptMenu.setSelected(false);
|
javascriptMenu.setSelected(false);
|
||||||
pythonMenu.setSelected(true);
|
pythonMenu.setSelected(true);
|
||||||
pyac.install(inputBox);
|
pyac.install(inputBox);
|
||||||
|
setTitle("Shell [python]");
|
||||||
} else {
|
} else {
|
||||||
jsac.install(inputBox);
|
jsac.install(inputBox);
|
||||||
|
setTitle("Shell [javascript]");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set font
|
// Set font
|
||||||
@ -439,8 +444,11 @@ public class Interpreter extends javax.swing.JInternalFrame {
|
|||||||
private boolean doSpecialCommands() {
|
private boolean doSpecialCommands() {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case "clc":
|
case "clc":
|
||||||
|
case "clear":
|
||||||
clrOutput();
|
clrOutput();
|
||||||
return false;
|
return false;
|
||||||
|
case "exit":
|
||||||
|
thisobject.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implement ans command
|
// Implement ans command
|
||||||
|
Loading…
x
Reference in New Issue
Block a user