diff -ur C:\FGCVS\tidy\src\lexer.c tidycvs\src\lexer.c --- C:\FGCVS\tidy\src\lexer.c Sat Mar 29 13:59:10 2008 +++ tidycvs\src\lexer.c Sun Jul 12 18:27:23 2009 @@ -2166,8 +2166,9 @@ lexer->txtend = lexer->lexsize; } lexer->token = TY_(TextToken)(lexer); -#ifdef TIDY_STORE_ORIGINAL_TEXT - StoreOriginalTextInToken(doc, lexer->token, 3); +#ifdef TIDY_STORE_ORIGINAL_TEXT /* FIX20090712 - reduce to 2, + since now UngetChar did 1! */ + StoreOriginalTextInToken(doc, lexer->token, 2); /* was 3 */ #endif return lexer->token; } diff -ur C:\FGCVS\tidy\src\streamio.c tidycvs\src\streamio.c --- C:\FGCVS\tidy\src\streamio.c Sat Mar 29 13:59:11 2008 +++ tidycvs\src\streamio.c Sun Jul 12 18:27:23 2009 @@ -242,6 +242,16 @@ } #ifdef TIDY_STORE_ORIGINAL_TEXT + +/* FIX20090712 - new service to unget original store */ +void TY_(UngetCharOriginalText) (StreamIn *in) +{ + if (in->otextlen) { + in->otextlen--; + in->otextbuf[in->otextlen] = 0; /* zero terminate for string */ + } +} + void TY_(AddByteToOriginalText)(StreamIn *in, tmbchar c) { if (in->otextlen + 1 >= in->otextsize) @@ -322,7 +332,7 @@ if ( in->tabs > 0 ) { - in->curcol++; + /* why is this done? in->curcol++; - this is purely a tab expansion */ in->tabs--; return ' '; } @@ -527,10 +537,16 @@ in->curcol = 1; in->curline++; PopLastPos( in ); +#ifdef TIDY_STORE_ORIGINAL_TEXT /* FIX20090712 */ + TY_(AddCharToOriginalText)(in, (tchar)c); +#endif return c; } in->curcol++; PopLastPos( in ); +#ifdef TIDY_STORE_ORIGINAL_TEXT /* FIX20090712 */ + TY_(AddCharToOriginalText)(in, (tchar)c); +#endif } return c; } @@ -552,6 +568,10 @@ if (c == '\n') --(in->curline); + +#ifdef TIDY_STORE_ORIGINAL_TEXT /* FIX20090712 */ + TY_(UngetCharOriginalText) (in); +#endif RestoreLastPos( in ); } diff -ur C:\FGCVS\tidy\src\tidylib.c tidycvs\src\tidylib.c --- C:\FGCVS\tidy\src\tidylib.c Sat Jul 12 14:01:57 2008 +++ tidycvs\src\tidylib.c Sun Jul 12 18:27:23 2009 @@ -157,6 +157,9 @@ ** But we need to start off with a way to report errors. */ doc->errout = TY_(StdErrOutput)(); +#ifdef TIDY_STORE_ORIGINAL_TEXT /* FIX20090712 */ + doc->storeText = yes; +#endif return doc; }