Skip to content

Commit

Permalink
Fixes regression with custom precision (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreter committed Oct 27, 2014
1 parent 02f9058 commit 12dbd03
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ namespace Sass {
names_to_colors (map<string, Color*>()),
colors_to_names (map<int, string>()),
precision (initializers.precision()),
subset_map (Subset_Map<string, pair<Complex_Selector*, Compound_Selector*> >())
subset_map (Subset_Map<string, pair<Complex_Selector*, Compound_Selector*> >()),
_skip_source_map_update (initializers._skip_source_map_update())
{
cwd = get_cwd();

Expand Down
2 changes: 2 additions & 0 deletions context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ namespace Sass {
map<int, string> colors_to_names;

size_t precision; // precision for outputting fractional numbers
bool _skip_source_map_update; // status flag to skip source map updates

KWD_ARG_SET(Data) {
KWD_ARG(Data, const char*, source_c_str);
Expand All @@ -75,6 +76,7 @@ namespace Sass {
KWD_ARG(Data, bool, omit_source_map_url);
KWD_ARG(Data, bool, is_indented_syntax_src);
KWD_ARG(Data, size_t, precision);
KWD_ARG(Data, bool, _skip_source_map_update);
};

Context(Data);
Expand Down
4 changes: 3 additions & 1 deletion eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,9 @@ namespace Sass {
Expression* Eval::operator()(String_Schema* s)
{
string acc;
To_String to_string(0);
ctx._skip_source_map_update = true;
To_String to_string(&ctx);
ctx._skip_source_map_update = false;
for (size_t i = 0, L = s->length(); i < L; ++i) {
string chunk((*s)[i]->perform(this)->perform(&to_string));
if (((s->quote_mark() && is_quoted(chunk)) || !s->quote_mark()) && (*s)[i]->is_interpolant()) { // some redundancy in that test
Expand Down
3 changes: 2 additions & 1 deletion inspect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,8 @@ namespace Sass {
void Inspect::append_to_buffer(const string& text)
{
buffer += text;
if (ctx) ctx->source_map.update_column(text);
if (ctx && !ctx->_skip_source_map_update)
ctx->source_map.update_column(text);
}

}
3 changes: 2 additions & 1 deletion output_compressed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ namespace Sass {
void Output_Compressed::append_singleline_part_to_buffer(const string& text)
{
buffer += text;
if (ctx) ctx->source_map.update_column(text);
if (ctx && !ctx->_skip_source_map_update)
ctx->source_map.update_column(text);
}

}
3 changes: 2 additions & 1 deletion output_nested.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ namespace Sass {
void Output_Nested::append_to_buffer(const string& text)
{
buffer += text;
if (ctx) ctx->source_map.update_column(text);
if (ctx && !ctx->_skip_source_map_update)
ctx->source_map.update_column(text);
}

}

0 comments on commit 12dbd03

Please sign in to comment.