diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c287d2..e1ff878 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +## [1.0.2] - 2022-10-19 + +### Changed + +- Fix trailing whitespace stripping to not including newlines. + ## [1.0.1] - 2022-10-18 ### Changed @@ -37,7 +43,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a - 🎉 Initial release! 🎉 -[unreleased]: https://github.com/ruby-syntax-tree/prettier_print/compare/v1.0.1...HEAD +[unreleased]: https://github.com/ruby-syntax-tree/prettier_print/compare/v1.0.2...HEAD +[1.0.2]: https://github.com/ruby-syntax-tree/prettier_print/compare/v1.0.1...v1.0.2 [1.0.1]: https://github.com/ruby-syntax-tree/prettier_print/compare/v1.0.0...v1.0.1 [1.0.0]: https://github.com/ruby-syntax-tree/prettier_print/compare/v0.1.0...v1.0.0 [0.1.0]: https://github.com/ruby-syntax-tree/prettier_print/compare/df51ce...v0.1.0 diff --git a/Gemfile.lock b/Gemfile.lock index fda5b87..357299d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - prettier_print (1.0.1) + prettier_print (1.0.2) GEM remote: https://rubygems.org/ diff --git a/lib/prettier_print.rb b/lib/prettier_print.rb index 34615b0..423b8de 100644 --- a/lib/prettier_print.rb +++ b/lib/prettier_print.rb @@ -291,7 +291,7 @@ def <<(object) def trim! length = output.length - output.rstrip! + output.gsub!(/[\t ]*\z/, "") length - output.length end end @@ -323,7 +323,7 @@ def trim! if output.any? && output.last.is_a?(String) && !output.last.frozen? length = output.last.length - output.last.rstrip! + output.last.gsub!(/[\t ]*\z/, "") trimmed += length - output.last.length end diff --git a/lib/prettier_print/version.rb b/lib/prettier_print/version.rb index 373c2d6..4a46852 100644 --- a/lib/prettier_print/version.rb +++ b/lib/prettier_print/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true class PrettierPrint - VERSION = "1.0.1" + VERSION = "1.0.2" end