MobiFlight-Connector
MobiFlight-Connector copied to clipboard
Code translation from Hubhop to MFConnector does not add necessary spaces
Describe the bug Event updated with new code for CJ4 RUNSTOP button, when I updated the event to MF and received the code in the input code box, it had a missing space before the els clause.
Steps To Reproduce Steps to reproduce the behavior:
- Create an event in Hubhop that has an els clause at the beginning of a line, like this...
(A:GENERAL ENG MIXTURE LEVER POSITION:1, Percent) 0 >
if{ 0 (>K:MIXTURE1_SET) 0 (>K:SET_FUEL_VALVE_ENG1) }
els{ 16384 (>K:MIXTURE1_SET) 1 (>K:SET_FUEL_VALVE_ENG1) }
Note that the code has a space at the end of the preceding line but no space before the "els"
- Save the event in Hubhop
- Update events in MF Connector
- Look for the event code in the Input config UI.
- Note that the spacing and linefeeds have been stripped in the conversion and the els has no preceding space.
Expected behavior As the custom input box can handle the linefeeds in the same way as Hubhop can handle line feeds, there is no need to strip the linefeeds from the code in Hubhop any more (it is not events.txt). I suggest the linefeed stripping not be done in the import into MF Connector. This also has the benefit of maintaining the code readability already established in Hubhop. Then allow MF Connector to strip linefeeds, as it already does, when sending to the simulator.
Actual behavior The conversion before sending code from Hubhop to MFConnector is stripping linefeeds (and not replacing with spaces), but also stripping spaces at the end of lines, thus the els had no preceding space. This is the code received. Note there is no preceding space in the els:
Details
- MobiFlight Version: 9.2.0.5
- FlightSim: irrelevant
- AddOn: irrelevant
Additional context If my suggestion is followed, then no processing of the code text is necessary when updating events into MF Connector, so that readability is maintained consistent between Hubhop and MF Connector. This should be very easy to implement.
~~@JaimeLeon2 can you please verify that this is not the case anymore in 9.3.2~~
Nevermind, it is still the case...
The custom input code box is not rendering the CRLF properly from the Hubhop code text received. This is what is causing the visually missing spaces, invisible characters and lack of proper spacing in the code. When the same code text is copied over to Notepad++ the code spacing and CRLF are properly shown, so it seems it is an issue only with the code box itself not displaying the contents as expected.