dialogic icon indicating copy to clipboard operation
dialogic copied to clipboard

One space is counted as indentation

Open Jowan-Spooner opened this issue 2 years ago • 2 comments

The problem

Describe the bug When you add a space in front of a line, then the timelineLoader thinks it's indented. This happened to @thebardsrc. Her code had spaces in front of the choices. While this is kinda intentional, it's hard to notice where the error comes from and a natural thing to do.

Solutions

Possible fixes We could make a one space not count as an indent. But I'm not sure if that won't have other problems. Let me know if you have suggestions on how to handle this.

Jowan-Spooner avatar Aug 04 '22 14:08 Jowan-Spooner

well tabs and spaces have different actual codes in ASCII. mechanically, it's easy enough to strip just leading spaces before processing any line, though it would need some kind of check too if for some reason somone was making a text box that started with spaces

i see more of a problem if someone were making a timeline manually in say notepad, somewhere that didn't have any kind of tab indicator like most code editors have, and they mess up and put spaces instead of tabs and don't realize it

exelia-antonov avatar Aug 04 '22 15:08 exelia-antonov

Currently it just counts the number of non-printable characters before the first printable one. That means one space and one tab have the same effect on the parser, even though they are usually represented very differently. Also it just looks for DIFFERENCEs in the amount of those characters so it would technically undestand super weird looking indentation.

Jowan-Spooner avatar Aug 04 '22 15:08 Jowan-Spooner