whitespace - How to keep spaces from becoming tabs in Eclipse (w/ PyDev) -
i have unfortunate problem eclipse happens in existing python files tabs somewhere in them. doesn't happen in empty files or non .py files.
basically, if try copy , past more 3 spaces end tabs every x spaces, x being number of characters per space setup editor. in case 4, end following:
copy , paste 1 space: " " (one space) copy , paste 3 spaces: " " (three spaces) copy , paste 6 spaces: "\t " (one tab, 2 spaces) copy , paste 9 spaces: "\t\t " (two tabs, 1 space) copy , paste 12 spaces: "\t\t\t" (three tabs) for life of me can't figure out why happening or how turn off. it's frustrating have keep manually editing each line paste instead of getting copied in first place.
does know setting is, or if it's bug?
edit: clear not want spaces when hit tab key, want tab characters when ask tab characters. when want paste space not want characters changed, if it's clear i'm between single or double quotes , trying write text is.
this happens because at:
org.python.pydev.editor.autoedit.abstractindentprefs.converttostd(idocument, documentcommand) it'll both ways (either make spaces -> tabs or tabs -> spaces), so, there isn't option let was.
code:
private string convertspacestotabs(idocument document, string text, int offset, string indentstring) throws badlocationexception { string spacestr = stringutils.createspacestring(gettabwidth()); while (text.startswith(spacestr)) { text = text.replaceall(spacestr, "\t"); } return text; } there 2 possible fixes here:
- create option no conversion ever done.
- improve convertspacestotabs guesses indent better instead of using tab-width (that way conversion things better).
as pydev open source, ideally provide patch (see http://pydev.org/developers.html getting code).
otherwise, can create ticket @ https://sw-brainwy.rhcloud.com/tracker/pydev ;)
Comments
Post a Comment