[Geany-devel] Little questions

Eugene Arshinov earshinov at xxxxx
Tue Feb 23 07:43:39 UTC 2010


On Tue, 23 Feb 2010 00:52:07 +0100%
Colomban Wendling <lists.ban at herbesfolles.org> wrote:

> Eugene Arshinov a écrit :
> > On Tue, 23 Feb 2010 00:15:20 +0100%
> > Colomban Wendling <lists.ban at herbesfolles.org> wrote:
> > 
> >> Hi,
> >>
> >> Eugene Arshinov a écrit :
> >>> 2. There is a strange issue with deleting spaces from the
> >>> beginning of a line. Suppose you have a file with indentation set
> >>> to 2 spaces and two lines:
> >>>
> >>>   if foo:
> >>>     bar()
> >>>
> >>> If you move cursor after the first space of the second line and
> >>> press Backspace, you get
> >>>
> >>>   if foo:
> >>>   bar
> >>>
> >>> with the cursor just before "bar", not in the beginning of the
> >>> line. That is weird. Is this a "feature" of Scintilla or Geany?
> >>> If the latter, which source file I need to fix? :-)
> >> I this is truly a feature part of "remove indentation rather than
> >> character part of it", and I'm not sure it should be fixed at all.
> >> Perhaps it would be OK to delete the *character* the cursor is
> >> *inside* the indentation level and delete the indentation if at the
> >> end of an indentation level. [1]
> >>
> >> 1. here with "character" I mean one of the character(s) that
> >> creates the indentation level;
> >> with "inside", I mean "not at a bound";
> >> and with "indentation level" I mean the 2 spaces with a 2 space
> >> indentation: a line starting with 4 space have 2 level of
> >> indentation
> >>
> > 
> > For me, the following behaviour seems more meaningful. If the
> > cursor is inside the indentation level, delete this indentation
> > level, so that new cursor position will be just before the
> > indentation level or code to the right of the deleted indentation
> > level. If the cursor is at a boundary, delete the indentation level
> > to the left of the cursor.
> > 
> > Regards,
> > Eugene.
> 
> Oh, I misunderstood your point the first time. Why not. I think the
> current behavior is "reduce indentation of the current line", as done
> at other places;
>

There is a separate «Format > Decrease indent» keybinding. I just
assigned a shortcut for it and tested. The behaviour of this keybinding
differs from the behaviour of Backspace, and it does exactly what I
want: in the given example it moves the cursor to the beginning of the
line. So, the behaviour of Backspace does not currently match the
common one; it will match when fixed in a way I suggested.

> but I don't see any harm with your suggestion, quite
> the opposite, even if it is probably a little overkill IMO.

I don't see an overkill here; the behaviour I suggested is rather easy
to implement. Moreover, maybe it is possible to just reuse the
code which handles «Decrease indent» keybinding in a case when
Backspace is pressed within indentation (it seems that this case is
already handled specially, so we wouldn't even need to write the code
checking if the cursor is within indentation or not).

Best regards,
Eugene.



More information about the Devel mailing list