IDE incorrectly interprets a tabs

Asked by Rafał Kasza

1) Sikuli IDE 1.0rc3(r905)
2) Windows XP (5.1.2600) 32 bit, Java 1.7.0_01
3) Example of affected code (example_file.py):

for row in input_table:
 CPregion.type(Key.BACKSPACE+Key.BACKSPACE+Key.BACKSPACE+Key.BACKSPACE+Key.BACKSPACE+row+Key.F8)

 if CPregion.exists(Pattern("1330069906203.png").similar(0.96)):
            CPregion.click(Pattern("1330069906203.png").similar(0.90))
            CPregion.type('polska'+Key.F8+Key.ENTER)
            CPregion.click(Pattern("ZipCade-1.png").similar(0.90).targetOffset(168,3))
        else:
            CPregion.click(Pattern("POI-2.png").similar(0.80))
            CPregion.type('POLSKA'+Key.F8+Key.ENTER)
            CPregion.click(Pattern("ZipCade-1.png").similar(0.90).targetOffset(168,3))

Line containing "else" is affected. In source file there are two tabs but in IDE i have to put three, that is is very confusing. I think screenshot would be better explanation, so Im sending the same part of code in IDE. In case "else" clause is on "if" level, IDE produces py code that does not work correctly.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Rafał Kasza
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

This is not a bug. see comment on question.

Revision history for this message
RaiMan (raimund-hocke) said :
#2

With version rc3 an option "tabs-to-spaces" was introduced, that in the standard is set and turns an entered tab in the IDE into 4 spaces.

If things mix up (older scripts from the time before rc3, edited with other editors), you have to set the option in the Preferences accordingly.

Currently, there is no feature, that reformats the whole script according to the current setting (but it is a feature request already).

The easiest way to fix this kind of problem, is to open the .py file inside the .sikuli with an external editor, that has this feature.

Revision history for this message
Rafał Kasza (rkasza) said :
#3

Thanks for the explanation.