thecocce / pyscripter

Automatically exported from code.google.com/p/pyscripter
0 stars 0 forks source link

execute selection #376

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
the following doesnt work

def test(a, b):
    a = 13
    b = 7
    print a + b

than mark line a=13 until print a+b and hit CTRL+F7 (execute selection) an 
error occurs unexpected indentation, which is obviously correct but doesn't 
help very much using this feature

Original issue reported on code.google.com by mproel...@googlemail.com on 1 Aug 2010 at 12:49

GoogleCodeExporter commented 9 years ago
Fixed in version control.  The leading whitespace of the first line is removed 
from all other lines.

Original comment by pyscripter on 15 Aug 2010 at 3:03

GoogleCodeExporter commented 9 years ago
Hi,

this bug is still active in version 2.1.1.0, if you mark line a = ... to print 
a + b, but start to mark the line a = 13 not from column 1 but from column 5

Original comment by mproel...@googlemail.com on 25 Aug 2010 at 5:36

GoogleCodeExporter commented 9 years ago
Well, select it from column 1.  If you want to execute multiple lines in Python 
then the code should be properly indented.  PyScripter is intelligent enough to 
remove the indentation of the first line from all lines.

In terms of your example how should PyScripter differentiate between
    for in range(10):
        print (i)
        print (i*i)

and the example you provided.

Original comment by pyscripter on 25 Aug 2010 at 9:50

GoogleCodeExporter commented 9 years ago
Hello,

I think you didn't understand me. The code is properly indented. Just have a 
look at my sample screenshot

Original comment by mproel...@googlemail.com on 25 Aug 2010 at 1:07

Attachments:

GoogleCodeExporter commented 9 years ago
The selection should be valid Python code and the selected block in the second 
case is not.

In the first case it becomes valid code if you remove the black space of the 
first line from all other lines, which is what PyScripter does.

Original comment by pyscripter on 25 Aug 2010 at 1:48

GoogleCodeExporter commented 9 years ago
Well, I don't share your opinion.
1. The first selection is also no correct python code, it becomes valid because 
pyscripter corrects it.
2. I think it would be very easy for pyscripter to correct the second selection 
as well.
3. There is a smart HOME key in pyscripter. I often select sections from the 
end to the beginning and than typing home browses me to the correct 
indentation. But with the current implementation, these two features don't meet.

Original comment by mproel...@googlemail.com on 30 Aug 2010 at 10:39

GoogleCodeExporter commented 9 years ago

Original comment by pyscripter on 30 Sep 2010 at 3:01

GoogleCodeExporter commented 9 years ago
to solve this issue :
* select all the code and press alt+shift+'
or
* menu select: Edit > Source Code > Untabify

do this once and the 'unexpected indent' message will no longer bother you..

Original comment by rawad....@gmail.com on 21 Nov 2014 at 11:42

Attachments: