Skip to content

Commit 71a1e4c

Browse files
Remove support to .txt file
1 parent e2d010b commit 71a1e4c

File tree

7 files changed

+6
-90
lines changed

7 files changed

+6
-90
lines changed

src/application.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default class C0VMApplication extends React.Component<
3333
BC0SourceCode: "",
3434
BC0BreakPoints: new Set(),
3535

36-
C0Editors: [{ title: "Untitled_0.c0", key: 0, content: "", breakpoints: [], noCompile: false }],
36+
C0Editors: [{ title: "Untitled_0.c0", key: 0, content: "", breakpoints: [] }],
3737
ActiveEditor: 0,
3838

3939
PrintoutValue: "",

src/components/code-editor.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ export default class CodeEditor extends React.Component
6767
key: this.state.C0_nextKey,
6868
content: "",
6969
breakpoints: [],
70-
noCompile: false,
7170
});
7271
this.props.set_app_state({C0Editors: new_editors, ActiveEditor: this.state.C0_nextKey});
7372
this.setState({C0_nextKey: this.state.C0_nextKey + 1});
@@ -101,7 +100,6 @@ export default class CodeEditor extends React.Component
101100
key: -1,
102101
content: res,
103102
breakpoints: [],
104-
noCompile: F.name.endsWith(".txt")
105103
})
106104
};
107105
reader.readAsText(F, "utf-8");
@@ -121,7 +119,7 @@ export default class CodeEditor extends React.Component
121119
update_content(key: number, s: string) {
122120
let ns: C0EditorTab[] = [...this.props.app_state.C0Editors];
123121
ns = ns.map((tab) => tab.key === key ? {
124-
key: tab.key, title: tab.title, content: s, breakpoints: tab.breakpoints, noCompile: tab.noCompile
122+
key: tab.key, title: tab.title, content: s, breakpoints: tab.breakpoints
125123
} : tab);
126124
this.props.set_app_state({C0Editors: ns, contentChanged: true});
127125
}

src/components/code_editor/c0-editor-group.tsx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import DraggableTabs from "./draggable_tabs";
88
import EditableTab from "./editable_tabs";
99

1010
import type { RcFile } from 'antd/lib/upload';
11-
import TextEditor from "./text-editor";
1211

1312
const { TabPane } = Tabs;
1413
const regex_valid_file_name = /^[0-9a-zA-Z_-]+\.(c(0|1)|txt)$/;
@@ -65,8 +64,6 @@ export default class C0EditorGroup extends React.Component <C0EditorGroupProps>
6564
for (let i = 0; i < new_tabs.length; i ++) {
6665
if (new_tabs[i].key === key) {
6766
new_tabs[i].title = name;
68-
if (name.endsWith(".txt")) new_tabs[i].noCompile = true;
69-
else new_tabs[i].noCompile = false;
7067
}
7168
}
7269
return { C0Editors: new_tabs };
@@ -151,15 +148,7 @@ export default class C0EditorGroup extends React.Component <C0EditorGroupProps>
151148
closable = {this.props.appState.C0Editors.length !== 1}
152149
closeIcon={<FontAwesomeIcon icon={faXmark}/>}
153150
>
154-
{
155-
editor.title.endsWith(".txt")
156-
? <TextEditor
157-
editorValue = {editor.content}
158-
updateContent = {(s) => this.props.updateContent(editor.key, s)}
159-
updateCompileLine = {fileArr => console.log(fileArr)}
160-
updateName = {(name) => this.set_tab_name(editor.key, name)}
161-
/>
162-
: <C0Editor
151+
<C0Editor
163152
execLine = {lineNumber}
164153
editorValue = {editor.content}
165154
breakPoints = {editor.breakpoints}
@@ -168,7 +157,7 @@ export default class C0EditorGroup extends React.Component <C0EditorGroupProps>
168157
setBreakPts = {(bps) => this.set_brkpt_for_editor(editor.key, bps)}
169158
editable = {this.props.currLine === undefined}
170159
handle_import_folder = {(F: RcFile, FList: RcFile[]) => this.props.handle_import_folder(F, FList)}
171-
/>}
160+
/>
172161
</TabPane>;
173162
}
174163
)

src/components/code_editor/editor_extension/compileline_position.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/components/code_editor/text-editor.tsx

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/network/remote_compile.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export default function remote_compile(
1919
/** Update since v1.0.4 - print out the compile command when user hit compile button */
2020
let compile_command = "$ cc0 ";
2121
for (let tab of app_state.C0Editors) {
22-
if (tab.noCompile) continue;
2322
compile_command += " " + tab.title;
2423
}
2524
compile_command += app_state.CompilerFlags["d"] ? " -d" : "";
@@ -36,8 +35,8 @@ export default function remote_compile(
3635
"Access-Control-Allow-Origin": "*",
3736
},
3837
body: JSON.stringify({
39-
codes : app_state.C0Editors.filter(tab => !tab.noCompile).map(tab => tab.content),
40-
filenames: app_state.C0Editors.filter(tab => !tab.noCompile).map(tab => tab.title),
38+
codes : app_state.C0Editors.map(tab => tab.content),
39+
filenames: app_state.C0Editors.map(tab => tab.title),
4140
})
4241
})
4342
.then(

src/types/react-interface.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ type C0EditorTab = {
2323
key : number, /* Key of editor tab */
2424
content: string, /* Content (raw string) of that tab */
2525
breakpoints: BreakPoint[], /* Breakpoints attatched to that tab */
26-
noCompile: boolean /* true to ignore this file in compile process */
2726
};
2827

2928
interface C0VMApplicationProps {

0 commit comments

Comments
 (0)