Formosa1 / zen-coding

Automatically exported from code.google.com/p/zen-coding
0 stars 0 forks source link

soft tabs vs hard tabs inside settings file #77

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. set soft tabs in editor
2. convert all hard tabs to spaces (preferably 4)
3. expand a complex abbreviation (with snippet)

What is the expected output? What do you see instead?
expanded content should not have hard tabs

What version of the product are you using? On what operating system?
using v 0.5.1, windows xp, jEdit (which is not supported, but I still think 
it's an upstream bug).

Thank you.

Original issue reported on code.google.com by szabolcs.kurdi@gmail.com on 27 Dec 2009 at 1:02

GoogleCodeExporter commented 9 years ago
btw in my case zen_jedit.js or zen_eclipse.js:

content = zen_coding.expandAbbreviation(abbr, editor_type, profile_name);
if (zen_settings.variables.indentation != "\t") {
    content = content.replace(/\n(\t+)/g, function(tabs){
        return tabs.replace(/\t/g, zen_settings.variables.indentation);
    });
}

Original comment by szabolcs.kurdi@gmail.com on 27 Dec 2009 at 1:06

GoogleCodeExporter commented 9 years ago
I've actually noticed the same thing with the Python version, zen_core.py. Been
meaning to document it.

        # fix indentation
        #indent = zen_settings['variables']['indentation']

        # This doesn't work
        #begin = begin.replace('\\t', indent)
        #end = end.replace('\\t', indent)

        # This works though
        begin = re.sub('\\t', indent, begin)
        end = re.sub('\\t', indent, end)

I'm think the replacing of the \n may not work either, but I use \n so it 
doesn't get
in my way. I'm also not sure why the original way doesn't work. I don't use 
Python a
ton. I actually found even with the above it can have issues with nested 
snippets.
Doing to replace on the data variable before it's broken into begin and end 
pieces
works out better.

        if data:
            if profile['tag_nl'] != False:
                data = data.replace(r'\n', get_newline())
                # fix indentation
                indent = zen_settings['variables']['indentation']
                data = re.sub('\\t', indent, data)

Original comment by angelw...@gmail.com on 28 Dec 2009 at 2:41

GoogleCodeExporter commented 9 years ago
Since v0.6 (wait until I write some docs) you can change indentation and 
newline symbols in runtime. I'll write 
about it in PluginHowto

Original comment by serge....@gmail.com on 15 Feb 2010 at 12:25