@@ -49,16 +49,13 @@ class Display extends React.Component<DisplayProps & actionsInterface, DisplaySt
49
49
cursorBlinking : "phase" ,
50
50
cursorStyle : "line" ,
51
51
parameterHints : true ,
52
- readOnly : false ,
53
52
roundedSelection : true ,
54
53
scrollBeyondLastLine : false ,
55
54
scrollbar : {
56
55
vertical : "visible" ,
57
56
} ,
58
57
selectOnLineNumbers : true ,
59
- wrappingColumn : 0 ,
60
- fontFamily : this . props . settings . font + ", monospace" ,
61
- fontSize : this . props . settings . fontSize
58
+ wrappingColumn : 0
62
59
} ;
63
60
this . setState ( merge ( this . state , { editorLastUpdated : this . props . settings . updated } ) ) ;
64
61
if ( this . editor ) {
@@ -150,23 +147,31 @@ class Display extends React.Component<DisplayProps & actionsInterface, DisplaySt
150
147
return d . file === currentFile . name ;
151
148
} ) ;
152
149
const lang = currentFile . extension ( ) === "rkt" ? "racket" : "cpp" ;
150
+ const isBinary = currentFile . extension ( ) === "ll" ;
151
+ const fontOptions = isBinary ?
152
+ { lineNumbers : "off" , fontSize : 25 , fontFamily : "Arial" } :
153
+ { lineNumbers : "on" ,
154
+ fontSize : this . props . settings . fontSize ,
155
+ fontFamily : this . props . settings . font + ", monospace" } ;
156
+
153
157
return ( < div className = { styles . filePanel } >
154
158
< div className = { styles . editorContainer + " " + this . props . className }
155
159
ref = { ( elem : HTMLElement | null ) => { this . editorContainer = elem ; } } >
156
160
< MonacoEditor
157
161
dirty = { ! ! currentFile . unwrittenContent }
158
162
value = { ( currentFile . contents === false ||
159
163
currentFile . contents === undefined ) ? "Unavailable in browser!" :
160
- currentFile . contents . contents }
164
+ ( isBinary ? "This is a binary file!" :
165
+ currentFile . contents . contents ) }
161
166
theme = { this . props . settings . theme ? "vs" : "vs-dark" }
162
167
language = { lang }
163
168
diags = { currentQuestion . diags }
164
169
onChange = { this . onChange . bind ( this ) }
165
170
editorDidMount = { this . editorDidMount . bind ( this ) } requireConfig = { loaderOptions }
166
- readOnly = { ! currentFile . contents || currentFile . hasFlag ( FlagMask . READONLY ) }
171
+ readOnly = { ! currentFile . contents || isBinary || currentFile . hasFlag ( FlagMask . READONLY ) }
167
172
options = { { lineNumbersMinChars : 2 ,
168
173
minimap : { enabled : false } ,
169
- rulers : [ 0 ] } } />
174
+ rulers : [ 0 ] , ... fontOptions } } />
170
175
< Draggable axis = "x" handle = "div" onDrag = { this . handleDrag } onStop = { this . stopDrag } >
171
176
< div ref = { ( elem : HTMLElement | null ) => { this . resizeHandle = elem ; } }
172
177
className = { styles . resizeHandle } />
0 commit comments