textbringer 0.2.4 → 0.2.5

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: 0d269dfb51f840ae1bc3e23835cc9615a1a6680e
4
- data.tar.gz: ccf2eebae9ea22d693dcc824a5a5b10634f9a68f
3
+ metadata.gz: 43ad091e53d7d19724cd9e0cbeddcd71faa3cef5
4
+ data.tar.gz: 42455b6be377fee9ca997b77addbfa5fdf85dd9c
5
5
  SHA512:
6
- metadata.gz: 2a77d400ed5c0ba9d00b694267c873b5c2059f47ade24db38fa6c6413e957d9ef392febbc3702810cbc72c4a2a631ec7e130098372bc4742a2017532d8080d87
7
- data.tar.gz: f4487bdee4fd6c71a171991dd4b1ddb0bbb8ee38594502c8e37edac9dd09e1929c10cac9bef09c28658168b4f6f0a18f73ffc46fdbffa3fdde1bb71dfe815694
6
+ metadata.gz: f54811a073bff5d7583a50dde84b90e91620b6b9e6401ce694746edbad846f6bc2ae6bfdb466306f2ce28ac8221cf5914b827a31ecef077a43d5f27ac0465af6
7
+ data.tar.gz: 3241db0e8134b199e991a15a9affcad48894d823aad3becea9b48cfce05c99217604fbcbcb76f2d2f4d789146a08462cb94b06413d6bdd73f943ed284312fd68
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.2.5
2
+
3
+ * Add next_tick!.
4
+ * Add Buffer#replace.
5
+
1
6
  ## 0.2.4
2
7
 
3
8
  * Remove Buffer#on_modified and add Buffer#on instead.
@@ -931,6 +931,13 @@ module Textbringer
931
931
  end
932
932
  end
933
933
 
934
+ def replace(s)
935
+ composite_edit do
936
+ delete_region(point_min, point_max)
937
+ insert(s)
938
+ end
939
+ end
940
+
934
941
  def clear
935
942
  check_read_only_flag
936
943
  @contents = String.new
@@ -61,8 +61,26 @@ module Textbringer
61
61
  end
62
62
  end
63
63
 
64
- def next_tick(*args, &block)
65
- Controller.current.next_tick(*args, &block)
64
+ def next_tick(&block)
65
+ Controller.current.next_tick(&block)
66
+ end
67
+
68
+ def next_tick!
69
+ q = Queue.new
70
+ next_tick do
71
+ begin
72
+ result = yield
73
+ q.push([:ok, result])
74
+ rescue Exception => e
75
+ q.push([:error, e])
76
+ end
77
+ end
78
+ status, value = q.pop
79
+ if status == :error
80
+ raise value
81
+ else
82
+ value
83
+ end
66
84
  end
67
85
 
68
86
  def read_event
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Textbringer
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.5"
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.4
4
+ version: 0.2.5
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-07-19 00:00:00.000000000 Z
11
+ date: 2017-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses