twinejs icon indicating copy to clipboard operation
twinejs copied to clipboard

Tab indents in the passage/code editor are auto-indented as spaces

Open NathanMeyers42 opened this issue 3 years ago • 3 comments

Describe the bug.

Not sure if this would be better described as a bug or a feature request because I'm not sure if this is the intended behavior or not, but either way its not ideal.

Pressing tab creates a hard tab which is then auto-indented on subsequent lines as four spaces instead of a tab.

Steps to reproduce:

In the passage editor, press tab, then enter.

Expected behavior:

Tab indents should be auto-indented on subsequent lines as hard tabs.

ALTERNATIVELY

Pressing tab should insert four spaces rather than a hard tab. Pressing backspace while the cursor is on an indent should then delete four spaces instead of one (treating the group of spaces as a single soft tab).

Additional context on this problem.

No response

Twine version number

2.5.1

Does this problem occur with the web version of Twine or the desktop app?

Desktop app

What operating system does this problem occur on?

Windows

If this problem is occurring with the web version of Twine, what browser does it occur on?

No response

Presubmission checklist

  • [ ] I am interested in working on code that would fix this bug. (This is not required to submit a bug report.)
  • [X] I have done a search and believe that an issue does not already exist for this bug in the GitHub repository.
  • [X] I have read and agree to abide by this project's Code of Conduct.

NathanMeyers42 avatar Sep 16 '22 02:09 NathanMeyers42

I don't want to start a single TAB character vs multiple SPACE characters for Indentation war...

But in the case of the web-browser release of the Twine 2.x application I think using a single TAB character would be a better default as there is limited amount of storage space for Twine Projects within the web-browser's LocalStorage, especially if the application is being run locally from the Author's machine because that storage space is share with any other locally run HTML file.

greyelf avatar Sep 16 '22 19:09 greyelf

I have wildly inconsistent tab/space behavior in the editor (Windows, Chrome, web editor 2.5.1)

Pressing tab from the left margin: inserts 1 tab Open a block element with { Next line is indented with 2 spaces Pressing enter, a new line, indented with 2 spaces Inside a block, pressing tab from the left margin inserts 2 spaces and a tab Pressing enter from that line starts a new line with 2 spaces again.

image

rumorsmatrix avatar Nov 05 '22 19:11 rumorsmatrix

Agree, the problem here is that CodeMirror is autoindenting using spaces but not interpolating the tab key as spaces. I think the easiest solution is to use tabs in all cases.

klembot avatar Nov 09 '22 02:11 klembot