← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #174609]: X-1.0rc3: IDE: Indentation issues with scripts not conforming with current tab settings when editing

 

Question #174609 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/174609

Description changed to:
**** problem description / workaround

-indentation tabs are not handled at the time a script is loaded into
the IDE, only when editing a script in the IDE. Or more generally: when
loading a script, indentation is not normalized according to the current
settings in the IDE's preferences.

- So you might come up, with a situation, that a loaded script does not
conform to the current tab settings and things get messed up, when you
start editing.

- A workaround would be, to change all tabs to the required spaces in a
capable editor directly in the .py files with search-and-replace before
loading the script into the IDE

----------------------------------------------------------------------

I just upgraded to latest version of Sikuli to x-1.0rc3(r905) and have
issue with all the scripts written with previous version, which was
X-1.0rc2 IDE.

And I am sure that this has been asked and resolved previously as this
new version is here for more than a month.

Now, here is the problem -

With previous IDE, if I write "IF statement" like this - 
if (x == 1):
and I press enter then, cursor would go to the next line with indentation. like - 
if (x == 1):
    |
and if you see at the lower right corner of IDE, you would read something like - Line: 2; Column: 2
which essentially tells you that you are at line number two and column is also 2. That means that indentation would count as one column and you start writing from second column.

Now, do the same thing with new IDE. Write the same if statement and press enter & you would see exactly same thing - 
if (x == 1):
    |
But the only issue is when you see lower right corner of IDE. Now you see - Line: 2; Column: 5
Saw the difference in column number? Its because, this IDE considers one tab or one indentation as 4 spaces or 4 column to be specific. And you start writing from fifth column.

Now, this makes no difference if you are writing a new script in this new IDE. But when you open any script which was written in previous IDE, you encounter problem. Let me give you same example. You have script like below written in old IDE - 
if (x == 1):
    print x

and you open this script in new IDE. Now, you realize that you want a new statement inside "if statement". so, you move your cursor to end of the "if statement", that is at "if (x == 1): <---". And then you hit enter. Cursor still comes at the correct place visually with indentation and you write a new statement there - 
if (x == 1):
    popup something
    print x

and you expect the script to work because it has proper indentation and
you click big right arrow on top of the IDE. BUT script doesn't run.
WHY? Because first statement inside "IF" is at column 5 and second
statement inside "IF" is at column 2!!

Is it a known bug? or a bug at all and it is how it should be working?

Thanks,
Parva Thakkar

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.