textbringer 0.2.6 → 0.2.7

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: 7a7999df616ed4ffd10a360bdf4f05981ca689e5
4
- data.tar.gz: ec1adb45ac78222f521317d019a2c6f34d2bdbf3
3
+ metadata.gz: 57386322dcb1c04c07b26ccc281b10dc86fff8e1
4
+ data.tar.gz: 1dc85e31122a28561a9e47bb750b0602ec8619f7
5
5
  SHA512:
6
- metadata.gz: a42aebf208fc3570b68f068909665e185958c77d0f038cc60bc6d4e470b373245d56290712cc8e13065fce2c16eb02094b8f36bcbd5710ef7ee7423bc9019080
7
- data.tar.gz: 974172125b75ae24a3156303988697d4cec95c9d1c1db61a3825cf66edbf522ffbcd774f9ef0d708edcd52e7a82ed68461a8d0b560ff2bc4bbbe441e208ee576
6
+ metadata.gz: 29a2f745379f31d22b838691f1f61ef8fd5502786cdd32a9fd698cd603b96ffb9d48c93091ed3186ee6c677d5c495bc9a51d6b358deb1a21da93b9ab179ded7f
7
+ data.tar.gz: c9e02c3d2161d3f5a4d1fe52bee20c7bb66972fa9c716737e94fbdd56fc59db1b5bd3a22500a5d34d48629dfea8bf324f9d9b748c1c4645e803adc284a80787e
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.7
2
+
3
+ * Add isearch_yank_word_or_char.
4
+
1
5
  ## 0.2.6
2
6
 
3
7
  * Add the following new commands:
data/appveyor.yml CHANGED
@@ -14,4 +14,5 @@ environment:
14
14
  UPLOAD_TO_CODECOV: 1
15
15
  SSL_CERT_FILE: C:\projects\textbringer\cacert.pem
16
16
  matrix:
17
+ - ruby_version: "23"
17
18
  - ruby_version: "23-x64"
@@ -42,7 +42,20 @@ module Textbringer
42
42
 
43
43
  NKF_DETECT_ENCODING = ->(s) {
44
44
  e = NKF.guess(s)
45
- e == Encoding::US_ASCII ? Encoding::UTF_8 : e
45
+ case e
46
+ when Encoding::US_ASCII
47
+ Encoding::UTF_8
48
+ when Encoding::ASCII_8BIT
49
+ s.force_encoding(Encoding::UTF_8)
50
+ if s.valid_encoding?
51
+ Encoding::UTF_8
52
+ else
53
+ s.force_encoding(Encoding::ASCII_8BIT)
54
+ Encoding::ASCII_8BIT
55
+ end
56
+ else
57
+ e
58
+ end
46
59
  }
47
60
 
48
61
  @@detect_encoding_proc = DEFAULT_DETECT_ENCODING
@@ -18,6 +18,7 @@ module Textbringer
18
18
  ISEARCH_MODE_MAP.define_key(?\C-h, :isearch_delete_char)
19
19
  ISEARCH_MODE_MAP.define_key(?\C-s, :isearch_repeat_forward)
20
20
  ISEARCH_MODE_MAP.define_key(?\C-r, :isearch_repeat_backward)
21
+ ISEARCH_MODE_MAP.define_key(?\C-w, :isearch_yank_word_or_char)
21
22
  ISEARCH_MODE_MAP.define_key(?\C-m, :isearch_exit)
22
23
  ISEARCH_MODE_MAP.define_key(?\C-g, :isearch_abort)
23
24
 
@@ -105,6 +106,16 @@ module Textbringer
105
106
  isearch_search
106
107
  end
107
108
 
109
+ define_command(:isearch_yank_word_or_char, doc: <<~EOD) do
110
+ Yank next word or character onto the end of the search string.
111
+ EOD
112
+ buffer = Buffer.current
113
+ if buffer.looking_at?(/(\p{Letter}|\p{Number})+|\s+|./)
114
+ ISEARCH_STATUS[:string].concat(buffer.match_string(0))
115
+ isearch_search
116
+ end
117
+ end
118
+
108
119
  def isearch_search
109
120
  forward = ISEARCH_STATUS[:forward]
110
121
  options = if /\A[A-Z]/ =~ ISEARCH_STATUS[:string]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Textbringer
4
- VERSION = "0.2.6"
4
+ VERSION = "0.2.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textbringer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shugo Maeda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-26 00:00:00.000000000 Z
11
+ date: 2017-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses