vimamsa 0.1.19 → 0.1.20

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.
data/lib/vimamsa/gui.rb CHANGED
@@ -142,7 +142,8 @@ def gui_create_buffer(id, bufo)
142
142
  provider.load(data: "textview { font-family: #{cnf.font.family!}; font-size: #{cnf.font.size!}pt; }")
143
143
  view.style_context.add_provider(provider)
144
144
  view.wrap_mode = :char
145
- view.set_tab_width(conf(:tab_width))
145
+
146
+ view.set_tab_width(cnf.tab.width!)
146
147
 
147
148
  $vmag.buffers[id] = view
148
149
  end
@@ -189,8 +190,8 @@ def gui_set_window_title(wtitle, subtitle = "")
189
190
  end
190
191
 
191
192
  class VMAgui
192
- attr_accessor :buffers, :sw, :sw1, :sw2, :view, :buf1, :window, :delex, :statnfo, :overlay, :sws, :two_c
193
- attr_reader :two_column, :windows, :subtitle, :app
193
+ attr_accessor :buffers, :sw1, :sw2, :view, :buf1, :window, :delex, :statnfo, :overlay, :sws, :two_c
194
+ attr_reader :two_column, :windows, :subtitle, :app, :active_window
194
195
 
195
196
  def initialize()
196
197
  @two_column = false
@@ -252,7 +253,7 @@ class VMAgui
252
253
 
253
254
  def start_overlay_draw()
254
255
  @da = Gtk::Fixed.new
255
- @overlay.add_overlay(@da)
256
+ @active_window[:overlay].add_overlay(@da)
256
257
 
257
258
  # @overlay.set_overlay_pass_through(@da, true) #TODO:gtk4
258
259
  end
@@ -260,7 +261,7 @@ class VMAgui
260
261
  def clear_overlay()
261
262
  if @da != nil
262
263
  # @overlay.remove(@da)
263
- @overlay.remove_overlay(@da)
264
+ @active_window[:overlay].remove_overlay(@da)
264
265
  end
265
266
  end
266
267
 
@@ -277,20 +278,6 @@ class VMAgui
277
278
  @da.show
278
279
  end
279
280
 
280
- def remove_overlay_cursor()
281
- if !@cursorov.nil?
282
- @overlay.remove_overlay(@cursorov)
283
- @cursorov = nil
284
- end
285
- end
286
-
287
- def overlay_draw_cursor(textpos)
288
- # return
289
- remove_overlay_cursor
290
- GLib::Idle.add(proc { self.overlay_draw_cursor_(textpos) })
291
- # overlay_draw_cursor_(textpos)
292
- end
293
-
294
281
  # Run proc after animated scrolling has stopped (e.g. after page down)
295
282
  def run_after_scrolling(p)
296
283
  Thread.new {
@@ -307,31 +294,6 @@ class VMAgui
307
294
  }
308
295
  end
309
296
 
310
- # To draw on empty lines and line-ends (where select_range doesn't work)
311
- def overlay_draw_cursor_(textpos)
312
- # Thread.new {
313
- # GLib::Idle.add(proc { p.call; false })
314
- # }
315
-
316
- # while Time.now - @last_adj_time < 0.3
317
- # return true
318
- # end
319
-
320
- remove_overlay_cursor
321
- @cursorov = Gtk::Fixed.new
322
- @overlay.add_overlay(@cursorov)
323
-
324
- (x, y) = @view.pos_to_coord(textpos)
325
- pp [x, y]
326
-
327
- # Trying to draw only background of character "I"
328
- label = Gtk::Label.new("<span background='#00ffaaff' foreground='#00ffaaff' weight='ultrabold'>I</span>")
329
- label.use_markup = true
330
- @cursorov.put(label, x, y)
331
- @cursorov.show
332
- return false
333
- end
334
-
335
297
  def handle_deltas()
336
298
  view.delete_cursor_char
337
299
  while d = buf.deltas.shift
@@ -386,6 +348,7 @@ class VMAgui
386
348
  sw.set_child(view)
387
349
  end
388
350
 
351
+ #TODO: implement in gtk4
389
352
  def init_header_bar()
390
353
  header = Gtk::HeaderBar.new
391
354
  @header = header
@@ -408,13 +371,13 @@ class VMAgui
408
371
  # icon = Gio::ThemedIcon.new("open-menu-symbolic")
409
372
  # image = Gtk::Image.new(:icon => icon, :size => :button)
410
373
  # button.add(image)
411
- # header.pack_end(button)
374
+ # header.append(button)
412
375
 
413
376
  button = Gtk::Button.new
414
377
  icon = Gio::ThemedIcon.new("document-open-symbolic")
415
378
  image = Gtk::Image.new(:icon => icon, :size => :button)
416
379
  button.add(image)
417
- header.pack_end(button)
380
+ header.append(button)
418
381
 
419
382
  button.signal_connect "clicked" do |_widget|
420
383
  open_file_dialog
@@ -424,7 +387,7 @@ class VMAgui
424
387
  icon = Gio::ThemedIcon.new("document-save-symbolic")
425
388
  image = Gtk::Image.new(:icon => icon, :size => :button)
426
389
  button.add(image)
427
- header.pack_end(button)
390
+ header.append(button)
428
391
  button.signal_connect "clicked" do |_widget|
429
392
  buf.save
430
393
  end
@@ -433,7 +396,7 @@ class VMAgui
433
396
  icon = Gio::ThemedIcon.new("document-new-symbolic")
434
397
  image = Gtk::Image.new(:icon => icon, :size => :button)
435
398
  button.add(image)
436
- header.pack_end(button)
399
+ header.append(button)
437
400
  button.signal_connect "clicked" do |_widget|
438
401
  create_new_file
439
402
  end
@@ -468,7 +431,6 @@ class VMAgui
468
431
 
469
432
  header.pack_start(box)
470
433
  @window.titlebar = header
471
- # @window.add(Gtk::TextView.new)
472
434
  end
473
435
 
474
436
  def debug_idle_func
@@ -479,7 +441,7 @@ class VMAgui
479
441
  # @view.check_controllers
480
442
  end
481
443
 
482
- ctrl_fn = File.expand_path("~/.vimamsa/ripl_ctrl")
444
+ ctrl_fn = File.expand_path(get_dot_path("ripl_ctrl"))
483
445
  # Allows to debug in case keyboard handling is lost
484
446
  if File.exist?(ctrl_fn)
485
447
  File.delete(ctrl_fn)
@@ -596,6 +558,8 @@ class VMAgui
596
558
 
597
559
  Gtk::Settings.default.gtk_application_prefer_dark_theme = true
598
560
  Gtk::Settings.default.gtk_theme_name = "Adwaita"
561
+ Gtk::Settings.default.gtk_cursor_blink = false
562
+ Gtk::Settings.default.gtk_cursor_blink_time = 4000
599
563
 
600
564
  app.signal_connect "activate" do
601
565
  @window = Gtk::ApplicationWindow.new(app)
@@ -613,29 +577,22 @@ class VMAgui
613
577
 
614
578
  reset_controllers
615
579
 
616
- @sw = Gtk::ScrolledWindow.new
617
- @sw.set_policy(:automatic, :automatic)
580
+ @windows[1] = new_window(1)
618
581
 
619
582
  @last_adj_time = Time.now
620
- @sw.vadjustment.signal_connect("value-changed") { |x|
621
- # pp x.page_increment
622
- # pp x.page_size
623
- # pp x.step_increment
624
- # pp x.upper
625
- # pp x.value
626
- # pp x
627
- @last_adj_time = Time.now
628
- }
629
583
 
630
- @overlay = Gtk::Overlay.new
631
- @overlay.add_overlay(@sw)
632
584
 
585
+ # To show keyboard key binding state
633
586
  @statnfo = Gtk::Label.new
587
+
588
+ # To show e.g. current folder
634
589
  @subtitle = Gtk::Label.new("")
590
+
635
591
  @statbox = Gtk::Box.new(:horizontal, 2)
636
592
  @statnfo.set_size_request(150, 10)
637
- @statbox.pack_end(@subtitle, :expand => true, :fill => true, :padding => 0)
638
- @statbox.pack_end(@statnfo, :expand => false, :fill => false, :padding => 0)
593
+ @statbox.append(@subtitle)
594
+ @subtitle.hexpand = true
595
+ @statbox.append(@statnfo)
639
596
  provider = Gtk::CssProvider.new
