TAB doesn't work unless point is at beginning of whitespace

Bug #898354 reported by Barry Warsaw
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
Medium
Andreas Roehler

Bug Description

revno 713

-----snip-----
class Foo:
    def bar(self, args):
        return sum(args)
-----snip-----

Now, go to the end of the bar(...): line and hit return. Then type 'try:'

Now hit C-n to move point down to the second 'r' in 'return'. Hit TAB. Nothing happens.

What should happen is that the return line gets indented 4 spaces, but point is still left on the second 'r'.

Instead, you have to hit TAB multiple times, to toggle the line from columns 0, 4, 8, 12, but then this leaves point at the beginning of the line.

Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 898354] [NEW] TAB doesn't work unless point is at beginning of whitespace

Am 30.11.2011 21:51, schrieb Barry Warsaw:
> Public bug reported:
>
> revno 713
>
> -----snip-----
> class Foo:
> def bar(self, args):
> return sum(args)
> -----snip-----
>
> Now, go to the end of the bar(...): line and hit return. Then type
> 'try:'
>
> Now hit C-n to move point down to the second 'r' in 'return'. Hit TAB.
> Nothing happens.
>
> What should happen is that the return line gets indented 4 spaces, but
> point is still left on the second 'r'.

that's because column 12 is right. A first TAB does nothing in this
case. A second TAB starts circling.

>
> Instead, you have to hit TAB multiple times, to toggle the line from
> columns 0, 4, 8, 12, but then this leaves point at the beginning of the
> line.
>

okay.
Could stipulate: when circling, keep relative position in line.

Is it worth the price?

Nice thing with present state is: column number mode indicates the indent.

Anyway, just tell what you prefer.

Cheers,

Andreas

Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
importance: Undecided → Medium
milestone: none → 6.0.4
Revision history for this message
Barry Warsaw (barry) wrote : Re: [Bug 898354] Re: TAB doesn't work unless point is at beginning of whitespace

On Dec 01, 2011, at 09:25 AM, Andreas Roehler wrote:

>Am 30.11.2011 21:51, schrieb Barry Warsaw:
>> Public bug reported:
>>
>> revno 713
>>
>> -----snip-----
>> class Foo:
>> def bar(self, args):
>> return sum(args)
>> -----snip-----
>>
>> Now, go to the end of the bar(...): line and hit return. Then type
>> 'try:'
>>
>> Now hit C-n to move point down to the second 'r' in 'return'. Hit TAB.
>> Nothing happens.
>>
>> What should happen is that the return line gets indented 4 spaces, but
>> point is still left on the second 'r'.
>
>that's because column 12 is right. A first TAB does nothing in this
>case. A second TAB starts circling.

I don't think that's right though. If you look at the intermediate code you'd
see this:

class Foo:
    def bar(self, args):
        try:
        return sum(args)

the return line should be at column 12, but instead it's at column 8. So the
first TAB should indent it to column 12 but doesn't.

>> Instead, you have to hit TAB multiple times, to toggle the line from
>> columns 0, 4, 8, 12, but then this leaves point at the beginning of the
>> line.
>>
>
>okay.
>Could stipulate: when circling, keep relative position in line.
>
>Is it worth the price?

Yes, I think point should stay at the same relative position on the line when
indentation changes. I'm fairly certain it did at one point. Shouldn't be
too hard to re-implement with marks I think.

>Nice thing with present state is: column number mode indicates the
>indent.

Yep, but not everyone enables column number mode.

Changed in python-mode:
status: New → In Progress
Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 898354] Re: TAB doesn't work unless point is at beginning of whitespace

[ ... ]
>> Nice thing with present state is: column number mode indicates the
>> indent.
>
> Yep, but not everyone enables column number mode.
>

py-indent-line, which is called by TAB
now will message indent reached

also got indent as return value

hope it's okay,

Andreas

Changed in python-mode:
status: In Progress → Fix Committed
Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.