From 32ce272f75a05d40d14de92e21e49b1c107e9fcf Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Wed, 4 Nov 2015 12:44:15 +0800 Subject: [PATCH] Fix indent-with-tabs for library use. --- src/config.c | 2 -- src/tidylib.c | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/config.c b/src/config.c index 5ca18f8..b44a1b8 100644 --- a/src/config.c +++ b/src/config.c @@ -1229,10 +1229,8 @@ Bool ParseTabs( TidyDocImpl* doc, const TidyOptionImpl* entry ) Bool tabs = flag != 0 ? yes : no; TY_(SetOptionBool)( doc, entry->id, tabs ); if (tabs) { - TY_(PPrintTabs)(); TY_(SetOptionInt)( doc, TidyIndentSpaces, 1 ); } else { - TY_(PPrintSpaces)(); /* optional - TY_(ResetOptionToDefault)( doc, TidyIndentSpaces ); */ } } diff --git a/src/tidylib.c b/src/tidylib.c index 69ac014..7501607 100755 --- a/src/tidylib.c +++ b/src/tidylib.c @@ -1809,8 +1809,14 @@ int tidyDocSaveStream( TidyDocImpl* doc, StreamOut* out ) Bool asciiChars = cfgBool(doc, TidyAsciiChars); Bool makeBare = cfgBool(doc, TidyMakeBare); Bool escapeCDATA = cfgBool(doc, TidyEscapeCdata); + Bool ppWithTabs = cfgBool(doc, TidyPPrintTabs); TidyAttrSortStrategy sortAttrStrat = cfg(doc, TidySortAttributes); + if (ppWithTabs) + TY_(PPrintTabs)(); + else + TY_(PPrintSpaces)(); + if (escapeCDATA) TY_(ConvertCDATANodes)(doc, &doc->root);