highline 1.7.7 → 1.7.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0322744bd14cd2bc95f5c9227aa0cd43e16754b7
4
- data.tar.gz: d0238fa92ad538d5ca8c6f00016fd268ebb850e9
3
+ metadata.gz: 43fdbf38f854f17b3b9f288592f25e655797102f
4
+ data.tar.gz: e48e95dea0924528f717586996c71710f7d1c32b
5
5
  SHA512:
6
- metadata.gz: b7a445bf62871bb1d0bfdf6dba0ad055cd6ea4f7e612315f09bfae40c996ae84e881d73b034cd3c374c97e02201045d52b4c564c5853b475b342756837a4ae75
7
- data.tar.gz: 34eef4f28c8392acb102d750d1b6df52f26f4a9fd61de9a8f5ad671abe369824a68d02319188806de7b59013224e48a2453c34d8fd24d7832a96a3d3e9364236
6
+ metadata.gz: ceefae17b4b0f5dc14a3f2c3962513ba7f60b2c69394521985c5f511826d5489b074bd327b51f6a04d3febfa1e7210f33562532b5e81e5623e361ab4fbe61c8a
7
+ data.tar.gz: 6e62ef0f4382ec92f5ebc5177ccff83aea0d3ff7935402fae11212bae95f6b30aebbed898d001ca99523bda04cfb61c452bdc552c212446e470182f6ef52c6df
@@ -2,6 +2,9 @@
2
2
 
3
3
  Below is a complete listing of changes for each revision of HighLine.
4
4
 
5
+ ### 1.7.8 / 2015-10-09
6
+ * Fix some issues when paginating. (Nick Carboni (@carbonin) and Abinoam P. Marques Jr. (@abinoam), #168, PRs #169 #170)
7
+
5
8
  ### 1.7.7 / 2015-09-22
6
9
  * Make HighLine::Question coerce its question argument into a String. (@97-109-107 and Abinoam P. Marques Jr. (@abinoam), #159, PR #160)
7
10
 
@@ -989,12 +989,12 @@ class HighLine
989
989
  # instead. This is to support any special handling for the final sequence.
990
990
  #
991
991
  def page_print( output )
992
- lines = output.scan(/[^\n]*\n?/)
992
+ lines = output.lines.to_a
993
993
  while lines.size > @page_at
994
994
  @output.puts lines.slice!(0...@page_at).join
995
995
  @output.puts
996
996
  # Return last line if user wants to abort paging
997
- return (["...\n"] + lines.slice(-2,1)).join unless continue_paging?
997
+ return "...\n#{lines.last}" unless continue_paging?
998
998
  end
999
999
  return lines.join
1000
1000
  end
@@ -1,4 +1,4 @@
1
1
  class HighLine
2
2
  # The version of the installed library.
3
- VERSION = "1.7.7".freeze
3
+ VERSION = "1.7.8".freeze
4
4
  end
@@ -977,6 +977,48 @@ class TestHighLine < Test::Unit::TestCase
977
977
  (45..50).map { |n| "This is line #{n}.\n"}.join,
978
978
  @output.string )
979
979
  end
980
+
981
+ def test_statement_lines_count_equal_to_page_at_shouldnt_paginate
982
+ @terminal.page_at = 6
983
+
984
+ @input << "\n"
985
+ @input.rewind
986
+
987
+ list = "a\nb\nc\nd\ne\nf\n"
988
+
989
+ @terminal.say(list)
990
+ assert_equal(list, @output.string)
991
+ end
992
+
993
+ def test_statement_with_one_line_bigger_than_page_at_should_paginate
994
+ @terminal.page_at = 6
995
+
996
+ @input << "\n"
997
+ @input.rewind
998
+
999
+ list = "a\nb\nc\nd\ne\nf\ng\n"
1000
+
1001
+ paginated =
1002
+ "a\nb\nc\nd\ne\nf\n" \
1003
+ "\n-- press enter/return to continue or q to stop -- \n\n" \
1004
+ "g\n"
1005
+
1006
+ @terminal.say(list)
1007
+ assert_equal(paginated, @output.string)
1008
+ end
1009
+
1010
+ def test_quiting_paging_shouldnt_raise
1011
+ # See https://github.com/JEG2/highline/issues/168
1012
+
1013
+ @terminal.page_at = 6
1014
+
1015
+ @input << "q"
1016
+ @input.rewind
1017
+
1018
+ list = "a\nb\nc\nd\ne\nf\n"
1019
+
1020
+ assert_nothing_raised { @terminal.say(list) }
1021
+ end
980
1022
 
981
1023
  def test_range_requirements
982
1024
  @input << "112\n-541\n28\n"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: highline
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.7
4
+ version: 1.7.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Edward Gray II
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-22 00:00:00.000000000 Z
11
+ date: 2015-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: code_statistics