bubbletea 0.1.3-x86-linux-musl → 0.1.4-x86-linux-musl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8799d3ddb86e7b6bcd430c2213042152a7fbe2c5805caf5f57d5c9b553ff4914
4
- data.tar.gz: 9896b1c9f07c028c69ae9689e1a8be2bad6e5028f1e444f5f579d46ff93bf0a2
3
+ metadata.gz: b6e128f1586b157bafa8b0ead5dccaf56cf5ef2b94ae0ea475fcc09859f60533
4
+ data.tar.gz: 8eb1fce4af9a94a0ea0b6dde589dcbd7d3646b8ae8bd09a80e3804940c78f191
5
5
  SHA512:
6
- metadata.gz: bf123379ee834aa6ea61969714ca4dd2da6c55f5e31239cac1ffa5588da5af6a58d7eee1b74979edf4884b91dad7839eb5aee41e1d486bdbc8742a2f8beefe0a
7
- data.tar.gz: 74eb6ca90ed6277cd1cb1ec348542db08c028e7ee5dc312fdfb202d6ac6901f208c52c9aaaf9248d6b8faa6129a740bb5d63082bc82dc2d0e55d39d95c469a37
6
+ metadata.gz: 07b3fda9bc5460455788aaf0f139f1a818cc17ac0996182df2ff747484e740168da56e21f7b6024834494a9d72d421201712ea759c5e8a5f4a5e30ecc9352e9b
7
+ data.tar.gz: 9129925d250feb286707a27edea8da537e934c671be08ebb96ba9fcb2b8bd5399eee95f11c5d441c2ce886ba2757b4ecc4b1f0e9524f04bec2f571a3823414f2
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -78,6 +78,16 @@ module Bubbletea
78
78
  class SuspendCommand < Command
79
79
  end
80
80
 
81
+ class ExecCommand < Command
82
+ attr_reader :callable, :message
83
+
84
+ def initialize(callable, message: nil)
85
+ super()
86
+ @callable = callable
87
+ @message = message
88
+ end
89
+ end
90
+
81
91
  class << self
82
92
  def quit
83
93
  QuitCommand.new
@@ -122,5 +132,9 @@ module Bubbletea
122
132
  def suspend
123
133
  SuspendCommand.new
124
134
  end
135
+
136
+ def exec(callable, message: nil)
137
+ ExecCommand.new(callable, message: message)
138
+ end
125
139
  end
126
140
  end
@@ -233,6 +233,9 @@ module Bubbletea
233
233
  when SuspendCommand
234
234
  suspend_process
235
235
 
236
+ when ExecCommand
237
+ exec_process(command)
238
+
236
239
  when Proc
237
240
  Thread.new do
238
241
  result = command.call
@@ -286,6 +289,9 @@ module Bubbletea
286
289
  when SuspendCommand
287
290
  suspend_process
288
291
 
292
+ when ExecCommand
293
+ exec_process(command)
294
+
289
295
  when Proc
290
296
  result = command.call
291
297
  return unless result
@@ -360,6 +366,23 @@ module Bubbletea
360
366
  handle_message(ResumeMessage.new)
361
367
  end
362
368
 
369
+ def exec_process(command)
370
+ @program.disable_mouse if @options[:mouse_cell_motion] || @options[:mouse_all_motion]
371
+ @program.show_cursor
372
+ @program.stop_input_reader
373
+ @program.exit_raw_mode
374
+
375
+ command.callable.call
376
+
377
+ @program.enter_raw_mode
378
+ @program.hide_cursor
379
+ @program.start_input_reader
380
+ @program.enable_mouse_cell_motion if @options[:mouse_cell_motion]
381
+ @program.enable_mouse_all_motion if @options[:mouse_all_motion]
382
+
383
+ handle_message(command.message) if command.message
384
+ end
385
+
363
386
  def render
364
387
  return if @options[:without_renderer]
365
388
  return unless @renderer_id
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bubbletea
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bubbletea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: x86-linux-musl
6
6
  authors:
7
7
  - Marco Roth