glimmer-cs-gladiator 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af29d980faf6b1905a69f7a06bed1646fda6ebd1fd30f5016d5ca142afbefe98
4
- data.tar.gz: a02ca4bb732b16bc26fb7c7f5d3c7644a7bb2a40ddd77458c96a4d1ecf0d0a87
3
+ metadata.gz: 10060190546fe60cbf5c1e130191ed12ff17ea7deee820fd9294ad59b04b8dfa
4
+ data.tar.gz: f6ad081752171216f5980a1a5d9508d1c433ed9cd35cdcb5c2f5c022254376c8
5
5
  SHA512:
6
- metadata.gz: 962c8732ca907482bc9031f48974154a945d3276c3a7d7d2e10ee65899343070938bb3d140c7e03f8b2f13126a580ed4129c75503700336f58dffa0b3e17139a
7
- data.tar.gz: 5e8e21ebf4e37d4ae244a92372f3d9d17dd8cbd4ee5ebbeedf3e8581493f5101d052e753764ed94c8a9119c6f0f72d9a453c7e168b22de919c31cc27ee3c4824
6
+ metadata.gz: '092bcecbbcc5fa79cbc4e085546f3b37760e429369498fb24508cffacef919c0e89d1d84c3faa75fe9a38a35bfbae0fb280a273aa6d0b479134b1724145e7f6d'
7
+ data.tar.gz: 50893f0dc416e754ca5e589cc82164cb6214c3b56090759bb085e4a8c61cf96c4423002a986740b923c0ffc6861eb8706fa3d44fefe7d1ca298cd179c835e242
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # Gladiator (Glimmer Editor) 0.1.0 - Glimmer Custom Shell
1
+ # Gladiator (Glimmer Editor) 0.1.1 - Glimmer Custom Shell
2
+ [![Gem Version](https://badge.fury.io/rb/glimmer-cs-gladiator.svg)](http://badge.fury.io/rb/glimmer-cs-gladiator)
2
3
 
3
4
  ![Gladiator](images/glimmer-gladiator.png)
4
5
 
@@ -48,7 +49,7 @@ To reuse Gladiator as a Glimmer Custom Shell inside another Glimmer application,
48
49
  following to the application's `Gemfile`:
49
50
 
50
51
  ```
51
- gem 'glimmer-cs-gladiator', '0.1.0'
52
+ gem 'glimmer-cs-gladiator', '0.1.1'
52
53
  ```
53
54
 
54
55
  Run:
@@ -4,6 +4,8 @@ module Glimmer
4
4
  class Gladiator
5
5
  class Dir
6
6
  include Glimmer
7
+
8
+ REFRESH_DELAY = 7
7
9
 
8
10
  class << self
9
11
  def local_dir
@@ -12,7 +14,7 @@ module Glimmer
12
14
  @filewatcher = Filewatcher.new(dir.path)
13
15
  @thread = Thread.new(@filewatcher) do |fw|
14
16
  fw.watch do |filename, event|
15
- if @last_update.nil? || (Time.now.to_f - @last_update) > 10
17
+ if @last_update.nil? || (Time.now.to_f - @last_update) > REFRESH_DELAY
16
18
  dir.refresh if filename != dir.selected_child_path
17
19
  end
18
20
  @last_update = Time.now.to_f
@@ -61,10 +61,16 @@ module Glimmer
61
61
  new_dirty_content = "#{dirty_content.gsub("\r\n", "\n").gsub("\r", "\n").sub(/\n+\z/, '')}\n"
62
62
  self.dirty_content = new_dirty_content if new_dirty_content != self.dirty_content
63
63
  ::File.write(path, dirty_content) if ::File.exists?(path) && dirty_content.to_s.strip.size > 0
64
+ rescue => e
65
+ puts "Error in writing dirty content for #{path}"
66
+ puts e.full_message
64
67
  end
65
68
 
66
69
  def write_raw_dirty_content
67
70
  ::File.write(path, dirty_content) if ::File.exists?(path) && dirty_content.to_s.strip.size > 0
71
+ rescue => e
72
+ puts "Error in writing raw dirty content for #{path}"
73
+ puts e.full_message
68
74
  end
69
75
 
70
76
  def comment_line!
@@ -20,7 +20,8 @@ module Glimmer
20
20
  #
21
21
  before_body {
22
22
  Display.setAppName('Gladiator')
23
- @config_file_path = '.gladiator'
23
+ local_dir = ENV['LOCAL_DIR'] || '.'
24
+ @config_file_path = ::File.join(local_dir, '.gladiator')
24
25
  @config = {}
25
26
  Gladiator::Dir.local_dir.all_children # pre-caches children
26
27
  load_config
@@ -97,6 +98,7 @@ module Glimmer
97
98
  key_event.keyCode == swt(:lf) ||
98
99
  key_event.keyCode == swt(:arrow_up) ||
99
100
  key_event.keyCode == swt(:arrow_down)
101
+ @list.swt_widget.select(0) if @list.swt_widget.getSelectionIndex() == -1
100
102
  @list.swt_widget.setFocus
101
103
  elsif key_event.keyCode == swt(:esc)
102
104
  @text.swt_widget.setFocus
@@ -114,7 +116,7 @@ module Glimmer
114
116
  on_widget_selected {
115
117
  Gladiator::Dir.local_dir.selected_child_path = @list.swt_widget.getSelection.first
116
118
  }
117
- on_key_pressed { |key_event|
119
+ on_key_pressed { |key_event|
118
120
  if Glimmer::SWT::SWTProxy.include?(key_event.keyCode, :cr) || Glimmer::SWT::SWTProxy.include?(key_event.keyCode, :lf)
119
121
  Gladiator::Dir.local_dir.selected_child_path = @list.swt_widget.getSelection.first
120
122
  @text.swt_widget.setFocus
@@ -282,7 +284,12 @@ module Glimmer
282
284
  key_code = verify_event.keyCode
283
285
  case key_code
284
286
  when swt(:tab)
285
- verify_event.text = ' '
287
+ if Gladiator::Dir.local_dir.selected_child.selection_count.to_i > 0
288
+ Gladiator::Dir.local_dir.selected_child.indent!
289
+ verify_event.doit = false
290
+ else
291
+ verify_event.text = ' '
292
+ end
286
293
  end
287
294
  }
288
295
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-cs-gladiator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-03 00:00:00.000000000 Z
11
+ date: 2020-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement