textbringer 1.3.0 → 1.4.1

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
  SHA256:
3
- metadata.gz: 5e9f67d3a60acc75b16f9f5ede7d7670068590b2331aa905b73d9fe09676e305
4
- data.tar.gz: 388e2c7cdecee2292ea17167810944f1ccfc2f7ed0dfb48db9732e31c71b5818
3
+ metadata.gz: c32799602faad1b9a13a0d298bcf922aa4fcac7430fc9f17258e457ef0463bd8
4
+ data.tar.gz: 853b1b04ed778c8f04117ca23bfe22e0989d79028869d54fbcca7fff65203795
5
5
  SHA512:
6
- metadata.gz: f8973ef2ee4f24b829ebb505229ca45ee48a7f2d5fa21f20afb5bfce4c0b9df5333cbb5614ba1a48dcc1633e286edc2199d68b7fab347d090be94e43d376d205
7
- data.tar.gz: e5847cd0e51bd26a8b4d38a5682ff9347d5886022e62b11a6e1b294dc78df455718e9be5319098050709545a98b75b41775db618562dd2bdee72a3e65baf91bd
6
+ metadata.gz: 2d2cc2d14d52bdfe261a5a1499db09a76917e20040b142d5c266131fa255d90cb5823059b719f40cfb608453a1090cc4affa0abf6f741aa3bd587be47b092c87
7
+ data.tar.gz: c068f9f253ea113ecf2bd082600a89c5dd483a4240a1546f06e08e10e76bb22a9e0ee31fcbb753755687f43b19d73b492f3d3cb207657bd170f7a67ef382b8d9
@@ -3,14 +3,21 @@ name: macos
3
3
  on: [push]
4
4
 
5
5
  jobs:
6
- build:
6
+ test:
7
7
  runs-on: macos-latest
8
+ strategy:
9
+ matrix:
10
+ ruby: [ head, 3.3 ]
8
11
  timeout-minutes: 10
12
+ env:
13
+ RUBYOPT: --enable-frozen-string-literal --debug-frozen-string-literal
9
14
  steps:
10
- - uses: actions/checkout@master
15
+ - uses: actions/checkout@v4
16
+ - uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
11
19
  - name: Install dependencies
12
20
  run: |
13
- gem install bundler --no-document
14
21
  bundle install
15
22
  - name: Run test
16
23
  run: bundle exec rake test
@@ -0,0 +1,48 @@
1
+ name: Publish gem to rubygems.org
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ push:
13
+ if: github.repository == 'shugo/textbringer'
14
+ runs-on: ubuntu-latest
15
+
16
+ environment:
17
+ name: rubygems.org
18
+ url: https://rubygems.org/gems/textbringer
19
+
20
+ permissions:
21
+ contents: write
22
+ id-token: write
23
+
24
+ steps:
25
+ # Set up
26
+ - name: Harden Runner
27
+ uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
28
+ with:
29
+ egress-policy: audit
30
+
31
+ - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
32
+
33
+ - name: Set up Ruby
34
+ uses: ruby/setup-ruby@cacc9f1c0b3f4eb8a16a6bb0ed10897b43b9de49 # v1.176.0
35
+ with:
36
+ bundler-cache: true
37
+ ruby-version: ruby
38
+
39
+ # Release
40
+ - name: Publish to RubyGems
41
+ uses: rubygems/release-gem@612653d273a73bdae1df8453e090060bb4db5f31 # v1
42
+
43
+ - name: Create GitHub release
44
+ run: |
45
+ tag_name="$(git describe --tags --abbrev=0)"
46
+ gh release create "${tag_name}" --verify-tag --draft --generate-notes
47
+ env:
48
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -4,20 +4,21 @@ on: [push]
4
4
 
5
5
  jobs:
6
6
  test:
7
+ runs-on: ubuntu-latest
7
8
  strategy:
8
9
  matrix:
9
- ruby: [ head, 3.1, 3.0, 2.7 ]
10
- runs-on: ubuntu-latest
10
+ ruby: [ head, 3.3, 3.2, 3.1 ]
11
11
  timeout-minutes: 10
12
+ env:
13
+ RUBYOPT: --enable-frozen-string-literal --debug-frozen-string-literal
12
14
  steps:
13
- - uses: actions/checkout@v2
15
+ - uses: actions/checkout@v4
14
16
  - uses: ruby/setup-ruby@v1
15
17
  with:
16
18
  ruby-version: ${{ matrix.ruby }}
17
19
  - name: Install dependencies
18
20
  run: |
19
21
  sudo apt install libncursesw5-dev
20
- gem install bundler --no-document
21
22
  bundle install
22
23
  - name: Run test
23
24
  run: xvfb-run bundle exec rake test
@@ -3,14 +3,16 @@ name: windows
3
3
  on: [push]
4
4
 
5
5
  jobs:
6
- build:
6
+ test:
7
7
  runs-on: windows-latest
8
8
  strategy:
9
9
  matrix:
10
- ruby: [ 'mingw', 'mswin', '3.0', '2.7' ]
10
+ ruby: [ 'mingw', 'mswin', '3.3' ]
11
11
  timeout-minutes: 10
12
+ env:
13
+ RUBYOPT: --enable-frozen-string-literal --debug-frozen-string-literal
12
14
  steps:
13
- - uses: actions/checkout@v2
15
+ - uses: actions/checkout@v4
14
16
  - name: Set up Ruby
15
17
  uses: ruby/setup-ruby@v1
16
18
  with:
data/CHANGES.md CHANGED
@@ -1,3 +1,6 @@
1
+ This file is no longer being updated after version 1.3.0.
2
+ For changes since version 1.3.0, see <URL:https://github.com/shugo/textbringer/releases>.
3
+
1
4
  ## 1.3.0
2
5
 
3
6
  * Kernel#print etc. inserts the given string into the current buffer now.
data/README.ja.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # ![Textbringer](logo/logo.png)
2
2
 
3
+ [![LatestVer](https://badgen.net/badge/latestver/0.1)](https://latestver.org/)
3
4
  [![Gem Version](https://badge.fury.io/rb/textbringer.svg)](https://badge.fury.io/rb/textbringer)
4
5
  [![ubuntu](https://github.com/shugo/textbringer/workflows/ubuntu/badge.svg)](https://github.com/shugo/textbringer/actions?query=workflow%3Aubuntu)
5
6
  [![windows](https://github.com/shugo/textbringer/workflows/windows/badge.svg)](https://github.com/shugo/textbringer/actions?query=workflow%3Awindows)
@@ -92,7 +93,7 @@ xterm、 mlterm、screenにはそれぞれ独自の設定項目があります
92
93
 
93
94
  ## プラグイン
94
95
 
95
- * [Mournmamil](https://github.com/shugo/mournmail): 電子メールクライアント
96
+ * [Mournmail](https://github.com/shugo/mournmail): 電子メールクライアント
96
97
  * [MedicineShield](https://github.com/shugo/medicine_shield): Mastodonクライアント
97
98
  * [textbringer-presentation](https://github.com/shugo/textbringer-presentation): プレゼンテーションツール
98
99
  * [textbringer-ghost_text](https://github.com/shugo/textbringer-ghost_text): [GhostText](https://github.com/fregante/GhostText)プラグイン
data/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # ![Textbringer](logo/logo.png)
2
2
 
3
+ [![LatestVer](https://badgen.net/badge/latestver/0.1)](https://latestver.org/)
3
4
  [![Gem Version](https://badge.fury.io/rb/textbringer.svg)](https://badge.fury.io/rb/textbringer)
4
5
  [![ubuntu](https://github.com/shugo/textbringer/workflows/ubuntu/badge.svg)](https://github.com/shugo/textbringer/actions?query=workflow%3Aubuntu)
5
6
  [![windows](https://github.com/shugo/textbringer/workflows/windows/badge.svg)](https://github.com/shugo/textbringer/actions?query=workflow%3Awindows)
6
7
  [![macos](https://github.com/shugo/textbringer/workflows/macos/badge.svg)](https://github.com/shugo/textbringer/actions?query=workflow%3Amacos)
7
8
 
8
- * [日本語版](README.ja.md)
9
+ * [Japanese version](README.ja.md)
9
10
 
10
11
  Textbringer is an Emacs-like text editor written in Ruby.
11
12
  It is extensible by Ruby instead of Lisp.
@@ -97,7 +98,7 @@ Add the following line to ~/.screenrc.
97
98
 
98
99
  ## Plugins
99
100
 
100
- * [Mournmamil](https://github.com/shugo/mournmail): a mail user agent
101
+ * [Mournmail](https://github.com/shugo/mournmail): a mail user agent
101
102
  * [MedicineShield](https://github.com/shugo/medicine_shield): a Mastodon client
102
103
  * [textbringer-presentation](https://github.com/shugo/textbringer-presentation): a presentation tool
103
104
  * [textbringer-ghost_text](https://github.com/shugo/textbringer-ghost_text): a [GhostText](https://github.com/fregante/GhostText) plugin
data/exe/txtb CHANGED
@@ -4,6 +4,7 @@ require "warning"
4
4
 
5
5
  Warning.ignore(/already initialized constant /)
6
6
  Warning.ignore(/previous definition of /)
7
+ Warning.ignore(/not part of the default gems/)
7
8
 
8
9
  require "textbringer"
9
10
 
@@ -44,7 +44,11 @@ module Textbringer
44
44
  e = NKF.guess(s)
45
45
  case e
46
46
  when Encoding::US_ASCII
47
- Encoding::UTF_8
47
+ if s.ascii_only?
48
+ Encoding::UTF_8
49
+ else
50
+ Encoding::ASCII_8BIT
51
+ end
48
52
  when Encoding::ASCII_8BIT
49
53
  s.force_encoding(Encoding::UTF_8)
50
54
  if s.valid_encoding?
@@ -58,7 +62,14 @@ module Textbringer
58
62
  end
59
63
  }
60
64
 
61
- STRING_HAS_BYTE_BASED_METHODS = String.instance_methods.include?(:bytesplice)
65
+ HAS_BYTEINDEX = String.instance_methods.include?(:byteindex)
66
+ HAS_BYTESPLICE = String.instance_methods.include?(:bytesplice)
67
+ BYTESPLICE_SUPPORTS_PARTIAL_COPY =
68
+ begin
69
+ (+"foo").bytesplice(0, 2, "bar", 1, 2) == "aro"
70
+ rescue NoMethodError, ArgumentError
71
+ false
72
+ end
62
73
 
63
74
  if !defined?(@@detect_encoding_proc)
64
75
  @@detect_encoding_proc = DEFAULT_DETECT_ENCODING
@@ -176,7 +187,7 @@ module Textbringer
176
187
 
177
188
  def self.new_buffer_name(name)
178
189
  if @@table.key?(name)
179
- (2..Float::INFINITY).lazy.map { |i|
190
+ (2..).lazy.map { |i|
180
191
  "#{name}<#{i}>"
181
192
  }.find { |i| !@@table.key?(i) }
182
193
  else
@@ -271,13 +282,6 @@ module Textbringer
271
282
  def file_encoding=(enc)
272
283
  @file_encoding = Encoding.find(enc)
273
284
  @binary = @file_encoding == Encoding::ASCII_8BIT
274
- if STRING_HAS_BYTE_BASED_METHODS
275
- if @binary
276
- @contents.force_encoding(Encoding::ASCII_8BIT)
277
- else
278
- @contents.force_encoding(Encoding::UTF_8)
279
- end
280
- end
281
285
  end
282
286
 
283
287
  def binary?
@@ -448,7 +452,7 @@ module Textbringer
448
452
  def to_s
449
453
  result = @contents.byteslice(0...@gap_start) +
450
454
  @contents.byteslice(@gap_end..-1)
451
- if !@binary && !STRING_HAS_BYTE_BASED_METHODS
455
+ if !@binary
452
456
  result.force_encoding(Encoding::UTF_8)
453
457
  end
454
458
  result
@@ -463,7 +467,7 @@ module Textbringer
463
467
  @contents.byteslice(user_to_gap(s), len) +
464
468
  @contents.byteslice(@gap_end, e - s - len)
465
469
  end
466
- if !@binary && !STRING_HAS_BYTE_BASED_METHODS
470
+ if !@binary
467
471
  result.force_encoding(Encoding::UTF_8)
468
472
  end
469
473
  result
@@ -525,7 +529,7 @@ module Textbringer
525
529
  if pos == point_min
526
530
  column = 1
527
531
  else
528
- if STRING_HAS_BYTE_BASED_METHODS
532
+ if HAS_BYTEINDEX
529
533
  begin
530
534
  i = @contents.byterindex("\n", user_to_gap(get_pos(pos, -1)))
531
535
  rescue RangeError
@@ -562,7 +566,7 @@ module Textbringer
562
566
  pos = point_min
563
567
  i = 1
564
568
  while i < n && pos < @contents.bytesize
565
- if STRING_HAS_BYTE_BASED_METHODS
569
+ if HAS_BYTEINDEX
566
570
  pos = @contents.byteindex("\n", pos)
567
571
  else
568
572
  pos = @contents.index("\n", pos)
@@ -586,7 +590,7 @@ module Textbringer
586
590
  pos = @point
587
591
  size = s.bytesize
588
592
  adjust_gap(size)
589
- splice_contents(@point, size, STRING_HAS_BYTE_BASED_METHODS ? s : s.b)
593
+ splice_contents(@point, size, s.b)
590
594
  @marks.each do |m|
591
595
  if m.location > @point
592
596
  m.location += size
@@ -995,10 +999,7 @@ module Textbringer
995
999
 
996
1000
  def clear
997
1001
  check_read_only_flag
998
- @contents = +""
999
- if binary? || !STRING_HAS_BYTE_BASED_METHODS
1000
- @contents.force_encoding(Encoding::ASCII_8BIT)
1001
- end
1002
+ @contents = String.new
1002
1003
  @point = @gap_start = @gap_end = 0
1003
1004
  @marks.each do |m|
1004
1005
  m.location = 0
@@ -1056,47 +1057,11 @@ module Textbringer
1056
1057
  end
1057
1058
 
1058
1059
  def undo
1059
- check_read_only_flag
1060
- if @undo_stack.empty?
1061
- raise EditorError, "No further undo information"
1062
- end
1063
- action = @undo_stack.pop
1064
- @undoing = true
1065
- begin
1066
- was_modified = @modified
1067
- action.undo
1068
- if action.version == @version
1069
- @modified = false
1070
- action.version = nil
1071
- elsif !was_modified
1072
- action.version = @version
1073
- end
1074
- @redo_stack.push(action)
1075
- ensure
1076
- @undoing = false
1077
- end
1060
+ undo_or_redo(:undo, @undo_stack, @redo_stack)
1078
1061
  end
1079
1062
 
1080
1063
  def redo
1081
- check_read_only_flag
1082
- if @redo_stack.empty?
1083
- raise EditorError, "No further redo information"
1084
- end
1085
- action = @redo_stack.pop
1086
- @undoing = true
1087
- begin
1088
- was_modified = @modified
1089
- action.redo
1090
- if action.version == @version
1091
- @modified = false
1092
- action.version = nil
1093
- elsif !was_modified
1094
- action.version = @version
1095
- end
1096
- @undo_stack.push(action)
1097
- ensure
1098
- @undoing = false
1099
- end
1064
+ undo_or_redo(:redo, @redo_stack, @undo_stack)
1100
1065
  end
1101
1066
 
1102
1067
  def re_search_forward(s, raise_error: true, count: 1)
@@ -1158,7 +1123,7 @@ module Textbringer
1158
1123
  byteindex(true, r, @point) == @point
1159
1124
  end
1160
1125
 
1161
- if STRING_HAS_BYTE_BASED_METHODS
1126
+ if HAS_BYTEINDEX
1162
1127
  def byteindex(forward, re, pos)
1163
1128
  @match_offsets = []
1164
1129
  method = forward ? :byteindex : :byterindex
@@ -1480,9 +1445,7 @@ module Textbringer
1480
1445
  else
1481
1446
  @contents = s.encode(Encoding::UTF_8)
1482
1447
  end
1483
- if !STRING_HAS_BYTE_BASED_METHODS
1484
- @contents.force_encoding(Encoding::ASCII_8BIT)
1485
- end
1448
+ @contents.force_encoding(Encoding::ASCII_8BIT)
1486
1449
  self.file_encoding = enc
1487
1450
  begin
1488
1451
  case @contents
@@ -1502,7 +1465,7 @@ module Textbringer
1502
1465
  end
1503
1466
  end
1504
1467
 
1505
- if STRING_HAS_BYTE_BASED_METHODS
1468
+ if HAS_BYTESPLICE
1506
1469
  def splice_contents(*args)
1507
1470
  @contents.bytesplice(*args)
1508
1471
  end
@@ -1515,37 +1478,37 @@ module Textbringer
1515
1478
  def adjust_gap(min_size = 0, pos = @point)
1516
1479
  if @gap_start < pos
1517
1480
  len = user_to_gap(pos) - @gap_end
1518
- s = @contents.byteslice(@gap_end, len)
1519
1481
  new_gap_start = @gap_start + len
1520
1482
  new_gap_end = @gap_end + len
1521
1483
  nul_filling_start = new_gap_start > @gap_end ? new_gap_start : @gap_end
1522
- unless @binary
1523
- # find the character boundary
1524
- while nul_filling_start > @gap_end &&
1525
- @contents.byteslice(nul_filling_start)&.b&.match?(/[\x80-\xbf]/n)
1526
- nul_filling_start -= 1
1527
- end
1484
+ if BYTESPLICE_SUPPORTS_PARTIAL_COPY
1485
+ @contents.bytesplice(@gap_start, len,
1486
+ @contents, @gap_end, len)
1487
+ @contents.bytesplice(nul_filling_start...new_gap_end,
1488
+ "\0" * (new_gap_end - nul_filling_start))
1489
+ else
1490
+ s = @contents.byteslice(@gap_end, len)
1491
+ splice_contents(nul_filling_start...new_gap_end,
1492
+ "\0" * (new_gap_end - nul_filling_start))
1493
+ splice_contents(@gap_start...new_gap_start, s)
1528
1494
  end
1529
- splice_contents(nul_filling_start...new_gap_end,
1530
- "\0" * (new_gap_end - nul_filling_start))
1531
- splice_contents(@gap_start...new_gap_start, s)
1532
1495
  @gap_start = new_gap_start
1533
1496
  @gap_end = new_gap_end
1534
1497
  elsif @gap_start > pos
1535
1498
  len = @gap_start - pos
1536
- s = @contents.byteslice(pos, len)
1537
1499
  new_gap_start = @gap_start - len
1538
1500
  new_gap_end = @gap_end - len
1539
1501
  nul_filling_end = new_gap_end < @gap_start ? new_gap_end : @gap_start
1540
- unless @binary
1541
- # find the character boundary
1542
- while nul_filling_end < @gap_start &&
1543
- @contents.byteslice(nul_filling_end)&.b&.match?(/[\x80-\xbf]/n)
1544
- nul_filling_end += 1
1545
- end
1502
+ if BYTESPLICE_SUPPORTS_PARTIAL_COPY
1503
+ @contents.bytesplice(new_gap_end, len,
1504
+ @contents, pos, len)
1505
+ @contents.bytesplice(pos...nul_filling_end,
1506
+ "\0" * (nul_filling_end - pos))
1507
+ else
1508
+ s = @contents.byteslice(pos, len)
1509
+ splice_contents(pos...nul_filling_end, "\0" * (nul_filling_end - pos))
1510
+ splice_contents(new_gap_end...@gap_end, s)
1546
1511
  end
1547
- splice_contents(pos...nul_filling_end, "\0" * (nul_filling_end - pos))
1548
- splice_contents(new_gap_end...@gap_end, s)
1549
1512
  @gap_start = new_gap_start
1550
1513
  @gap_end = new_gap_end
1551
1514
  end
@@ -1619,7 +1582,7 @@ module Textbringer
1619
1582
  @current_column += substring(pos, new_pos).size
1620
1583
  else
1621
1584
  @current_line += n
1622
- if STRING_HAS_BYTE_BASED_METHODS
1585
+ if HAS_BYTEINDEX
1623
1586
  begin
1624
1587
  i = @contents.byterindex("\n", user_to_gap(get_pos(new_pos, -1)))
1625
1588
  rescue RangeError
@@ -1641,7 +1604,7 @@ module Textbringer
1641
1604
  @current_column -= substring(new_pos, pos).size
1642
1605
  else
1643
1606
  @current_line -= n
1644
- if STRING_HAS_BYTE_BASED_METHODS
1607
+ if HAS_BYTEINDEX
1645
1608
  begin
1646
1609
  i = @contents.byterindex("\n", user_to_gap(get_pos(new_pos, - 1)))
1647
1610
  rescue RangeError
@@ -1687,9 +1650,7 @@ module Textbringer
1687
1650
  @contents.byteslice(0...@gap_start),
1688
1651
  @contents.byteslice(@gap_end..-1)
1689
1652
  ].each do |s|
1690
- if !STRING_HAS_BYTE_BASED_METHODS
1691
- s.force_encoding(Encoding::UTF_8) unless @binary
1692
- end
1653
+ s.force_encoding(Encoding::UTF_8) unless @binary
1693
1654
  case @file_format
1694
1655
  when :dos
1695
1656
  s.gsub!(/\n/, "\r\n")
@@ -1716,6 +1677,28 @@ module Textbringer
1716
1677
  end
1717
1678
  end
1718
1679
 
1680
+ def undo_or_redo(op, from_stack, to_stack)
1681
+ check_read_only_flag
1682
+ if from_stack.empty?
1683
+ raise EditorError, "No further #{op} information"
1684
+ end
1685
+ action = from_stack.pop
1686
+ @undoing = true
1687
+ begin
1688
+ was_modified = @modified
1689
+ action.send(op)
1690
+ if action.version == @version
1691
+ @modified = false
1692
+ action.version = nil
1693
+ elsif !was_modified
1694
+ action.version = @version
1695
+ end
1696
+ to_stack.push(action)
1697
+ ensure
1698
+ @undoing = false
1699
+ end
1700
+ end
1701
+
1719
1702
  def new_regexp(s)
1720
1703
  if s.is_a?(Regexp)
1721
1704
  s
@@ -7,8 +7,7 @@ require "clipboard"
7
7
  module Textbringer
8
8
  module Commands
9
9
  CLIPBOARD_AVAILABLE =
10
- Clipboard.implementation.name != "Clipboard::Linux" ||
11
- (ENV["DISPLAY"] && system("which xclip > /dev/null 2>&1"))
10
+ Clipboard.implementation.name != "Clipboard::File"
12
11
 
13
12
  if CLIPBOARD_AVAILABLE
14
13
  GLOBAL_MAP.define_key("\M-w", :clipboard_copy_region)
@@ -41,7 +41,7 @@ module Textbringer
41
41
  define_command(:describe_bindings,
42
42
  doc: "Display the key bindings.") do
43
43
  show_help do |help|
44
- s = ""
44
+ s = +""
45
45
  if Controller.current.overriding_map
46
46
  s << "Overriding Bindings:\n"
47
47
  s << keymap_bindings(Controller.current.overriding_map)
@@ -243,6 +243,9 @@ module Textbringer
243
243
  mark = yield(global_mark_ring)
244
244
  end
245
245
  if mark.detached?
246
+ unless mark.file_name
247
+ raise EditorError, "The buffer has gone"
248
+ end
246
249
  find_file(mark.file_name)
247
250
  goto_char(mark.location)
248
251
  else
@@ -57,7 +57,11 @@ module Textbringer
57
57
  end
58
58
  if key_index.nil?
59
59
  @prev_key_index = nil
60
- return event
60
+ if event.is_a?(String) && /\A[A-Z]\z/.match?(event)
61
+ return event.downcase
62
+ else
63
+ return event
64
+ end
61
65
  end
62
66
  if @prev_key_index.nil?
63
67
  @prev_key_index = key_index
@@ -153,6 +153,7 @@ module Textbringer
153
153
  GLOBAL_MAP.define_key(?\C-_, :undo)
154
154
  GLOBAL_MAP.define_key("\C-xu", :undo)
155
155
  GLOBAL_MAP.define_key("\C-x\C-_", :redo_command)
156
+ GLOBAL_MAP.define_key("\M-\C-_", :redo_command)
156
157
  GLOBAL_MAP.define_key("\C-t", :transpose_chars)
157
158
  GLOBAL_MAP.define_key("\C-j", :newline)
158
159
  GLOBAL_MAP.define_key("\C-m", :newline)
@@ -325,9 +325,22 @@ module Textbringer
325
325
  end
326
326
  end
327
327
 
328
+ if defined?(IRB::RegexpCompletor)
329
+ EXPRESSION_COMPLETOR = IRB::RegexpCompletor.new
330
+ EXPRESSION_COMPLETOR_OPTIONS = {
331
+ bind: TOPLEVEL_BINDING,
332
+ doc_namespace: false
333
+ }
334
+ else
335
+ EXPRESSION_COMPLETOR = IRB::InputCompletor
336
+ EXPRESSION_COMPLETOR_OPTIONS = {
337
+ bind: TOPLEVEL_BINDING
338
+ }
339
+ end
340
+
328
341
  def read_expression(prompt = "Expression: ")
329
342
  f = ->(s) {
330
- IRB::InputCompletor.retrieve_completion_data(s, bind: TOPLEVEL_BINDING).compact
343
+ EXPRESSION_COMPLETOR.retrieve_completion_data(s, **EXPRESSION_COMPLETOR_OPTIONS).compact
331
344
  }
332
345
  read_from_minibuffer(prompt, completion_proc: f)
333
346
  end
@@ -1,3 +1,3 @@
1
1
  module Textbringer
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.1"
3
3
  end
@@ -1,5 +1,4 @@
1
1
  require "curses"
2
- require "unicode/display_width"
3
2
 
4
3
  module Textbringer
5
4
  class Window
data/textbringer.gemspec CHANGED
@@ -19,8 +19,10 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.required_ruby_version = '>= 2.7'
22
+ spec.required_ruby_version = '>= 3.1'
23
23
 
24
+ spec.add_runtime_dependency "nkf"
25
+ spec.add_runtime_dependency "drb"
24
26
  spec.add_runtime_dependency "curses", ">= 1.2.7"
25
27
  spec.add_runtime_dependency "unicode-display_width", ">= 1.1"
26
28
  spec.add_runtime_dependency "clipboard", ">= 1.1"
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textbringer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shugo Maeda
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-12 00:00:00.000000000 Z
11
+ date: 2024-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nkf
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: drb
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: curses
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -178,6 +206,7 @@ files:
178
206
  - ".editorconfig"
179
207
  - ".gitattributes"
180
208
  - ".github/workflows/macos.yml"
209
+ - ".github/workflows/push_gem.yml"
181
210
  - ".github/workflows/ubuntu.yml"
182
211
  - ".github/workflows/windows.yml"
183
212
  - ".gitignore"
@@ -245,7 +274,7 @@ homepage: https://github.com/shugo/textbringer
245
274
  licenses:
246
275
  - MIT
247
276
  metadata: {}
248
- post_install_message:
277
+ post_install_message:
249
278
  rdoc_options: []
250
279
  require_paths:
251
280
  - lib
@@ -253,15 +282,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
253
282
  requirements:
254
283
  - - ">="
255
284
  - !ruby/object:Gem::Version
256
- version: '2.7'
285
+ version: '3.1'
257
286
  required_rubygems_version: !ruby/object:Gem::Requirement
258
287
  requirements:
259
288
  - - ">="
260
289
  - !ruby/object:Gem::Version
261
290
  version: '0'
262
291
  requirements: []
263
- rubygems_version: 3.4.0.dev
264
- signing_key:
292
+ rubygems_version: 3.5.9
293
+ signing_key:
265
294
  specification_version: 4
266
295
  summary: An Emacs-like text editor
267
296
  test_files: []