vimamsa 0.1.19 → 0.1.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -119,6 +119,21 @@ class VSourceView < GtkSource::View
119
119
  end
120
120
  end
121
121
 
122
+ def focus_out()
123
+ set_cursor_color(:inactive)
124
+
125
+ # This does not seem to work: (TODO:why?)
126
+ # self.cursor_visible = false
127
+ end
128
+
129
+ def focus_in()
130
+ set_cursor_color(@ctype)
131
+ self.cursor_visible = false
132
+ self.cursor_visible = true
133
+ self.grab_focus
134
+ end
135
+
136
+
122
137
  def register_signals()
123
138
  check_controllers
124
139
 
@@ -581,34 +596,29 @@ class VSourceView < GtkSource::View
581
596
  end
582
597
 
583
598
  def draw_cursor
584
- # if @tt.nil?
585
- # @tt = buffer.create_tag("font_tag")
586
- # @tt.font = "Arial"
587
- # end
588
599
 
589
- sv = vma.gui.sw.child
590
- return if sv.nil? #TODO: should not happen?
600
+ sv = vma.gui.active_window[:sw].child
601
+ return if sv.nil?
602
+ if sv != self # if we are not the current buffer
603
+ sv.draw_cursor
604
+ return
605
+ end
606
+
591
607
  mode = vma.kbd.get_mode
592
608
  ctype = vma.kbd.get_cursor_type
593
609
  ctype = :visual if vma.buf.selection_active?
594
610
 
595
- vma.gui.remove_overlay_cursor
596
611
  if [:command, :replace, :browse].include?(ctype)
597
612
  set_cursor_color(ctype)
598
613
 
599
- sv.overwrite = true
600
- # sv.cursor_visible = true
601
- # sv.reset_cursor_blink
602
-
603
- # (Via trial and error) This combination is needed to make cursor visible:
604
- sv.cursor_visible = false
605
- sv.cursor_visible = true
606
-
607
- # sv.reset_cursor_blink
608
- Gtk::Settings.default.gtk_cursor_blink = false
609
- # Gtk::Settings.default.gtk_cursor_blink_time = 8000
610
- # vma.gui.sw.child.toggle_cursor_visible
611
- # vma.gui.sw.child.cursor_visible = true
614
+ if !self.overwrite?
615
+ self.overwrite = true
616
+
617
+ # (Via trial and error) This combination is needed to make cursor visible:
618
+ # TODO: determine why "self.cursor_visible = true" is not enough
619
+ self.cursor_visible = false
620
+ self.cursor_visible = true
621
+ end
612
622
  elsif ctype == :visual
613
623
  set_cursor_color(ctype)
614
624
  # debug "VISUAL MODE"
@@ -620,12 +630,11 @@ class VSourceView < GtkSource::View
620
630
  buffer.select_range(itr, itr2)
621
631
  elsif ctype == :insert
622
632
  set_cursor_color(ctype)
623
- sv.overwrite = false
624
- # sv.cursor_visible = false
625
- # sv.cursor_visible = true
633
+ self.overwrite = false
626
634
  debug "INSERT MODE"
627
635
  else # TODO
628
636
  end
637
+
629
638
  if [:insert, :command, :replace, :browse].include?(ctype)
630
639
  # Place cursor where it already is
631
640
  # Without this hack, the cursor doesn't always get drawn
@@ -633,5 +642,13 @@ class VSourceView < GtkSource::View
633
642
  itr = buffer.get_iter_at(:offset => pos)
634
643
  buffer.place_cursor(itr)
635
644
  end
636
- end
645
+
646
+ # Sometimes we lose focus and the cursor vanishes because of that
647
+ # TODO: determine why&when
648
+ if !self.has_focus?
649
+ self.grab_focus
650
+ self.cursor_visible = false
651
+ self.cursor_visible = true
652
+ end
653
+ end #end draw_cursor
637
654
  end
@@ -46,8 +46,9 @@ reg_act(:create_new_file, "create_new_file", "Create new file", { :group => :fil
46
46
  reg_act(:backup_all_buffers, proc { backup_all_buffers }, "Backup all buffers", { :group => :file })
47
47
  reg_act(:e_move_forward_char, "e_move_forward_char", "", { :group => [:move, :basic] })
48
48
  reg_act(:e_move_backward_char, "e_move_backward_char", "", { :group => [:move, :basic] })
49
- reg_act(:history_switch_backwards, "history_switch_backwards", "", { :group => :file })
50
- reg_act(:history_switch_forwards, "history_switch_forwards", "", { :group => :file })
49
+ # reg_act(:history_switch_backwards, proc{bufs.history_switch_backwards}, "", { :group => :file })
50
+ reg_act(:history_switch_backwards, proc{bufs.history_switch(-1)}, "", { :group => :file })
51
+ reg_act(:history_switch_forwards, proc{bufs.history_switch(+1)}, "", { :group => :file })
51
52
  reg_act(:center_on_current_line, "center_on_current_line", "", { :group => :view })
52
53
  reg_act(:run_last_macro, proc { vma.macro.run_last_macro }, "Run last recorded or executed macro", { :group => :macro })
53
54
  reg_act(:jump_to_next_edit, "jump_to_next_edit", "")
@@ -169,11 +170,14 @@ act_list = {
169
170
  :search_actions => { :proc => proc { vma.actions.gui_search },
170
171
  :desc => "Search actions", :group => :search },
171
172
 
173
+ :edit_customrb => { :proc => proc { jump_to_file("~/.config/vimamsa/custom.rb") },
174
+ :desc => "Customize (edit custom.rb)", :group => :search },
175
+
172
176
  :toggle_active_window => { :proc => proc { vma.gui.toggle_active_window },
173
- :desc => "Toggle active window", :group => :search },
177
+ :desc => "Switch active column in two column mode", :group => :search },
174
178
 
175
179
  :toggle_two_column => { :proc => proc { vma.gui.toggle_two_column },
176
- :desc => "Set two column mode", :group => :search },
180
+ :desc => "Toggle two column mode", :group => :search },
177
181
 
178
182
  :content_search => { :proc => proc { FileContentSearch.start_gui },
179
183
  :desc => "Search content of files", :group => :search },
@@ -188,15 +192,14 @@ act_list = {
188
192
  :desc => "Output SHA256 hex digest of curent buffer" },
189
193
 
190
194
  :start_autocomplete => { :proc => proc { vma.buf.view.start_autocomplete },
191
- :desc => "Start autocomplete" },
192
-
193
- :show_autocomplete => { :proc => proc {
194
- # vma.buf.view.signal_emit("show-completion")
195
- # vma.buf.view.show_completion
196
- vma.buf.view.show_completions
197
- },
198
- :desc => "Show autocomplete" },
199
-
195
+ :desc => "Start autocomplete" },
196
+
197
+ :show_autocomplete => { :proc => proc {
198
+ # vma.buf.view.signal_emit("show-completion")
199
+ # vma.buf.view.show_completion
200
+ vma.buf.view.show_completions
201
+ },
202
+ :desc => "Show autocomplete" },
200
203
 
201
204
  }
202
205
 
@@ -18,8 +18,6 @@
18
18
  # 'I ctrl-a'=> 'vma.buf.jump(BEGINNING_OF_LINE)',
19
19
  #
20
20
 
21
- setcnf :indent_based_on_last_line, true
22
- setcnf :extensions_to_open, [".txt", ".h", ".c", ".cpp", ".hpp", ".rb", ".inc", ".php", ".sh", ".m", ".gd", ".js"]
23
21
 
24
22
  class State
25
23
  attr_accessor :key_name, :eval_rule, :children, :action, :label, :major_modes, :level, :cursor_type
@@ -18,6 +18,7 @@ cnf.mode.visual.cursor.background = "#bc6040"
18
18
  cnf.mode.replace.cursor.background = "#fc0331"
19
19
  cnf.mode.browse.cursor.background = "#f803fc"
20
20
  cnf.mode.insert.cursor.background = "#ffffff"
21
+ cnf.mode.inactive.cursor.background = "#777777"
21
22
 
22
23
  def _insert_move(op)
23
24
  if op == :pagedown
@@ -100,9 +101,7 @@ bindkey "VC h", :e_move_backward_char
100
101
  bindkey "C , , .", :backup_all_buffers
101
102
  bindkey "C z ", :start_browse_mode
102
103
  bindkey "B h", :history_switch_backwards
103
- # bindkey "B h", [:browse_file_backwards, proc { vma.kbd.to_previous_mode; call_action(:history_switch_backwards); }, "Browse previous file"]
104
104
  bindkey "B l", :history_switch_forwards
