Skip to content

Commit c87e39e

Browse files
committed
Fix whitespace issue for wrapped selectors
1 parent 0633108 commit c87e39e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/emitter.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ namespace Sass {
105105
wbuf.buffer = text + wbuf.buffer;
106106
}
107107

108+
char Emitter::last_char()
109+
{
110+
return wbuf.buffer.back();
111+
}
112+
108113
// append a single char to the buffer
109114
void Emitter::append_char(const char chr)
110115
{
@@ -217,7 +222,9 @@ namespace Sass {
217222
if ((output_style() != COMPRESSED) && buffer().size()) {
218223
unsigned char lst = buffer().at(buffer().length() - 1);
219224
if (!isspace(lst) || scheduled_delimiter) {
220-
append_mandatory_space();
225+
if (last_char() != '(') {
226+
append_mandatory_space();
227+
}
221228
}
222229
}
223230
}

src/emitter.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ namespace Sass {
7373
// append some text or token to the buffer
7474
// this adds source-mappings for node start and end
7575
void append_token(const std::string& text, const AST_Node_Ptr node);
76+
// query last appended character
77+
char last_char();
7678

7779
public: // syntax sugar
7880
void append_indentation();

0 commit comments

Comments
 (0)