diff --git a/src/lua-format.cpp b/src/lua-format.cpp index f209493..81e00d4 100644 --- a/src/lua-format.cpp +++ b/src/lua-format.cpp @@ -111,11 +111,7 @@ std::string resetContentInDisableFormatBlocks(const std::string& original, const std::string lua_format(std::istream& is, const Config& config) { std::ostringstream os; os << is.rdbuf(); - std::string original = os.str(); - ANTLRInputStream input(original); - std::string formatted = __format(input, config); - formatted = handleLineSeparator(original, formatted, config); - return resetContentInDisableFormatBlocks(original, formatted); + return lua_format(os.str(), config); } std::string lua_format(const std::string& str, const Config& config) { diff --git a/src/visitor/table.cpp b/src/visitor/table.cpp index 7064af2..489a293 100644 --- a/src/visitor/table.cpp +++ b/src/visitor/table.cpp @@ -47,7 +47,7 @@ antlrcpp::Any FormatVisitor::visitTableconstructor(LuaParser::TableconstructorCo column_table_limit = config_.get("column_limit"); } } - + beyondLimit = cur_columns() + length > column_table_limit || lines > 1; } bool breakAfterLb = false; @@ -225,4 +225,4 @@ antlrcpp::Any FormatVisitor::visitField(LuaParser::FieldContext* ctx) { antlrcpp::Any FormatVisitor::visitFieldsep(LuaParser::FieldsepContext* context) { cur_writer() << config_.get("table_sep"); return nullptr; -} \ No newline at end of file +}