I have noticed that each time I open a C file in the Ripes GUI, after I save it and open it again, the same file appears in the Source Code section of the Editor tab, but the Input Type is always set to Assembly.
The Ripes.config file, which saves the settings of Ripes, contains the parameter input_type which stores an integer representing an element of the enumeration:
When I close the simulator with a C file open in the editor tab, the field input_type = 1 is saved in the Ripes.config, indicating that the last opened file (whose source code is in the sourcecode field of the Ripes.config file) was a C file.
The problem is the next time Ripes is opened, that value is changed in input_type = 0, which means that the file is always considered an Assembly.
Looking at the code, the option input_type is modified by the method EditTab::sourceTypeChanged() and is set as follows:
I have noticed that each time I open a
C
file in the Ripes GUI, after I save it and open it again, the same file appears in the Source Code section of the Editor tab, but the Input Type is always set toAssembly
.The Ripes.config file, which saves the settings of Ripes, contains the parameter
input_type
which stores an integer representing an element of the enumeration:https://github.com/mortbopet/Ripes/blob/878087332afa3558dc8ca657f80a16ecdcf82818/src/assembler/program.h#L17-L28
When I close the simulator with a
C
file open in the editor tab, the fieldinput_type = 1
is saved in the Ripes.config, indicating that the last opened file (whose source code is in thesourcecode
field of the Ripes.config file) was aC
file.The problem is the next time Ripes is opened, that value is changed in
input_type = 0
, which means that the file is always considered anAssembly
.Looking at the code, the option
input_type
is modified by the methodEditTab::sourceTypeChanged()
and is set as follows:https://github.com/mortbopet/Ripes/blob/878087332afa3558dc8ca657f80a16ecdcf82818/src/edittab.cpp#L255-L276
So when opening the simulator the input type is set as default as
m_ui->setCInput
has not been checked yet.In the EditTab constructor before the
m_ui
are toggled the following methods are called:https://github.com/mortbopet/Ripes/blob/878087332afa3558dc8ca657f80a16ecdcf82818/src/edittab.cpp#L112-L113
Those methods (that have a direct or indirect call to the method
sourceTypeChanged()
) change the input type toAssembly
.I suppose that those methods should not modify the input type, as it should be done in the constructor a few lines after:
https://github.com/mortbopet/Ripes/blob/878087332afa3558dc8ca657f80a16ecdcf82818/src/edittab.cpp#L127-L139
My proposal for the problem:
Move the
switch
to set the input type in the line following the statement to set the source code in the editor: