Skip to content

Commit

Permalink
new release
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Feb 4, 2020
1 parent 1b5dbae commit 132c469
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 33 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Fixed Windows color support
- Fixed line width on windows issue (https://github.com/willmcgugan/rich/issues/7)
- Fixed Pretty print on Windows

## [0.3.2] - 2020-01-26

Expand Down
26 changes: 0 additions & 26 deletions examples/table.html

This file was deleted.

14 changes: 13 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@
name = "rich"
homepage = "https://github.com/willmcgugan/rich"
documentation = "https://rich.readthedocs.io/en/latest/"
version = "0.3.2"
version = "0.3.3"
description = "Render rich text, tables, syntax highlighting, markdown and more to the terminal"
authors = ["Will McGugan <willmcgugan@gmail.com>"]
license = "MIT"
readme = "README.md"
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
]


[tool.poetry.dependencies]
python = "^3.6"
Expand Down
2 changes: 2 additions & 0 deletions rich/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ def get_ansi_codes(self, foreground: bool = True) -> List[str]:
def downgrade(self, system: ColorSystem) -> "Color":
"""Downgrade a color system to a system with fewer colors."""

if self.type == ColorType.DEFAULT or self.type == system:
return self
# Convert to 8-bit color from truecolor color
if system == ColorSystem.EIGHT_BIT and self.system == ColorSystem.TRUECOLOR:
assert self.triplet is not None
Expand Down
4 changes: 2 additions & 2 deletions rich/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ def size(self) -> ConsoleDimensions:
return ConsoleDimensions(self._width, self._height)

width, height = shutil.get_terminal_size()
if WINDOWS:
width -= 1
# Fixes Issue with Windows console (https://github.com/willmcgugan/rich/issues/7)
width -= 1
return ConsoleDimensions(
width if self._width is None else self._width,
height if self._height is None else self._height,
Expand Down
1 change: 1 addition & 0 deletions rich/pretty.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __console__(
self, console: "Console", options: "ConsoleOptions"
) -> "RenderResult":
pretty_str = pformat(self._object, width=options.max_width)
pretty_str = pretty_str.replace("\r", "")
pretty_text = self.highlighter(pretty_str)
yield pretty_text

Expand Down
4 changes: 2 additions & 2 deletions rich/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def adjust_line_length(
"""
line_length = sum(len(text) for text, _style in line)
if line_length < length:
return line[:] + [Segment(" " * (length - line_length), style)]
return line + [Segment(" " * (length - line_length), style)]
elif line_length > length:
line_length = 0
new_line: List[Segment] = []
Expand All @@ -103,7 +103,7 @@ def adjust_line_length(
append(Segment(text[: length - line_length], style))
break
return new_line
return line
return line[:]

@classmethod
def get_line_length(cls, line: List["Segment"]) -> int:
Expand Down
2 changes: 0 additions & 2 deletions rich/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,6 @@ def divide(self, offsets: Iterable[int]) -> Lines:
break
span = new_span
line_index += 1
# if line_index >= len(line_ranges):
# break
line_start, line_end = line_ranges[line_index]

return new_lines
Expand Down

0 comments on commit 132c469

Please sign in to comment.