Auto merge of #4774 - lukaslueg:issue4771, r=alexcrichton
authorbors <bors@rust-lang.org>
Tue, 5 Dec 2017 16:32:16 +0000 (16:32 +0000)
committerbors <bors@rust-lang.org>
Tue, 5 Dec 2017 16:32:16 +0000 (16:32 +0000)
Break crate-descriptions at char-, not byte-boundary, avoiding a panic

Fixes #4771. The basic panicking-problem could be fixed by truncating at `char`- instead of `byte`-boundary. This PR takes the long route and uses the unicode-width to always truncate at grapheme-boundary, which should be visually correct in more cases. It adds two extra (extremely common) dependencies to Cargo, though. I have no strong opinions if this is worth it.

While truncating the descriptions, we now also take the length of the names-column into account, including margin, run a little shorter, and have them all of the same total true length.

Before
```
$ cargo search serde
serde = "1.0.23"                      # A generic serialization/deserialization framework
serde_json = "1.0.7"                  # A JSON serialization file format
serde_derive_internals = "0.17.0"     # AST representation used by Serde derive macros. Unstable.
serde_yaml = "0.7.3"                  # YAML support for Serde
serde_derive = "1.0.23"               # Macros 1.1 implementation of #[derive(Serialize, Deserialize)]
serde_test = "1.0.23"                 # Token De/Serializer for testing De/Serialize implementations
serde_bytes = "0.10.2"                # Optimized handling of `&[u8]` and `Vec<u8>` for Serde
serde_millis = "0.1.1"                #     A serde wrapper that stores integer millisecond value for timestamps     and durations (used similarly to serde_bytes)
serde_codegen_internals = "0.14.2"    # AST representation used by Serde codegen. Unstable.
courier = "0.3.1"                     # Utility to make it easier to send and receive data when using the Rocket framework.
... and 275 crates more (use --limit N to see more)
```

After
```
$ cargo search serde
serde = "1.0.23"                      # A generic serialization/deserialization framework
serde_json = "1.0.7"                  # A JSON serialization file format
serde_derive_internals = "0.17.0"     # AST representation used by Serde derive macros. Unstable.
serde_yaml = "0.7.3"                  # YAML support for Serde
serde_derive = "1.0.23"               # Macros 1.1 implementation of #[derive(Serialize, Deserialize)]
serde_test = "1.0.23"                 # Token De/Serializer for testing De/Serialize implementations
serde_bytes = "0.10.2"                # Optimized handling of `&[u8]` and `Vec<u8>` for Serde
serde_millis = "0.1.1"                #     A serde wrapper that stores integer millisecond value for …
serde_codegen_internals = "0.14.2"    # AST representation used by Serde codegen. Unstable.
courier = "0.3.1"                     # Utility to make it easier to send and receive data when using …
... and 275 crates more (use --limit N to see more)
```

1  2 
src/cargo/ops/registry.rs

Simple merge