105
- #bindkey 'B z', :center_on_current_line
106
105
  bindkey "B z", "center_on_current_line();call_action(:exit_browse_mode)"
107
106
  bindkey "B enter || B return || B esc || B j || B ctrl!", :exit_browse_mode
108
107
  bindkey "B s", :page_up
@@ -52,7 +52,7 @@ class LangSrv
52
52
  @id = 0
53
53
 
54
54
  wf = []
55
- for c in conf(:workspace_folders)
55
+ for c in cnf.workspace_folders!
56
56
  wf << LSP::Interface::WorkspaceFolder.new(uri: c[:uri], name: c[:name])
57
57
  end
58
58
  debug "WORKSPACE FOLDERS", 2
@@ -157,7 +157,6 @@ class LangSrv
157
157
  @writer.write(id: id, params: a, method: "textDocument/definition")
158
158
  r = wait_for_response(id)
159
159
  return nil if r.nil?
160
- # Ripl.start :binding => binding
161
160
  pp r
162
161
  line = HSafe.new(r)[:result][0][:range][:start][:line].val
163
162
  uri = HSafe.new(r)[:result][0][:uri].val
@@ -30,5 +30,8 @@ Converter.new(lambda { |x|
30
30
  x + "\n" + nums.join("+") + "=#{sum}"
31
31
  }, :lambda, :sum_of_numbers)
32
32
 
33
- c = Converter.new(lambda { |x| x.scan(/[\w\.]+@[\w\.]+/).join("\n") }, :lambda, :get_emails)
33
+ Converter.new(lambda { |x| x.scan(/[\w\.]+@[\w\.]+/).join("\n") }, :lambda, :get_emails)
34
+
35
+ # Eval selection as ruby code
36
+ Converter.new(lambda { |x| b = "eval failed"; begin; b = eval(x, TOPLEVEL_BINDING); rescue; end; "#{x}\n#{b}\n" }, :lambda, :eval)
34
37
 
@@ -1,3 +1,3 @@
1
1
  module Vimamsa
2
- VERSION = "0.1.19"
2
+ VERSION = "0.1.20"
3
3
  end
data/lib/vimamsa.rb CHANGED
@@ -2,6 +2,9 @@ require "vimamsa/version"
2
2
 
3
3
  require "vmaext"
4
4
 
5
+ $:.unshift File.expand_path(File.dirname(__FILE__)+"/../ext/stridx")
6
+ require "stridx"
7
+
5
8
  require "vimamsa/rbvma"
6
9
 
7
10
  module Vimamsa
data/vimamsa.gemspec CHANGED
@@ -16,6 +16,8 @@ Gem::Specification.new do |spec|
16
16
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
17
  f.match(%r{^(refcode|spec|features)/})
18
18
  end
19
+ # spec.files = Dir["{ext}/**/*"]
20
+
19
21
  spec.bindir = "exe"
20
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
23
  spec.require_paths = ["lib","ext"]
@@ -36,10 +38,9 @@ Gem::Specification.new do |spec|
36
38
  spec.add_runtime_dependency 'differ', '~> 0.1.2'
37
39
  spec.add_runtime_dependency 'parallel', '~> 1.14' #TODO: update?
38
40
  spec.add_runtime_dependency 'listen', '~> 3.4' #TODO: update?
41
+ spec.add_runtime_dependency 'StrIdx', '~> 0.1.1'
39
42
  spec.add_runtime_dependency 'language_server-protocol', '~> 3.17.0.3'
40
43
 
41
44
  spec.extensions = ["ext/vmaext/extconf.rb"]
42
45
  spec.licenses = ['GPL-3.0+']
43
- # FileList["ext/**/extconf.rb"]
44
-
45
46
  end
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.19
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sami Sieranoja
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-20 00:00:00.000000000 Z
11
+ date: 2024-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -192,6 +192,20 @@ dependencies:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
194
  version: '3.4'
195
+ - !ruby/object:Gem::Dependency
196
+ name: StrIdx
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: 0.1.1
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: 0.1.1
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: language_server-protocol
197
211
  requirement: !ruby/object:Gem::Requirement
@@ -217,7 +231,6 @@ extensions:
217
231
  extra_rdoc_files: []
218
232
  files:
219
233
  - ".gitignore"
220
- - ".vma_project"
221
234
  - Gemfile
222
235
  - README.md
223
236
  - Rakefile
data/.vma_project DELETED
File without changes