March 20, 2020 at 16:03 #27716
I have a program generated from STM32CubeMX. In the “main.c” file the TAB works when I have to put, but when I have to remove it, it behaves as the space indicated in Options->Text editor->C/C++(visualGDB)->Tabulation, even if I selected “Mantain tabulation”. The dimension of the tabs is correctly handled in this window, but I can’t remove in the correct way.
However, another c file I created works smoothly, so I think it is related to how it is handled by the software.
Here attached is how the two files appear in the ide. I highlight what differs. I also attached the two files.
Can you explain me why the two files are handled in a different way?
Attachments:You must be logged in to view attached files.March 20, 2020 at 16:11 #27721
Sorry, unfortunately it’s hard to tell how to reproduce the problem based on your description.
Please describe it using the recommended 3-step format (including the screenshots of all relevant settings) so that we could follow exactly the same steps on our side and reproduce it.March 23, 2020 at 11:22 #27732
Ok, I will try to be more exhaustive:
I’m starting the debug of a project imported from CubeMX. I attached the project in .gpdsc format.
I would like to have intelligent indent. I’d expect that when I press backspace to the tab, the cursor goes back to as many spaces as set in the option menu. However, in the main.c file generated (attached, called “Tab not working”), when I press backspace the cursor goes back only one space. I attach the tab option menu.
I added another .c source file, called app_execute.c (attached, called “Tab working”). This file behaves exactly as expected. I’m attaching the two screenshots of the main.c file and app_execute.c file.
Can you explain why the two .c files behave in a different way in the tab indenting?
Attachments:You must be logged in to view attached files.March 25, 2020 at 05:43 #27745
Thanks for the detailed explanation. Unfortunately, it still doesn’t make full sense. Pressing backspace in the context of the “tab-not-working-1.png” screenshot would delete the ‘/’ character at the end of the /* USER CODE END Includes */ comment. This should not be affected by the tabs settings.
Generally, if you have generated a .c/.cpp file using STM32CubeMX, it will contain the tabs or spaces depending on the STM32CubeMX settings, not VisualGDB settings.
The VisualGDB settings for tabs and spaces will apply when adding new lines to the files, but it will not automatically replace them in existing files, to avoid unnecessary changes.
You can somewhat override it by removing all indentation (Ctrl-A to select the entire file, then press Shift-Tab several times) and reformatting the document using VisualGDB (Ctrl-K, Ctrl-D).
You must be logged in to reply to this topic.