glimmer-cs-gladiator 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -14
- data/lib/models/glimmer/gladiator/dir.rb +9 -1
- data/lib/models/glimmer/gladiator/file.rb +33 -8
- data/lib/views/glimmer/gladiator.rb +37 -23
- data/lib/views/glimmer/gladiator/text_editor.rb +28 -12
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d758e5b444ef3d48c0214ffb763e3dab3f9ca9748961e879b9ebdb626e9c2ea
|
4
|
+
data.tar.gz: cb575fbe30017319190278483334256aeb04d277798a5e3351f944c3d3a61481
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4223591b0608f621432a7ee1a1f710ad4a1684aaafb6d1d9152f064b8d707216ba3dc5fece5836764db058a9a88d209d161ee8abc5062d4fb9a4a821cb986c61
|
7
|
+
data.tar.gz: 3296674924ae085c139919e9e22a32d1c5a322b163b7fc6954e89bc02af4cb2a7c80e9a49359d9d136f4113206c48ebfcedbbe917e3f97e35529575abed1832a
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Gladiator (Glimmer Editor) 0.1.
|
1
|
+
# Gladiator (Glimmer Editor) 0.1.6 - Glimmer Custom Shell
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/glimmer-cs-gladiator.svg)](http://badge.fury.io/rb/glimmer-cs-gladiator)
|
3
3
|
|
4
4
|
![Gladiator](images/glimmer-gladiator.png)
|
@@ -9,22 +9,29 @@ Gladiator is also a personal tool for shaping an editor exactly the way I like.
|
|
9
9
|
I leave building truly professional text editors to software tooling experts who would hopefully use Glimmer one day.
|
10
10
|
|
11
11
|
Gladiator currently supports the following text editing features:
|
12
|
-
- File explorer navigation to open file, rename, delete, add new file, add new directory, or refresh tree
|
13
|
-
- File lookup by name ignoring slashes, underscores, and dots to ease lookup
|
12
|
+
- File explorer navigation to open file, rename, delete, add new file, add new directory, or refresh tree (CMD+T)
|
13
|
+
- File lookup by name ignoring slashes, underscores, and dots to ease lookup (CMD+R)
|
14
14
|
- Watch open file for external changes to automatically refresh in editor
|
15
15
|
- Watch project subdirectories for changes to automatically refresh in file explorer/file lookup
|
16
|
-
- Find & Replace
|
16
|
+
- Find & Replace (CMD+F)
|
17
17
|
- Show Line Numbers
|
18
|
-
- Jump to Line
|
19
|
-
- Multiple tab support
|
18
|
+
- Jump to Line (CMD+L)
|
19
|
+
- Multiple tab support (CMD+SHIFT+[ & CMD+SHIFT+] for tab navigation. CMD+1-9 to jump to a specific tab)
|
20
20
|
- Remember opened tabs, caret position, top line, window size, and window location
|
21
|
-
- Autosave on focus out/quit/open new file
|
22
|
-
- Duplicate Line(s)/selection
|
23
|
-
- Kill Line(s)/selection
|
24
|
-
- Move line/selection up
|
25
|
-
- Move line/selection down
|
26
|
-
- Comment/Uncomment line/selection
|
27
|
-
- Indent/Unindent line/selection
|
21
|
+
- Autosave on focus out/quit/open new file
|
22
|
+
- Duplicate Line(s)/selection (CMD+D)
|
23
|
+
- Kill Line(s)/selection (CMD+K)
|
24
|
+
- Move line/selection up (CMD+UP)
|
25
|
+
- Move line/selection down (CMD+DOWN)
|
26
|
+
- Comment/Uncomment line/selection (CMD+/)
|
27
|
+
- Indent/Unindent line/selection (CMD+] & CMD+[)
|
28
|
+
- Insert/Prefix New Line (CMD+ENTER & CMD+SHIFT+ENTER)
|
29
|
+
|
30
|
+
## Platforms
|
31
|
+
|
32
|
+
- Mac: Gladiator works best on the Mac.
|
33
|
+
- Linux: Gladiator works with handicaps on Linux (performing text editing operations causes scroll jitter)
|
34
|
+
- Windows: Not tested on Windows yet, but should theoretically work there too.
|
28
35
|
|
29
36
|
## Pre-requisites
|
30
37
|
|
@@ -53,7 +60,7 @@ To reuse Gladiator as a Glimmer Custom Shell inside another Glimmer application,
|
|
53
60
|
following to the application's `Gemfile`:
|
54
61
|
|
55
62
|
```
|
56
|
-
gem 'glimmer-cs-gladiator', '0.1.
|
63
|
+
gem 'glimmer-cs-gladiator', '0.1.6'
|
57
64
|
```
|
58
65
|
|
59
66
|
Run:
|
@@ -117,7 +117,7 @@ module Glimmer
|
|
117
117
|
begin
|
118
118
|
unless new_child.dirty_content.nil?
|
119
119
|
self.selected_child&.stop_filewatcher
|
120
|
-
selected_child_path_history <<
|
120
|
+
selected_child_path_history << new_child.path if new_child && !selected_child_path_history.include?(new_child.path)
|
121
121
|
self.selected_child = new_child
|
122
122
|
self.selected_child.start_filewatcher
|
123
123
|
end
|
@@ -140,6 +140,14 @@ module Glimmer
|
|
140
140
|
def to_s
|
141
141
|
path
|
142
142
|
end
|
143
|
+
|
144
|
+
def eql?(other)
|
145
|
+
self.path.eql?(other&.path)
|
146
|
+
end
|
147
|
+
|
148
|
+
def hash
|
149
|
+
self.path.hash
|
150
|
+
end
|
143
151
|
end
|
144
152
|
end
|
145
153
|
end
|
@@ -5,16 +5,17 @@ module Glimmer
|
|
5
5
|
class File
|
6
6
|
include Glimmer
|
7
7
|
|
8
|
-
attr_accessor :line_numbers_content, :
|
9
|
-
attr_reader :name, :dirty_content
|
8
|
+
attr_accessor :line_numbers_content, :selection, :selection_count, :line_number, :find_text, :replace_text, :top_index, :path, :display_path
|
9
|
+
attr_reader :name, :dirty_content
|
10
10
|
|
11
11
|
def initialize(path)
|
12
12
|
raise "Not a file path: #{path}" unless ::File.file?(path)
|
13
13
|
@display_path = path
|
14
14
|
@name = ::File.basename(path)
|
15
15
|
@path = ::File.expand_path(path)
|
16
|
-
@
|
17
|
-
@
|
16
|
+
@top_index = 0
|
17
|
+
@selection_count = 0
|
18
|
+
@selection = Point.new(0, 0 + @selection_count)
|
18
19
|
read_dirty_content = ::File.read(path)
|
19
20
|
begin
|
20
21
|
# test read dirty content
|
@@ -23,8 +24,9 @@ module Glimmer
|
|
23
24
|
lines_text_size = lines.size.to_s.size
|
24
25
|
self.line_numbers_content = lines.size.times.map {|n| (' ' * (lines_text_size - (n+1).to_s.size)) + (n+1).to_s }.join("\n")
|
25
26
|
end
|
27
|
+
@line_number = 1
|
26
28
|
self.dirty_content = read_dirty_content
|
27
|
-
observe(self, :
|
29
|
+
observe(self, :selection) do
|
28
30
|
self.line_number = line_index_for_caret_position(caret_position) + 1
|
29
31
|
end
|
30
32
|
observe(self, :line_number) do
|
@@ -38,7 +40,20 @@ module Glimmer
|
|
38
40
|
# no op in case of a binary file
|
39
41
|
end
|
40
42
|
end
|
41
|
-
|
43
|
+
|
44
|
+
def caret_position=(value)
|
45
|
+
self.selection = Point.new(value, value + selection_count.to_i)
|
46
|
+
if OS.linux?
|
47
|
+
async_exec do
|
48
|
+
self.top_index = line_index_for_caret_position(value)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def caret_position
|
54
|
+
selection.x
|
55
|
+
end
|
56
|
+
|
42
57
|
def name=(the_name)
|
43
58
|
self.display_path = display_path.sub(/#{Regexp.escape(@name)}$/, the_name)
|
44
59
|
@name = the_name
|
@@ -192,7 +207,7 @@ module Glimmer
|
|
192
207
|
delta = 0
|
193
208
|
line_indices_for_selection(caret_position, selection_count).each do |the_line_index|
|
194
209
|
the_line = old_lines[the_line_index]
|
195
|
-
if the_line.start_with?(' ')
|
210
|
+
if the_line.to_s.start_with?(' ')
|
196
211
|
new_lines[the_line_index] = the_line.sub(/ /, '')
|
197
212
|
delta = -2
|
198
213
|
elsif the_line.start_with?(' ')
|
@@ -261,7 +276,7 @@ module Glimmer
|
|
261
276
|
start_position = 0
|
262
277
|
start_position = line_position + find_text.to_s.size if i == 0 && the_index == the_line_index && found_text?(caret_position)
|
263
278
|
text_to_find_in = the_line.downcase[start_position..-1]
|
264
|
-
occurrence_index = text_to_find_in
|
279
|
+
occurrence_index = text_to_find_in&.index(find_text.to_s.downcase)
|
265
280
|
if occurrence_index
|
266
281
|
self.caret_position = caret_position_for_line_index(the_index) + start_position + occurrence_index
|
267
282
|
self.selection_count = find_text.to_s.size
|
@@ -315,10 +330,12 @@ module Glimmer
|
|
315
330
|
end
|
316
331
|
|
317
332
|
def page_up
|
333
|
+
self.selection_count = 0
|
318
334
|
self.line_number = [(self.line_number - 15), 1].max
|
319
335
|
end
|
320
336
|
|
321
337
|
def page_down
|
338
|
+
self.selection_count = 0
|
322
339
|
self.line_number = [(self.line_number + 15), lines.size].min
|
323
340
|
end
|
324
341
|
|
@@ -430,6 +447,14 @@ module Glimmer
|
|
430
447
|
def to_s
|
431
448
|
path
|
432
449
|
end
|
450
|
+
|
451
|
+
def eql?(other)
|
452
|
+
self.path.eql?(other&.path)
|
453
|
+
end
|
454
|
+
|
455
|
+
def hash
|
456
|
+
self.path.hash
|
457
|
+
end
|
433
458
|
end
|
434
459
|
end
|
435
460
|
end
|
@@ -4,6 +4,7 @@ rescue LoadError
|
|
4
4
|
# no op
|
5
5
|
end
|
6
6
|
require 'fileutils'
|
7
|
+
require 'os'
|
7
8
|
|
8
9
|
require 'models/glimmer/gladiator/dir'
|
9
10
|
require 'models/glimmer/gladiator/file'
|
@@ -19,6 +20,8 @@ module Glimmer
|
|
19
20
|
# Gladiator (Glimmer Editor)
|
20
21
|
class Gladiator
|
21
22
|
include Glimmer::UI::CustomShell
|
23
|
+
|
24
|
+
COMMAND_KEY = OS.mac? ? :command : :ctrl
|
22
25
|
|
23
26
|
## Add options like the following to configure CustomShell by outside consumers
|
24
27
|
#
|
@@ -33,17 +36,17 @@ module Glimmer
|
|
33
36
|
Display.setAppName('Gladiator')
|
34
37
|
@display = display {
|
35
38
|
on_event_keydown { |key_event|
|
36
|
-
if key_event.stateMask == swt(
|
39
|
+
if key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 'f'
|
37
40
|
if @text_editor.text_widget.getSelectionText && @text_editor.text_widget.getSelectionText.size > 0
|
38
41
|
@find_text.swt_widget.setText @text_editor.text_widget.getSelectionText
|
39
42
|
end
|
40
43
|
@find_text.swt_widget.selectAll
|
41
44
|
@find_text.swt_widget.setFocus
|
42
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
45
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'c'
|
43
46
|
Clipboard.copy(Gladiator::Dir.local_dir.selected_child.path)
|
44
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
47
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'g'
|
45
48
|
Gladiator::Dir.local_dir.selected_child.find_previous
|
46
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
49
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'w'
|
47
50
|
@tab_folder.swt_widget.getItems.each do |tab_item|
|
48
51
|
Dir.local_dir.selected_child_path_history.delete(tab_item.getData('file_path'))
|
49
52
|
tab_item.getData('proxy').dispose
|
@@ -51,12 +54,12 @@ module Glimmer
|
|
51
54
|
@tab_item = @text_editor = Dir.local_dir.selected_child = nil
|
52
55
|
@filter_text.swt_widget.selectAll
|
53
56
|
@filter_text.swt_widget.setFocus
|
54
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
57
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && key_event.character == 8721
|
55
58
|
other_tab_items.each do |tab_item|
|
56
59
|
Dir.local_dir.selected_child_path_history.delete(tab_item.getData('file_path'))
|
57
60
|
tab_item.getData('proxy').dispose
|
58
61
|
end
|
59
|
-
elsif key_event.stateMask == swt(
|
62
|
+
elsif key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 'w'
|
60
63
|
if selected_tab_item
|
61
64
|
Dir.local_dir.selected_child_path_history.delete(Dir.local_dir.selected_child.path)
|
62
65
|
selected_tab_item.getData('proxy').dispose
|
@@ -66,50 +69,50 @@ module Glimmer
|
|
66
69
|
@filter_text.swt_widget.setFocus
|
67
70
|
else
|
68
71
|
@text_editor.text_widget.setFocus
|
69
|
-
end
|
72
|
+
end
|
70
73
|
end
|
71
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
74
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == ']'
|
72
75
|
@tab_folder.swt_widget.setSelection([@tab_folder.swt_widget.getSelectionIndex() + 1, @tab_folder.swt_widget.getItemCount - 1].min) if @tab_folder.swt_widget.getItemCount > 0
|
73
76
|
@text_editor.text_widget.setFocus
|
74
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
77
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == '['
|
75
78
|
@tab_folder.swt_widget.setSelection([@tab_folder.swt_widget.getSelectionIndex() - 1, 0].max) if @tab_folder.swt_widget.getItemCount > 0
|
76
79
|
@text_editor.text_widget.setFocus
|
77
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
80
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == '1'
|
78
81
|
@tab_folder.swt_widget.setSelection(0) if @tab_folder.swt_widget.getItemCount >= 1
|
79
82
|
@text_editor.text_widget.setFocus
|
80
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
83
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == '2'
|
81
84
|
@tab_folder.swt_widget.setSelection(1) if @tab_folder.swt_widget.getItemCount >= 2
|
82
85
|
@text_editor.text_widget.setFocus
|
83
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
86
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == '3'
|
84
87
|
@tab_folder.swt_widget.setSelection(2) if @tab_folder.swt_widget.getItemCount >= 3
|
85
88
|
@text_editor.text_widget.setFocus
|
86
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, :command) && key_event.character.chr == '4'
|
87
89
|
@tab_folder.swt_widget.setSelection(3) if @tab_folder.swt_widget.getItemCount >= 4
|
88
90
|
@text_editor.text_widget.setFocus
|
89
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
91
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == '5'
|
90
92
|
@tab_folder.swt_widget.setSelection(4) if @tab_folder.swt_widget.getItemCount >= 5
|
91
93
|
@text_editor.text_widget.setFocus
|
92
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
94
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == '4'
|
95
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == '6'
|
93
96
|
@tab_folder.swt_widget.setSelection(5) if @tab_folder.swt_widget.getItemCount >= 6
|
94
97
|
@text_editor.text_widget.setFocus
|
95
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
98
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == '7'
|
96
99
|
@tab_folder.swt_widget.setSelection(6) if @tab_folder.swt_widget.getItemCount >= 7
|
97
100
|
@text_editor.text_widget.setFocus
|
98
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
101
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == '8'
|
99
102
|
@tab_folder.swt_widget.setSelection(7) if @tab_folder.swt_widget.getItemCount >= 8
|
100
103
|
@text_editor.text_widget.setFocus
|
101
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
104
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == '9'
|
102
105
|
@tab_folder.swt_widget.setSelection(@tab_folder.swt_widget.getItemCount - 1) if @tab_folder.swt_widget.getItemCount > 0
|
103
106
|
@text_editor.text_widget.setFocus
|
104
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
107
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == 'g'
|
105
108
|
Gladiator::Dir.local_dir.selected_child.find_next
|
106
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
109
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == 'l'
|
107
110
|
@line_number_text.swt_widget.selectAll
|
108
111
|
@line_number_text.swt_widget.setFocus
|
109
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
112
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == 'r'
|
110
113
|
@filter_text.swt_widget.selectAll
|
111
114
|
@filter_text.swt_widget.setFocus
|
112
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask,
|
115
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == 't'
|
113
116
|
select_tree_item unless @rename_in_progress
|
114
117
|
@tree.swt_widget.setFocus
|
115
118
|
elsif key_event.keyCode == swt(:esc)
|
@@ -343,6 +346,9 @@ module Glimmer
|
|
343
346
|
@text_editor.text_widget.setFocus
|
344
347
|
end
|
345
348
|
}
|
349
|
+
on_verify_text { |event|
|
350
|
+
event.doit = !event.text.match(/^\d*$/).to_a.empty?
|
351
|
+
}
|
346
352
|
}
|
347
353
|
label {
|
348
354
|
text 'Find:'
|
@@ -399,6 +405,8 @@ module Glimmer
|
|
399
405
|
swt_widget.setLocation(@config[:shell_x], @config[:shell_y]) if @config[:shell_x] && @config[:shell_y]
|
400
406
|
@loaded_config = true
|
401
407
|
}
|
408
|
+
else
|
409
|
+
@loaded_config = true
|
402
410
|
end
|
403
411
|
end
|
404
412
|
|
@@ -512,5 +520,11 @@ module Glimmer
|
|
512
520
|
}
|
513
521
|
)
|
514
522
|
end
|
523
|
+
|
524
|
+
def extract_char(event)
|
525
|
+
event.keyCode.chr
|
526
|
+
rescue => e
|
527
|
+
nil
|
528
|
+
end
|
515
529
|
end
|
516
|
-
end
|
530
|
+
end
|
@@ -17,7 +17,7 @@ module Glimmer
|
|
17
17
|
grid_layout 2, false
|
18
18
|
@line_numbers_text = text(:multi) {
|
19
19
|
layout_data(:right, :fill, false, true)
|
20
|
-
font name: 'Consolas', height: 15
|
20
|
+
font name: 'Consolas', height: OS.mac? ? 15 : 12
|
21
21
|
background color(:widget_background)
|
22
22
|
foreground rgb(75, 75, 75)
|
23
23
|
text bind(file, 'line_numbers_content')
|
@@ -34,31 +34,38 @@ module Glimmer
|
|
34
34
|
}
|
35
35
|
@text = text(:multi, :border, :h_scroll, :v_scroll) {
|
36
36
|
layout_data :fill, :fill, true, true
|
37
|
-
font name: 'Consolas', height: 15
|
37
|
+
font name: 'Consolas', height: OS.mac? ? 15 : 12
|
38
38
|
foreground rgb(75, 75, 75)
|
39
39
|
text bind(file, 'dirty_content')
|
40
40
|
focus true
|
41
|
-
|
41
|
+
selection bind(file, 'selection')
|
42
42
|
selection_count bind(file, 'selection_count')
|
43
43
|
top_index bind(file, 'top_index')
|
44
44
|
on_focus_lost {
|
45
45
|
file&.write_dirty_content
|
46
46
|
}
|
47
47
|
on_key_pressed { |key_event|
|
48
|
-
if key_event.stateMask == swt(
|
48
|
+
if key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == '/'
|
49
49
|
file.comment_line!
|
50
|
-
|
50
|
+
key_event.doit = false
|
51
|
+
elsif key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 'k'
|
51
52
|
file.kill_line!
|
52
|
-
|
53
|
+
key_event.doit = false
|
54
|
+
elsif key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 'd'
|
53
55
|
file.duplicate_line!
|
54
|
-
|
56
|
+
key_event.doit = false
|
57
|
+
elsif key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == '['
|
55
58
|
file.outdent!
|
56
|
-
|
59
|
+
key_event.doit = false
|
60
|
+
elsif key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == ']'
|
57
61
|
file.indent!
|
58
|
-
|
62
|
+
key_event.doit = false
|
63
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && key_event.keyCode == swt(:cr)
|
59
64
|
file.prefix_new_line!
|
60
|
-
|
65
|
+
key_event.doit = false
|
66
|
+
elsif key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:cr)
|
61
67
|
file.insert_new_line!
|
68
|
+
key_event.doit = false
|
62
69
|
elsif key_event.keyCode == swt(:page_up)
|
63
70
|
file.page_up
|
64
71
|
key_event.doit = false
|
@@ -71,10 +78,10 @@ module Glimmer
|
|
71
78
|
elsif key_event.keyCode == swt(:end)
|
72
79
|
file.end
|
73
80
|
key_event.doit = false
|
74
|
-
elsif key_event.stateMask == swt(
|
81
|
+
elsif key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:arrow_up)
|
75
82
|
file.move_up!
|
76
83
|
key_event.doit = false
|
77
|
-
elsif key_event.stateMask == swt(
|
84
|
+
elsif key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:arrow_down)
|
78
85
|
file.move_down!
|
79
86
|
key_event.doit = false
|
80
87
|
end
|
@@ -98,6 +105,15 @@ module Glimmer
|
|
98
105
|
}
|
99
106
|
}
|
100
107
|
}
|
108
|
+
|
109
|
+
|
110
|
+
def extract_char(event)
|
111
|
+
event.keyCode.chr
|
112
|
+
rescue => e
|
113
|
+
nil
|
114
|
+
end
|
115
|
+
|
101
116
|
end
|
102
117
|
end
|
103
118
|
end
|
119
|
+
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-cs-gladiator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
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-
|
11
|
+
date: 2020-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 0.7.
|
18
|
+
version: 0.7.6
|
19
19
|
name: glimmer
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.7.
|
26
|
+
version: 0.7.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|