640
597
  @statnfo.add_css_class("statnfo")
641
598
  provider.load(data: "label.statnfo { background-color:#353535; font-size: 10pt; margin-top:2px; margin-bottom:2px; align:right;}")
@@ -644,50 +601,19 @@ class VMAgui
644
601
  @statnfo.style_context.add_provider(provider)
645
602
 
646
603
  # numbers: left, top, width, height
647
- @vbox.attach(@overlay, 0, 2, 2, 1)
648
- @sw.vexpand = true
649
- @sw.hexpand = true
604
+ @vbox.attach(@windows[1][:overlay], 0, 2, 2, 1)
650
605
 
651
606
  # column, row, width height
652
607
  @vbox.attach(@statbox, 1, 1, 1, 1)
653
608
 
654
- @overlay.vexpand = true
655
- @overlay.hexpand = true
656
-
657
609
  init_minibuffer
658
610
 
659
- name = "save"
660
- window = @window
661
- action = Gio::SimpleAction.new(name)
662
- action.signal_connect "activate" do |_simple_action, _parameter|
663
- dialog = Gtk::MessageDialog.new(:parent => window,
664
- :flags => :destroy_with_parent,
665
- :buttons => :close,
666
- :message => "Action FOOBAR activated.")
667
- dialog.signal_connect(:response) do
668
- dialog.destroy
669
- end
670
- dialog.show
671
- end
672
-
673
- @window.add_action(action)
674
- doc_actions = Gio::SimpleActionGroup.new
675
- doc_actions.add_action(action)
676
-
677
- act_quit = Gio::SimpleAction.new("quit")
678
- app.add_action(act_quit)
679
- act_quit.signal_connect "activate" do |_simple_action, _parameter|
680
- window.destroy
681
- exit!
682
- end
683
-
684
611
  menubar = Gio::Menu.new
685
612
  app.menubar = menubar
686
613
  @window.show_menubar = true
687
614
 
688
615
  @menubar = menubar
689
616
 
690
- @windows[1] = { :sw => @sw, :overlay => @overlay, :id => 1 }
691
617
  @active_window = @windows[1]
692
618
 
693
619
  @window.show
@@ -728,23 +654,20 @@ class VMAgui
728
654
  vma.start
729
655
  end
730
656
 
731
- # Vimamsa::Menu.new(@menubar) #TODO:gtk4
732
657
  GLib::Idle.add(proc { self.monitor })
733
658
 
734
659
  app.run
735
-
736
- # @window.show_all
737
- # @window.show
738
660
  end
739
661
 
740
662
  def monitor
663
+ swa = @windows[1][:sw]
741
664
  @monitor_time ||= Time.now
742
- @sw_width ||= @sw.width
665
+ @sw_width ||= swa.width
743
666
  return true if Time.now - @monitor_time < 0.2
744
667
  # Detect element resize
745
- if @sw.width != @sw_width
668
+ if swa.width != @sw_width
746
669
  # puts "@sw.width=#{@sw.width}"
747
- @sw_width = @sw.width
670
+ @sw_width = swa.width
748
671
  DelayExecutioner.exec(id: :scale_images, wait: 0.7, callable: proc { vma.gui.scale_all_images })
749
672
  end
750
673
  @monitor_time = Time.now
@@ -768,55 +691,83 @@ class VMAgui
768
691
  #This always closes the leftmost column/window
769
692
  #TODO: close rightmost column if left active
770
693
  set_active_window(1)
771
-
694
+
772
695
  @windows[2][:sw].set_child(nil)
773
696
  @windows.delete(2)
697
+ w1 = @windows[1]
774
698
 
775
699
  @pane.set_start_child(nil)
776
700
  @pane.set_end_child(nil)
777
701
 
778
702
  @vbox.remove(@pane)
779
- @vbox.attach(@overlay, 0, 2, 2, 1)
780
- @vbox.attach(@statbox, 1, 1, 1, 1)
703
+ @vbox.attach(w1[:overlay], 0, 2, 2, 1)
704
+ # @vbox.attach(@statbox, 1, 1, 1, 1)
781
705
  @two_column = false
782
706
  end
783
707
 
784
- def set_two_column
785
- return if @two_column
786
- # @window.set_default_size(800, 600) #TODO:gtk4
787
- # @vpaned = Gtk::Paned.new(:vertical)
788
- # @vbox = Gtk::Grid.new()
789
- # @window.add(@vbox)
790
-
791
- @sw2 = Gtk::ScrolledWindow.new
792
- @sw2.set_policy(:automatic, :automatic)
793
- @overlay2 = Gtk::Overlay.new
794
- @overlay2.add_overlay(@sw2)
795
- @pane = Gtk::Paned.new(:horizontal)
708
+ def new_window(win_id)
709
+ n_sw = Gtk::ScrolledWindow.new
710
+ n_sw.set_policy(:automatic, :automatic)
711
+ n_overlay = Gtk::Overlay.new
712
+ n_overlay.add_overlay(n_sw)
713
+ # @pane = Gtk::Paned.new(:horizontal)
796
714
 
797
- @windows[2] = { :sw => @sw2, :overlay => @overlay2, :id => 2 }
715
+ win = { :sw => n_sw, :overlay => n_overlay, :id => win_id }
716
+ # @windows[2] = { :sw => @sw2, :overlay => @overlay2, :id => 2 }
798
717
 
799
- @vbox.remove(@overlay)
718
+ # @vbox.remove(@overlay)
800
719
 
801
- @pane.set_start_child(@overlay2)
802
- @pane.set_end_child(@overlay)
720
+ # @pane.set_start_child(@overlay2)
721
+ # @pane.set_end_child(@overlay)
803
722
 
804
723
  # numbers: left, top, width, height
805
- @vbox.attach(@pane, 0, 2, 2, 1)
724
+ # @vbox.attach(@pane, 0, 2, 2, 1)
725
+
726
+ n_sw.vexpand = true
727
+ n_sw.hexpand = true
728
+
729
+ n_overlay.vexpand = true
730
+ n_overlay.hexpand = true
731
+
732
+ # TODO: remove??
733
+ n_sw.vadjustment.signal_connect("value-changed") { |x|
734
+ # pp x.page_increment
735
+ # pp x.page_size
736
+ # pp x.step_increment
737
+ # pp x.upper
738
+ # pp x.value
739
+ # pp x
740
+ # @last_adj_time = Time.now
741
+ }
742
+
743
+ # @sw2.show
744
+ return win
745
+ end
746
+
747
+ def set_two_column
748
+ return if @two_column
749
+ @windows[2] = new_window(2)
750
+
751
+ w1 = @windows[1]
752
+ w2 = @windows[2]
806
753
 
807
- @sw2.vexpand = true
808
- @sw2.hexpand = true
754
+ # Remove overlay from @vbox and add the Gtk::Paned instead
755
+ @pane = Gtk::Paned.new(:horizontal)
756
+ @vbox.remove(w1[:overlay])
757
+ @pane.set_start_child(w2[:overlay])
758
+ @pane.set_end_child(w1[:overlay])
809
759
 
810
- @overlay2.vexpand = true
811
- @overlay2.hexpand = true
760
+ # numbers: left, top, width, height
761
+ @vbox.attach(@pane, 0, 2, 2, 1)
812
762
 
813
- @sw2.show
763
+ w2[:sw].show
814
764
  @two_column = true
815
765
 
816
766
  last = vma.buffers.get_last_visited_id
817
767
  if !last.nil?
818
768
  set_buffer_to_window(last, 2)
819
769
  else
770
+ # If there is only one buffer, create a new one and add to the new window/column
820
771
  bf = create_new_buffer "\n\n", "buff", false
821
772
  set_buffer_to_window(bf.id, 2)
822
773
  end
@@ -836,11 +787,17 @@ class VMAgui
836
787
  end
837
788
  end
838
789
 
839
- # activate that window which has the given view
790
+ # Activate that window which has the given view
840
791
  def set_current_view(view)
792
+ # Window of current view:
841
793
  w = @windows.find { |k, v| v[:sw].child == view }
794
+ # All other windows:
795
+ otherw = @windows.find_all { |k, v| v[:sw].child != view }
842
796
  if !w.nil?
843
797
  set_active_window(w[0])
798
+ for k, x in otherw
799
+ x[:sw].child.focus_out()
800
+ end
844
801
  end
845
802
  end
846
803
 
@@ -855,19 +812,21 @@ class VMAgui
855
812
  end
856
813
 
857
814
  @active_window = @windows[id]
858
- @active_column = id #TODO: remove
815
+ @active_column = id
859
816
 
860
- @sw = @windows[id][:sw]
861
- @overlay = @windows[id][:overlay]
862
-
863
- vma.buffers.set_current_buffer_by_id(@sw.child.bufo.id)
864
-
865
- #TODO: set buf & view of active window??
817
+ @active_window[:sw].child.focus_in()
818
+ for k, w in @windows
819
+ if w != @active_window
820
+ fochild = w[:sw].child
821
+ run_as_idle proc { fochild.focus_out() }
822
+ end
823
+ end
866
824
 
825
+ vma.buffers.set_current_buffer_by_id(@active_window[:sw].child.bufo.id)
867
826
  end
868
827
 
869
828
  def current_view
870
- return @sw.child
829
+ return @active_window[:sw].child
871
830
  end
872
831
 
873
832
  def set_buffer_to_window(bufid, winid)
@@ -878,9 +837,6 @@ class VMAgui
878
837
  @windows[winid][:sw].set_child(view)
879
838
  idle_ensure_cursor_drawn
880
839
 
881
- # @overlay = Gtk::Overlay.new
882
- # @overlay.add_overlay(view)
883
-
884
840
  #TODO:???
885
841
  # @view = view
886
842
  # @buf1 = buf1
@@ -890,10 +846,10 @@ class VMAgui
890
846
  end
891
847
 
892
848
  def set_current_buffer(id)
893
- view = @buffers[id]
849
+ view2 = @buffers[id]
894
850
  debug "vma.gui.set_current_buffer(#{id}), view=#{view}"
895
- buf1 = view.buffer
896
- @view = view
851
+ buf1 = view2.buffer
852
+ @view = view2
897
853
  @buf1 = buf1
898
854
  $view = view
899
855
  $vbuf = buf1
@@ -906,14 +862,17 @@ class VMAgui
906
862
  toggle_active_window
907
863
  else
908
864
  #TODO: improve
909
- @overlay.remove_overlay(@sw)
910
- @sw.set_child(nil)
865
+ swa = @active_window[:sw]
866
+ ol = @active_window[:overlay]
867
+ ol.remove_overlay(swa)
868
+ swa.set_child(nil)
911
869
  # Creating a new ScrolledWindow every time to avoid a layout bug
912
870
  # https://gitlab.gnome.org/GNOME/gtk/-/issues/6189
913
- @sw = new_scrolled_window
914
- @sw.set_child(view)
915
- @overlay.add_overlay(@sw)
916
- @active_window[:sw] = @sw
871
+ swb = new_scrolled_window
872
+ swb.set_child(view2)
873
+ ol.add_overlay(swb)
874
+ @active_window[:view] = view
875
+ @active_window[:sw] = swb
917
876
  end
918
877
  view.grab_focus
919
878
 
@@ -932,18 +891,20 @@ class VMAgui
932
891
  end
933
892
 
934
893
  def page_down(multip: 1.0)
935
- va = @sw.vadjustment
894
+ sw = @active_window[:sw]
895
+ va = sw.vadjustment
936
896
  newval = va.value + va.page_increment * multip
937
897
  va.value = newval
938
- @sw.child.set_cursor_to_top
898
+ sw.child.set_cursor_to_top
939
899
  end
940
900
 
941
901
  def page_up(multip: 1.0)
942
- va = @sw.vadjustment
902
+ sw = @active_window[:sw]
903
+ va = sw.vadjustment
943
904
  newval = va.value - va.page_increment * multip
944
905
  newval = 0 if newval < 0
945
906
  va.value = newval
946
- @sw.child.set_cursor_to_top
907
+ sw.child.set_cursor_to_top
947
908
  end
948
909
 
949
910
  def idle_ensure_cursor_drawn
@@ -40,8 +40,9 @@ class OneInputAction
40
40
  def initialize(main_window, title, field_label, button_title, callback, opt = {})
41
41
  @window = Gtk::Window.new()
42
42
  # @window.screen = main_window.screen
43
- # @window.title = title
44
43
  @window.title = ""
44
+ # @window.width_request = 800
45
+ # @window.hexpand = false
45
46
 
46
47
  frame = Gtk::Frame.new()
47
48
  # frame.margin = 20
@@ -49,15 +50,17 @@ class OneInputAction
49
50
 
50
51
  infolabel = Gtk::Label.new
51
52
  infolabel.markup = title
53
+ infolabel.wrap = true
54
+ infolabel.max_width_chars = 80
55
+
52
56
 
53
57
  vbox = Gtk::Box.new(:vertical, 8)
54
58
  vbox.margin = 10
55
59
  frame.set_child(vbox)
56
60
 
57
61
  hbox = Gtk::Box.new(:horizontal, 8)
58
- # @window.add(hbox)
59
- vbox.pack_end(infolabel, :expand => false, :fill => false, :padding => 0)
60
- vbox.pack_end(hbox, :expand => false, :fill => false, :padding => 0)
62
+ vbox.append(infolabel)
63
+ vbox.append(hbox)
61
64
 
62
65
  button = Gtk::Button.new(:label => button_title)
63
66
  cancel_button = Gtk::Button.new(:label => "Cancel")
@@ -95,10 +98,10 @@ class OneInputAction
95
98
  end
96
99
  end
97
100
 
98
- hbox.pack_end(label, :expand => false, :fill => false, :padding => 0)
99
- hbox.pack_end(@entry1, :expand => false, :fill => false, :padding => 0)
100
- hbox.pack_end(button, :expand => false, :fill => false, :padding => 0)
101
- hbox.pack_end(cancel_button, :expand => false, :fill => false, :padding => 0)
101
+ hbox.append(label)
102
+ hbox.append(@entry1)
103
+ hbox.append(button)
104
+ hbox.append(cancel_button)
102
105
  return
103
106
  end
104
107
 
@@ -49,9 +49,7 @@ class PopupFormGenerator
49
49
  if params.has_key?("title")
50
50
  infolabel = Gtk::Label.new
51
51
  infolabel.markup = params["title"]
52
- #TODO:gtk4
53
- # vbox.pack_start(infolabel, :expand => false, :fill => false, :padding => 0)
54
- vbox.pack_end(infolabel, :expand => false, :fill => false, :padding => 0)
52
+ vbox.append(infolabel)
55
53
  end
56
54
 
57
55
  hbox = Gtk::Box.new(:horizontal, 8)
@@ -61,7 +59,7 @@ class PopupFormGenerator
61
59
  for id, elem in params["inputs"]
62
60
  if elem[:type] == :button
63
61
  button = Gtk::Button.new(:label => elem[:label])
64
- hbox.pack_end(button, :expand => false, :fill => false, :padding => 0)
62
+ hbox.append(button)
65
63
  if elem[:default_focus] == true
66
64
  @default_button = button
67
65
  end
@@ -75,8 +73,8 @@ class PopupFormGenerator
75
73
  if elem.has_key?(:initial_text)
76
74
  entry.text = elem[:initial_text]
77
75
  end
78
- hbox.pack_end(label, :expand => false, :fill => false, :padding => 0)
79
- hbox.pack_end(entry, :expand => false, :fill => false, :padding => 0)
76
+ hbox.append(label)
77
+ hbox.append(entry)
80
78
  @vals[id] = entry
81
79
 
82
80
  press = Gtk::EventControllerKey.new
@@ -96,13 +94,13 @@ class PopupFormGenerator
96
94
  end
97
95
  end
98
96
 
99
- vbox.pack_end(hbox, :expand => false, :fill => false, :padding => 0)
97
+ vbox.append(hbox)
100
98
 
101
99
  cancel_button = Gtk::Button.new(:label => "Cancel")
102
100
  cancel_button.signal_connect "clicked" do
103
101
  @window.destroy
104
102
  end
105
- hbox.pack_end(cancel_button, :expand => false, :fill => false, :padding => 0)
103
+ hbox.append(cancel_button)
106
104
  @cancel_button = cancel_button
107
105
  return
108
106
  end
@@ -1,6 +1,11 @@
1
1
  module Vimamsa
2
2
  class Menu
3
3
  def add_to_menu(_mpath, x)
