Skip to content
Commit 92f53fc4 authored by Graeme Coupar's avatar Graeme Coupar
Browse files

Don't add un-neccesary line break in grouped vertical grid.

Prior to this change, isort was always adding 1 to the current line length when
determining whether or not the current line had got too long when outputting a
vertical grid.

- For imports that are not last, this is fine.  We need to account for the comma
  after the import.
- For the final import in vertical grid mode this is also fine.  We need to
  account for the closing `)`.
- For the final import in the grouped vertical grid we put the closing ) on the
  next line, so adding 1 to the line length causes isort to add un-neccesary
  line breaks when the final import would only just fit onto the line by one
  character.

For example, with a line length of 20:

```
from x import (
    abcd, efgh, ijkl
)
```

will end up reformatted as

```
from x import (
    abcd, efgh,
    ijkl
)
```

This is causing problems for us, as we run yapf on our code as well as isort,
and our imports change depending on which tool ran last.
parent 3b011412
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment