textbringer 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/lib/textbringer/buffer.rb +16 -6
- data/lib/textbringer/utils.rb +2 -2
- data/lib/textbringer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d269dfb51f840ae1bc3e23835cc9615a1a6680e
|
4
|
+
data.tar.gz: ccf2eebae9ea22d693dcc824a5a5b10634f9a68f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a77d400ed5c0ba9d00b694267c873b5c2059f47ade24db38fa6c6413e957d9ef392febbc3702810cbc72c4a2a631ec7e130098372bc4742a2017532d8080d87
|
7
|
+
data.tar.gz: f4487bdee4fd6c71a171991dd4b1ddb0bbb8ee38594502c8e37edac9dd09e1929c10cac9bef09c28658168b4f6f0a18f73ffc46fdbffa3fdde1bb71dfe815694
|
data/CHANGES.md
CHANGED
data/lib/textbringer/buffer.rb
CHANGED
@@ -225,7 +225,7 @@ module Textbringer
|
|
225
225
|
@match_offsets = []
|
226
226
|
@visible_mark = nil
|
227
227
|
@read_only = read_only
|
228
|
-
@
|
228
|
+
@callbacks = {}
|
229
229
|
end
|
230
230
|
|
231
231
|
def inspect
|
@@ -301,16 +301,26 @@ module Textbringer
|
|
301
301
|
@marks.each do |mark|
|
302
302
|
mark.detach
|
303
303
|
end
|
304
|
+
fire_callbacks(:killed)
|
305
|
+
end
|
306
|
+
|
307
|
+
def on_killed(&callback)
|
308
|
+
add_callback(:killed, callback)
|
304
309
|
end
|
305
310
|
|
306
311
|
def current?
|
307
312
|
@@current == self
|
308
313
|
end
|
309
314
|
|
315
|
+
def on(name, &callback)
|
316
|
+
@callbacks[name] ||= []
|
317
|
+
@callbacks[name].push(callback)
|
318
|
+
end
|
319
|
+
|
310
320
|
def modified=(modified)
|
311
321
|
@modified = modified
|
312
322
|
if @composite_edit_level == 0 && modified
|
313
|
-
|
323
|
+
fire_callbacks(:modified)
|
314
324
|
end
|
315
325
|
end
|
316
326
|
|
@@ -319,7 +329,7 @@ module Textbringer
|
|
319
329
|
end
|
320
330
|
|
321
331
|
def on_modified(&callback)
|
322
|
-
|
332
|
+
add_callback(:modified, callback)
|
323
333
|
end
|
324
334
|
|
325
335
|
def [](name)
|
@@ -1213,7 +1223,7 @@ module Textbringer
|
|
1213
1223
|
@composite_edit_actions.clear
|
1214
1224
|
end
|
1215
1225
|
end
|
1216
|
-
|
1226
|
+
fire_callbacks(:modified)
|
1217
1227
|
end
|
1218
1228
|
|
1219
1229
|
def apply_mode(mode_class)
|
@@ -1503,8 +1513,8 @@ module Textbringer
|
|
1503
1513
|
end
|
1504
1514
|
end
|
1505
1515
|
|
1506
|
-
def
|
1507
|
-
@
|
1516
|
+
def fire_callbacks(name)
|
1517
|
+
@callbacks[name]&.each do |callback|
|
1508
1518
|
callback.call(self)
|
1509
1519
|
end
|
1510
1520
|
end
|
data/lib/textbringer/utils.rb
CHANGED
@@ -8,7 +8,7 @@ module Textbringer
|
|
8
8
|
|
9
9
|
def message(msg, log: true, sit_for: nil, sleep_for: nil)
|
10
10
|
str = msg.to_s
|
11
|
-
if log && Buffer.current
|
11
|
+
if log && Buffer.current&.name != "*Messages*"
|
12
12
|
buffer = Buffer["*Messages*"] ||
|
13
13
|
Buffer.new_buffer("*Messages*", undo_limit: 0).tap { |b|
|
14
14
|
b[:top_of_window] = b.new_mark
|
@@ -85,7 +85,7 @@ module Textbringer
|
|
85
85
|
if e.is_a?(SystemExit)
|
86
86
|
raise
|
87
87
|
end
|
88
|
-
if Buffer.current
|
88
|
+
if Buffer.current&.name != "*Backtrace*"
|
89
89
|
buffer = Buffer.find_or_new("*Backtrace*", undo_limit: 0)
|
90
90
|
if !buffer.mode.is_a?(BacktraceMode)
|
91
91
|
buffer.apply_mode(BacktraceMode)
|
data/lib/textbringer/version.rb
CHANGED
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
|
+
version: 0.2.4
|
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-
|
11
|
+
date: 2017-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|