[Geany] spaces, tabs and saving

FD Cami francois.cami at xxxxx
Thu Jun 7 23:20:50 UTC 2007


Hi list,

On Thu, 7 Jun 2007 17:13:59 +0200
Enrico Tröger <enrico.troeger at uvena.de> wrote:

> On Thu, 07 Jun 2007 11:12:07 +0200, Harold Aling <h.aling at home.nl>
> wrote:
> 
> Hi all,
> 
> you are right. Anyway, the current code for replacing tabs isn't buggy.
> It works as intended only the indention is a bit buggy.
> What I want to say, I wasn't aware of this problem but I agree that it
> should be improved to not only stupidly replace any tab by some
> spaces with the amount of tab_width.
> 
> > After some tests I'd reckon that the best solution will be:
> > 
> > "if spaces are followed by a tab then { if (no. of spaces < 
> > tabWidthInSpaces) then discard spaces }"
> Sounds good.

Err, no. The solution is to use sci_get_col_from_position modulo tab_len
to determine how many spaces the current \t is worth.

> But I won't work on this, at least not in the near future.
> 
> Any patches are welcome.
> If anyone want to work on this, the start should be
> document_replace_tabs() in src/document.c:1802.

Patch attached & validated against the attached test file and sonata.py
with tab_len = 8.

Many thanks for doing Geany.

François Cami & Guillaume Duviol
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.txt
URL: <http://lists.geany.org/pipermail/users/attachments/20070608/601d844b/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geany-tab-space.diff
Type: text/x-patch
Size: 1281 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20070608/601d844b/attachment.bin>


More information about the Users mailing list