Skip to content

Commit

Permalink
Merge pull request #573 from mgreter/fix/custom-precision
Browse files Browse the repository at this point in the history
Fixes regression with custom precision (#364)
  • Loading branch information
HamptonMakes committed Oct 28, 2014
2 parents f55b2d5 + 12dbd03 commit ca5f271
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 @@ -530,7 +530,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 @@ -631,7 +631,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 @@ -361,7 +361,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);
}

}

1 comment on commit ca5f271

@naartjie
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logged #720 for this commit

Please sign in to comment.