vimamsa 0.1.10 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -99,12 +99,12 @@ def grep_cur_buffer(search_str, b = nil)
99
99
  }
100
100
  end
101
101
 
102
- def invoke_grep_search()
103
- start_minibuffer_cmd("", "", :grep_cur_buffer)
104
- end
102
+ # def invoke_grep_search()
103
+ # start_minibuffer_cmd("", "", :grep_cur_buffer)
104
+ # end
105
105
 
106
- def gui_one_input_action(title, field_label, button_title, callback,opt={})
107
- a = OneInputAction.new(nil, title, field_label, button_title, callback,opt)
106
+ def gui_one_input_action(title, field_label, button_title, callback, opt = {})
107
+ a = OneInputAction.new(nil, title, field_label, button_title, callback, opt)
108
108
  a.run
109
109
  return
110
110
  end
@@ -168,121 +168,48 @@ def buf_replace_string(instr)
168
168
  buf_replace(a[0], a[1])
169
169
  end
170
170
 
171
- # PopupFormGenerator.new().run
172
- class PopupFormGenerator
173
- def submit()
174
- ret = {}
175
- for id, entry in @vals
176
- ret[id] = entry.text
177
- end
178
- @callback.call(ret)
179
- @window.destroy
180
- end
181
-
182
- def initialize(params = nil)
183
- @window = Gtk::Window.new(:toplevel)
184
- # @window.screen = main_window.screen
185
- # @window.title = title
186
- # params = {}
187
- # params["inputs"] = {}
188
- # params["inputs"]["search"] = { :label => "Search", :type => :entry }
189
- # params["inputs"]["replace"] = { :label => "Replace", :type => :entry }
190
- # params["inputs"]["btn1"] = { :label => "Replace all", :type => :button }
191
- # params[:callback] = proc { |x| puts "====="; puts x.inspect; puts "=====" }
192
-
193
- @callback = params[:callback]
194
- @window.title = ""
195
-
196
- frame = Gtk::Frame.new()
197
- frame.margin = 8
198
- @window.add(frame)
199
-
200
- # @window.title = params["title"]
201
-
202
- # @callback = params["callback"]
203
-
204
- infolabel = Gtk::Label.new
205
- # infolabel.markup = params["title"]
206
-
207
- vbox = Gtk::Box.new(:vertical, 8)
208
- vbox.margin = 8
209
- frame.add(vbox)
210
-
211
- hbox = Gtk::Box.new(:horizontal, 8)
212
- # @window.add(hbox)
213
- @vals = {}
214
-
215
- for id, elem in params["inputs"]
216
- if elem[:type] == :button
217
- button = Gtk::Button.new(:label => elem[:label])
218
- hbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
219
- button.signal_connect "clicked" do
220
- submit
221
- end
222
- elsif elem[:type] == :entry
223
- label = Gtk::Label.new(elem[:label])
224
- entry = Gtk::Entry.new
225
- hbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
226
- hbox.pack_start(entry, :expand => false, :fill => false, :padding => 0)
227
- @vals[id] = entry
228
-
229
- entry.signal_connect("key_press_event") do |widget, event|
230
- if event.keyval == Gdk::Keyval::KEY_Return
231
- submit
232
- true
233
- elsif event.keyval == Gdk::Keyval::KEY_Escape
234
- @window.destroy
235
- true
236
- else
237
- false
238
- end
239
- end
240
- end
241
- end
242
-
243
- vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0)
244
-
245
- cancel_button = Gtk::Button.new(:label => "Cancel")
246
- cancel_button.signal_connect "clicked" do
247
- @window.destroy
171
+ module Gtk
172
+ class Frame
173
+ def margin=(a)
174
+ self.margin_bottom = a
175
+ self.margin_top = a
176
+ self.margin_end = a
177
+ self.margin_start = a
248
178
  end
249
- hbox.pack_start(cancel_button, :expand => false, :fill => false, :padding => 0)
250
-
251
- return
252
179
  end
253
180
 
254
- def run
255
- if !@window.visible?
256
- @window.show_all
257
- else
258
- @window.destroy
181
+ class Box
182
+ def margin=(a)
183
+ self.margin_bottom = a
184
+ self.margin_top = a
185
+ self.margin_end = a
186
+ self.margin_start = a
259
187
  end
260
- @window
261
188
  end
262
189
  end
263
190
 
264
191
  class OneInputAction
265
192
  def initialize(main_window, title, field_label, button_title, callback, opt = {})
266
- @window = Gtk::Window.new(:toplevel)
193
+ @window = Gtk::Window.new()
267
194
  # @window.screen = main_window.screen
268
195
  # @window.title = title
269
196
  @window.title = ""
270
197
 
271
198
  frame = Gtk::Frame.new()
272
- frame.margin = 8
273
- @window.add(frame)
199
+ # frame.margin = 20
200
+ @window.set_child(frame)
274
201
 
275
202
  infolabel = Gtk::Label.new
276
203
  infolabel.markup = title
277
204
 
278
205
  vbox = Gtk::Box.new(:vertical, 8)
279
- vbox.margin = 8
280
- frame.add(vbox)
206
+ vbox.margin = 10
207
+ frame.set_child(vbox)
281
208
 
282
209
  hbox = Gtk::Box.new(:horizontal, 8)
283
210
  # @window.add(hbox)
284
- vbox.pack_start(infolabel, :expand => false, :fill => false, :padding => 0)
285
- vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0)
211
+ vbox.pack_end(infolabel, :expand => false, :fill => false, :padding => 0)
212
+ vbox.pack_end(hbox, :expand => false, :fill => false, :padding => 0)
286
213
 
287
214
  button = Gtk::Button.new(:label => button_title)
288
215
  cancel_button = Gtk::Button.new(:label => "Cancel")
@@ -304,12 +231,15 @@ class OneInputAction
304
231
  @window.destroy
305
232
  end
306
233
 
307
- @entry1.signal_connect("key_press_event") do |widget, event|
308
- if event.keyval == Gdk::Keyval::KEY_Return
234
+ press = Gtk::EventControllerKey.new
235
+ press.set_propagation_phase(Gtk::PropagationPhase::CAPTURE)
236
+ @window.add_controller(press)
237
+ press.signal_connect "key-pressed" do |gesture, keyval, keycode, y|
238
+ if keyval == Gdk::Keyval::KEY_Return
309
239
  callback.call(@entry1.text)
310
240
  @window.destroy
311
241
  true
312
- elsif event.keyval == Gdk::Keyval::KEY_Escape
242
+ elsif keyval == Gdk::Keyval::KEY_Escape
313
243
  @window.destroy
314
244
  true
315
245
  else
@@ -317,16 +247,16 @@ class OneInputAction
317
247
  end
318
248
  end
319
249
 
320
- hbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
321
- hbox.pack_start(@entry1, :expand => false, :fill => false, :padding => 0)
322
- hbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
323
- hbox.pack_start(cancel_button, :expand => false, :fill => false, :padding => 0)
250
+ hbox.pack_end(label, :expand => false, :fill => false, :padding => 0)
251
+ hbox.pack_end(@entry1, :expand => false, :fill => false, :padding => 0)
252
+ hbox.pack_end(button, :expand => false, :fill => false, :padding => 0)
253
+ hbox.pack_end(cancel_button, :expand => false, :fill => false, :padding => 0)
324
254
  return
325
255
  end
326
256
 
327
257
  def run
328
258
  if !@window.visible?
329
- @window.show_all
259
+ @window.show
330
260
  else
331
261
  @window.destroy
332
262
  end
data/lib/vimamsa/util.rb CHANGED
@@ -1,12 +1,66 @@
1
+ # Run idle proc once
2
+ # Delay execution of proc until Gtk has fully processed the last calls.
3
+ def run_as_idle(p)
4
+ if p.class == Proc
5
+ Thread.new {
6
+ GLib::Idle.add(proc { p.call; false })
7
+ }
8
+ end
9
+ end
10
+
11
+ class HSafe
12
+ def initialize(hash)
13
+ @h = hash
14
+ @a = []
15
+ end
16
+
17
+ def [](x)
18
+ @a << x
19
+ return self
20
+ end
21
+
22
+ def val
23
+ b = @a.reverse
24
+ hh = @h
25
+ while !b.empty?
26
+ x = b.pop
27
+ puts "x=#{x}"
28
+ pp b
29
+ ok = false
30
+ if hh.class == Hash or hh.class == Array
31
+ ok = true
32
+ else
33
+ if hh.methods.include?(:[])
34
+ ok = true
35
+ end
36
+ end
37
+ return nil if !ok
38
+ if hh[x].nil?
39
+ return nil
40
+ else
41
+ hh = hh[x]
42
+ end
43
+ end
44
+ return hh
45
+ end
46
+ end
47
+
48
+ # h= Hash.new
49
+ # h[2] = Hash.new
50
+ # h[2]["sdf"] = Hash.new
51
+ # h[2]["sdf"][:ll] = 2323
52
+ # pp HSafe.new(h)[2]["sdf"][:ll].val
53
+ # pp HSafe.new(h)[2]["sdf"][:llz].val
54
+ # pp HSafe.new(h)["SDFSDFD"]["sdf"][:llz].val
1
55
 
2
56
  # From https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
3
57
  # Cross-platform way of finding an executable in the $PATH.
4
58
  #
5
59
  # which('ruby') #=> /usr/bin/ruby
6
60
 
7
-
8
61
  # Execute proc after wait_time seconds after last .run call.
9
62
  # Used for image scaling after window resize
63
+
10
64
  class DelayExecutioner
11
65
  def initialize(wait_time, _proc)
12
66
  @wait_time = wait_time
@@ -1,3 +1,3 @@
1
1
  module Vimamsa
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.12"
3
3
  end
data/lib/vimamsa.rb CHANGED
@@ -1,17 +1,12 @@
1
1
  require "vimamsa/version"
2
2
 
3
- require "gtk3"
4
- require "gtksourceview4"
5
- test1 = Gtk::TextView.new
6
-
7
3
  require "vmaext"
8
4
 
9
5
  require "vimamsa/rbvma"
10
6
 
11
7
  module Vimamsa
12
- # Your code goes here...
13
8
  def self.test
14
- puts "Vimamsa test"
9
+ puts "Vimamsa c-extension test"
15
10
  puts srn_dst("foobar", "baz")
16
11
  end
17
12
  end
@@ -8,6 +8,9 @@
8
8
  </_description>
9
9
 
10
10
  <color name="heading" value="#CF6A4C"/>
11
+ <style name="selection" foreground="#ffffff" background="#10bd8e"/>
12
+
13
+
11
14
  <style foreground="#AE81FF" name="def:boolean"/>
12
15
  <style foreground="#AE81FF" name="def:number"/>
13
16
  <style foreground="#E6DB74" name="def:string"/>
data/vimamsa.gemspec CHANGED
@@ -20,20 +20,20 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib","ext"]
22
22
 
23
- spec.add_development_dependency "bundler", "~> 2.2.33"
23
+ spec.add_development_dependency "bundler", "~> 2.4.21"
24
24
  spec.add_development_dependency "rake", "~> 13.0"
25
25
 
26
- spec.add_runtime_dependency 'rufo', '~> 0.5'
26
+ spec.add_runtime_dependency 'rufo', '~> 0.16.2'
27
27
 
28
- spec.add_runtime_dependency 'ripl', '~> 0.7'
28
+ spec.add_runtime_dependency 'ripl', '~> 0.7.1'
29
29
  spec.add_runtime_dependency 'ripl-multi_line', '~> 0.3.1'
30
- spec.add_runtime_dependency 'gdk3', '~> 3.4'
31
- spec.add_runtime_dependency 'gtk3', '~> 3.4'
32
- spec.add_runtime_dependency 'differ', '~> 0.1'
33
- # spec.add_runtime_dependency 'gtksourceview3', '~> 3.4'
34
- spec.add_runtime_dependency 'gtksourceview4'
35
- spec.add_runtime_dependency 'parallel', '~> 1.14'
36
- spec.add_runtime_dependency 'listen', '~> 3.4'
30
+ spec.add_runtime_dependency 'gdk4', '~> 4.2.0'
31
+ spec.add_runtime_dependency 'gtk4', '~> 4.2.0'
32
+ spec.add_runtime_dependency 'differ', '~> 0.1.2'
33
+ spec.add_runtime_dependency 'gtksourceview5', '~> 4.2.0'
34
+ spec.add_runtime_dependency 'parallel', '~> 1.14' #TODO: update?
35
+ spec.add_runtime_dependency 'listen', '~> 3.4' #TODO: update?
36
+
37
37
 
38
38
  spec.extensions = ["ext/vmaext/extconf.rb"]
39
39
  spec.licenses = ['GPL-3.0+']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vimamsa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sami Sieranoja
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-27 00:00:00.000000000 Z
11
+ date: 2023-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.33
19
+ version: 2.4.21
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.2.33
26
+ version: 2.4.21
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.5'
47
+ version: 0.16.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.5'
54
+ version: 0.16.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: ripl
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.7'
61
+ version: 0.7.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.7'
68
+ version: 0.7.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ripl-multi_line
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -81,61 +81,61 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.3.1
83
83
  - !ruby/object:Gem::Dependency
84
- name: gdk3
84
+ name: gdk4
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.4'
89
+ version: 4.2.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.4'
96
+ version: 4.2.0
97
97
  - !ruby/object:Gem::Dependency
98
- name: gtk3
98
+ name: gtk4
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '3.4'
103
+ version: 4.2.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '3.4'
110
+ version: 4.2.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: differ
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0.1'
117
+ version: 0.1.2
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0.1'
124
+ version: 0.1.2
125
125
  - !ruby/object:Gem::Dependency
126
- name: gtksourceview4
126
+ name: gtksourceview5
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: 4.2.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: 4.2.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: parallel
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -202,6 +202,7 @@ files:
202
202
  - lib/vimamsa/file_finder.rb
203
203
  - lib/vimamsa/file_history.rb
204
204
  - lib/vimamsa/file_manager.rb
205
+ - lib/vimamsa/form_generator.rb
205
206
  - lib/vimamsa/gui.rb
206
207
  - lib/vimamsa/gui_image.rb
207
208
  - lib/vimamsa/gui_menu.rb
@@ -212,6 +213,7 @@ files:
212
213
  - lib/vimamsa/key_actions.rb
213
214
  - lib/vimamsa/key_binding_tree.rb
214
215
  - lib/vimamsa/key_bindings_vimlike.rb
216
+ - lib/vimamsa/langservp.rb
215
217
  - lib/vimamsa/macro.rb
216
218
  - lib/vimamsa/main.rb
217
219
  - lib/vimamsa/rbvma.rb
@@ -245,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
247
  - !ruby/object:Gem::Version
246
248
  version: '0'
247
249
  requirements: []
248
- rubygems_version: 3.1.2
250
+ rubygems_version: 3.4.20
249
251
  signing_key:
250
252
  specification_version: 4
251
253
  summary: Vimamsa