sqlite-gui icon indicating copy to clipboard operation
sqlite-gui copied to clipboard

Incorrect indentation behavior

Open wdscxsj opened this issue 2 years ago • 6 comments

With "Editor indent" set to "4 spaces", a Tab always adds 4 spaces rather than padding to the next Tab position, i.e. a multiple of 4 characters.

For example, if the caret is at 1:3, a Tab moves it to 1:7, but 1:5 is expected.

wdscxsj avatar Aug 15 '22 07:08 wdscxsj

Fixed.

little-brother avatar Aug 19 '22 21:08 little-brother

Thanks for the update! I've tried sqlite-gui.1.7.7-x64-inja.zip but 4 spaces are always added despite the caret position.

wdscxsj avatar Aug 20 '22 03:08 wdscxsj

изображение

Maybe I missed something? Or do you expect another behaviour?

little-brother avatar Aug 20 '22 08:08 little-brother

The indentation logic may be incomplete. Please see my screen recording below.

https://user-images.githubusercontent.com/863369/185736545-dc8bced2-afee-4109-ab4b-213a1d4f5c26.mp4

wdscxsj avatar Aug 20 '22 08:08 wdscxsj

Do you mean that if the caret has a text leftward then on TAB the editor should add IndentSpaceCount - length(line) % IndentSpaceCount e.g. _abc| --> _abc____| (adds 4 spaces for TAB = 8 spaces)?

I didn't use space intendation and therefore I don't know what I should to do.

little-brother avatar Aug 20 '22 09:08 little-brother

Yes, that's correct. A Tab key should always move the caret to a "Tab position", i.e. column 4n + 1 (or 8n+1, 2n+1, depending on the setting). All text editors I've used work this way. For example, you can try these in VSCode's settings.json:

"editor.insertSpaces": true,
"editor.tabSize": 4,

wdscxsj avatar Aug 20 '22 09:08 wdscxsj

Fixed.

little-brother avatar Mar 03 '23 22:03 little-brother