4
+ # If no menu label provided, take from the action definition
5
+ if !x[:action].nil? and x[:label].nil?
6
+ x[:label] = vma.actions[x[:action]].method_name
7
+ end
8
+
4
9
  mpath = _mpath.split(".")
5
10
  curnfo = @nfo
6
11
  for y in mpath
@@ -31,9 +36,10 @@ module Vimamsa
31
36
  add_to_menu "Edit.Redo", { :label => "Redo edit", :action => :edit_redo }
32
37
  add_to_menu "Edit.SearchReplace", { :label => "Search and replace", :action => :gui_search_replace }
33
38
  add_to_menu "Edit.Find", { :label => "Find", :action => :find_in_buffer }
34
-
35
- add_to_menu "Edit.StartCompletion", { :label => "StartCompletion", :action => :start_autocomplete }
36
- add_to_menu "Edit.ShowCompletion", { :label => "ShowCompletion", :action => :show_autocomplete }
39
+
40
+ # add_to_menu "Edit.StartCompletion", { :label => "StartCompletion", :action => :start_autocomplete }
41
+ # add_to_menu "Edit.ShowCompletion", { :label => "ShowCompletion", :action => :show_autocomplete }
42
+ add_to_menu "Edit.CustomRb", { :action => :edit_customrb }
37
43
 
38
44
  add_to_menu "Actions.SearchForActions", { :label => "Search for Actions", :action => :search_actions }
39
45
 
@@ -46,13 +52,11 @@ module Vimamsa
46
52
  add_to_menu "Actions.experimental.EnableDebug", { :label => "Enable debug", :action => :enable_debug }
47
53
  add_to_menu "Actions.experimental.DisableDebug", { :label => "Disable debug", :action => :disable_debug }
48
54
  add_to_menu "Actions.experimental.ShowImages", { :label => "Show images ⟦img:path⟧", :action => :show_images }
49
-
55
+
50
56
  add_to_menu "Actions.debug.dumpkbd", { :label => "Dump kbd state", :action => :kbd_dump_state }
51
-
52
-
57
+
53
58
  add_to_menu "View.BufferManager", { :label => "Show open files", :action => :start_buf_manager }
54
59
  add_to_menu "View.TwoColumn", { :label => "Toggle two column mode", :action => :toggle_two_column }
55
-
56
60
 
57
61
  add_to_menu "Actions.EncryptFile", { :label => "Encrypt file", :action => :encrypt_file }
58
62
  add_to_menu "Help.KeyBindings", { :label => "Show key bindings", :action => :show_key_bindings }
@@ -89,7 +93,7 @@ module Vimamsa
89
93
  label_str = nfo[:label] + kbd_str
90
94
  actkey = nfo[:action].to_s
91
95
  menuitem = Gio::MenuItem.new(label_str, "app.#{actkey}")
92
-
96
+
93
97
  # This worked in GTK3:
94
98
  # But seems there is no way to access the Label object in GTK4
95
99
  # menuitem.children[0].set_markup(label_str)
@@ -110,7 +114,6 @@ module Vimamsa
110
114
  # menuitem.set_attribute_value("use-markup", true)
111
115
  # This might change in the future(?), but the string version still works in gtk-4.13.0 (gtk/gtkmenutrackeritem.c)
112
116
 
113
-
114
117
  if !nfo[:items].nil? and !nfo[:items].empty?
115
118
  for k2, item in nfo[:items]
116
119
  build_menu(item, menu)
@@ -118,7 +121,6 @@ module Vimamsa
118
121
  menuitem.submenu = menu
119
122
  end
120
123
  o = parent.append_item(menuitem)
121
-
122
124
  end
123
125
  end #end class
124
126
  end
@@ -154,7 +154,9 @@ class SelectUpdateWindow
154
154
  sw = Gtk::ScrolledWindow.new(nil, nil)
155
155
  # sw.shadow_type = :etched_in #TODO:gtk4
156
156
  sw.set_policy(:never, :automatic)
157
- vbox.pack_end(sw, :expand => true, :fill => true, :padding => 0)
157
+ vbox.append(sw)
158
+ sw.vexpand = true
159
+ sw.hexpand = true
158
160
 
159
161
  # sw.add(treeview) #TODO:gtk4
160
162
  sw.set_child(treeview)