From 404d809a692d68db0f36016b91171befec48be81 Mon Sep 17 00:00:00 2001 From: Timothy Crosley Date: Sat, 20 Mar 2021 00:06:38 -0700 Subject: [PATCH] Fix issue #1566: Fixed single location parsed line separator isn't used --- isort/output.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/isort/output.py b/isort/output.py index 13f72a3d5..61c2e30ec 100644 --- a/isort/output.py +++ b/isort/output.py @@ -504,7 +504,13 @@ def _with_from_imports( config=config, multi_line_output=wrap.Modes.VERTICAL_GRID, # type: ignore ) - if max(len(x) for x in import_statement.split("\n")) > config.line_length: + if ( + max( + len(import_line) + for import_line in import_statement.split(parsed.line_separator) + ) + > config.line_length + ): import_statement = other_import_statement if not do_multiline_reformat and len(import_statement) > config.line_length: import_statement = wrap.line(import_statement, parsed.line_separator, config)