[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    Re: [patch] Ability to force indent with spaces in alignment from
From:       "Robin Pedersen" <robinpeder () gmail ! com>
Date:       2008-05-30 10:49:34
Message-ID: op.ubyq0w0f9lgty9 () lenobin
[Download RAW message or body]

On Thu, 29 May 2008 20:02:00 +0200, Leo Savernik <l.savernik@aon.at> wrote:

> Am Donnerstag, 29. Mai 2008 schrieb Robin Pedersen:
>> > Example situation where this is useful:
>> >>   >   foobar("Hello, world",
>> >>   >   ......."How are you?")
>> >
>> > Notice how the second line is aligned under the opening parenthesis  
>> in  
>> >
>> > the first line. Currently, the kate indenter does this instead:
>> >>   >   foobar("Hello, world",
>> >>   >   >   ..."How are you?")
>
> This is mixed mode. I remember we decided against mixed mode in Glasgow  
> to
> keep the scripting api as simple as possible.

As a user wishing for a feature, it doesn't really concern me when and  
where it was decided not to do it in the past. Without a way to  
distinguish between indent and aligning the only potentially valid reason  
to have tabs in a document is to "compress" white-space to reduce file  
size (I challenge the reader to come up with another valid argument),  
because changing the tab size will break all alignment. Compressing  
white-space with tabs isn't really a good way, because if actual  
compression is used, using tabs instead of spaces in documents can  
actually increase the size of a package (so I've heard, and I think it  
sounds reasonable, though I'm not really concerned with file size).

I never knew what "mixed mode" meant. but I think the configuration user  
interface should contain something like this:

    Replace tabs with spaces:
    ( ) Never
    (X) Only when code is aligned (default setting)
    ( ) Always

Maybe someone could come up with better descriptions.

>
> Can't mixed mode be emulated by simply copying the nearest previous  
> non-empty line and adding only spaces for new indentation levels? Taking  
> your example, copy as leading indentation '>    >    ' from the previous  
> line and padding with spaces only as shown in your first example.

Do you mean that this should be done automatically outside the control of  
the indent script? How would you distinguish between these two cases:
    if(cond)<enter>
    foo(arg,<enter>

Assume indentWidth == tabWidth == 4. In both cases the indent script  
returns the previous indent + 4. In the first case an extra tab should be  
added to the current indent, and in the second case four spaces should be  
added.

The indent script must have a way to return indent amount and alignment  
separately.

If you mean that the indent script should manually edit the document like  
this, then I have tried it, and it actually works, but it's very ugly.

>
> mfg
> 	Leo
>
> _______________________________________________
> KWrite-Devel mailing list
> KWrite-Devel@kde.org
> https://mail.kde.org/mailman/listinfo/kwrite-devel



-- 
Robin Pedersen
_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic