QB64-Phoenix-Edition / QB64pe

The QB64 Phoenix Edition Repository
https://qb64phoenix.com
Other
119 stars 26 forks source link

Allow Single-Line Indentation Decrease With Shift-Tab #511

Open vivid-pixel opened 2 months ago

vivid-pixel commented 2 months ago

Describe the feature request (Edited because the behavior is not a bug) Using TAB to indent works on the keyboard, but not through the toolbar menu. Shift-TAB does not work in the editor nor the toolbar.

To Reproduce Steps to reproduce the behavior:

  1. Launch QB64 PE.
  2. Type some code blocks where you'll need to indent, nesting at least two of them.
  3. Press tab one time too many on the second block. Shift-Tab won't decrease the indentation.
  4. Press Backspace. Rather than remove one single tab/4 characters, this removes multiple indentations and brings the cursor back to the start of the line.
  5. Now press tab the correct number of times to indent how you intended.

Expected behavior Shift-Tab should decrease spacing by the number of spaces designated in the IDE for indentation.

Screenshots

Screenshot 2024-06-22 at 9 10 07 PM

Desktop (please complete the following information):

RhoSigma-QB64 commented 2 months ago

Hello vivid-pixel, from your provided screenshot I see you've no text selected. Note that the increase/decrease functions are block operations, hence only available and working on a selected text block.

Note also that manually indenting is only useful when the automatic code indention (see menu Options > Code Layout) is disabled, otherwise the automatic process would constantly compromise your manually made indentions.

vivid-pixel commented 2 months ago

Ah, I assumed the indentation could still be manually de-indented like in other IDEs! I do find myself wanting to de-indent manually sometimes despite the automatic formatting, so I suppose this would be more of a feature request than bug. I do manually hit Tab so I'm just not sure why Shift-Tab can't work the other way around.

vivid-pixel commented 2 months ago

@RhoSigma-QB64: I appreciate you clarifying the block-indenting feature. I edited the post since this is not a bug report, but I cannot add labels. Are you able to add a label for feature enhancement?

I do think if Tab currently increases indentation by one tab or the specified number of characters, Shift-Tab should do the reverse, rather than nothing at all. Currently, indenting too far requires pressing Backspace to remove indentation, but that removes the whole line of indentation rather than just one tab, so you may have to press tab multiple times to get back into position.

I would expect this manual de-indentation to work regardless of the automatic indentation feature. If it's incorrect (whether too many, or too few spaces) then it gets corrected upon moving to the next line. Same as most other code editors, I think!