glimmer-cs-gladiator 0.2.3 → 0.2.4
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.
- checksums.yaml +4 -4
- data/README.md +12 -6
- data/VERSION +1 -1
- data/lib/models/glimmer/gladiator/dir.rb +13 -5
- data/lib/models/glimmer/gladiator/file.rb +17 -9
- data/lib/views/glimmer/gladiator.rb +15 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d7db15419bc0913d01e3e15634e12833a1f36a7fc3160e2a7835ab6560832af
|
4
|
+
data.tar.gz: 6e55a2c18985603a0b6438198fad5959bcea27b65a8e43b8a810fd42ec5fda76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bae9a2b2eb76cf9ca64ec0d76216fa8aa7c12e97805dbfee42dace54deceedba6eeb1579b65cbdb7c1ad595a44e5768ac372619db804f5fbc240ee52afbecb4d
|
7
|
+
data.tar.gz: 56186b8a8d31dc8974ff4f35afd4f7a37d4932cea6b1c4517832ae760ec1f6c5d0092c6048a5f333bf1e438bd514ccd2db3a6ca0ac45d35a519d35194861c251
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# <img src='https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-cs-gladiator-logo.svg' height=85 /> Gladiator 0.2.
|
1
|
+
# <img src='https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-cs-gladiator-logo.svg' height=85 /> Gladiator 0.2.4 - [Ugliest Text Editor Ever](https://www.reddit.com/r/ruby/comments/hgve8k/gladiator_glimmer_editor_ugliest_text_editor_ever/)
|
2
2
|
## [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 /> Glimmer Custom Shell](https://github.com/AndyObtiva/glimmer#custom-shell-gem)
|
3
3
|
[](http://badge.fury.io/rb/glimmer-cs-gladiator)
|
4
4
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
Gladiator (short for Glimmer Editor) is a [Glimmer](https://github.com/AndyObtiva/glimmer) sample project under on-going development that demonstrates how to build a text editor in [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library).
|
8
8
|
It is not intended to be a full-fledged editor by any means, yet mostly a fun educational exercise in using [Glimmer](https://github.com/AndyObtiva/glimmer).
|
9
9
|
Gladiator is also a personal tool for shaping an editor exactly the way I like, with all the keyboard shortcuts I prefer.
|
10
|
-
I leave building truly professional text editors to software tooling experts who would hopefully use [Glimmer](https://github.com/AndyObtiva/glimmer) one day. Otherwise, I have been happily using Gladiator to develop all my [open-source projects](https://github.com/AndyObtiva) since May 2020.
|
10
|
+
I leave building truly professional text editors to software tooling experts who would hopefully use [Glimmer](https://github.com/AndyObtiva/glimmer) one day. Otherwise, I have been happily using Gladiator to develop all my [open-source projects](https://github.com/AndyObtiva) since May of 2020.
|
11
11
|
|
12
12
|
## Features
|
13
13
|
|
@@ -33,9 +33,9 @@ Gladiator currently supports the following text editing features (including keyb
|
|
33
33
|
|
34
34
|
## Platforms
|
35
35
|
|
36
|
-
- Mac: Gladiator works best on the Mac.
|
37
|
-
- Windows: Gladiator works
|
38
|
-
- Linux: Gladiator works with handicaps on Linux (performing text editing operations causes scroll jitter)
|
36
|
+
- Mac: Gladiator works best on the Mac. This is the platform it is most used on and receives the most maintenance for.
|
37
|
+
- Windows: Gladiator works OK on Windows, but has some annoying bugs.
|
38
|
+
- Linux: Gladiator works with very bad handicaps on Linux (performing text editing operations causes scroll jitter)
|
39
39
|
|
40
40
|
## Pre-requisites
|
41
41
|
|
@@ -73,6 +73,12 @@ You may run the `gladiator` command to bring up the text editor in the project d
|
|
73
73
|
gladiator
|
74
74
|
```
|
75
75
|
|
76
|
+
On Windows, you may need to run with extra memory via this command instead:
|
77
|
+
|
78
|
+
```
|
79
|
+
gladiator -J-Xmx3000M
|
80
|
+
```
|
81
|
+
|
76
82
|
If you are in a different directory from the project you would like to edit, then pass its path as an argument:
|
77
83
|
|
78
84
|
```
|
@@ -93,7 +99,7 @@ To reuse Gladiator as a Glimmer Custom Shell inside another Glimmer application,
|
|
93
99
|
following to the application's `Gemfile`:
|
94
100
|
|
95
101
|
```
|
96
|
-
gem 'glimmer-cs-gladiator', '~> 0.2.
|
102
|
+
gem 'glimmer-cs-gladiator', '~> 0.2.4'
|
97
103
|
```
|
98
104
|
|
99
105
|
Run:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
@@ -26,18 +26,26 @@ module Glimmer
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
attr_accessor :selected_child, :filter, :children, :filtered_path_options, :filtered_path, :
|
30
|
-
attr_reader :name, :parent
|
29
|
+
attr_accessor :selected_child, :filter, :children, :filtered_path_options, :filtered_path, :display_path
|
30
|
+
attr_reader :name, :parent, :path, :is_local_dir
|
31
31
|
attr_writer :all_children
|
32
32
|
|
33
33
|
def initialize(path, is_local_dir = false)
|
34
|
-
@
|
35
|
-
|
34
|
+
@is_local_dir = is_local_dir
|
35
|
+
self.path = ::File.expand_path(path)
|
36
36
|
@name = ::File.basename(::File.expand_path(path))
|
37
|
-
@display_path = @path.sub(Dir.local_dir.path, '').sub(/^\//, '') unless is_local_dir
|
38
37
|
self.filtered_path_options = []
|
39
38
|
end
|
40
39
|
|
40
|
+
def path=(the_path)
|
41
|
+
@path = the_path
|
42
|
+
generate_display_path
|
43
|
+
end
|
44
|
+
|
45
|
+
def generate_display_path
|
46
|
+
is_local_dir ? path : @display_path = @path.sub(Dir.local_dir.path, '').sub(/^\//, '')
|
47
|
+
end
|
48
|
+
|
41
49
|
def name=(the_name)
|
42
50
|
self.display_path = display_path.sub(/#{Regexp.escape(@name)}$/, the_name)
|
43
51
|
@name = the_name
|
@@ -5,16 +5,14 @@ module Glimmer
|
|
5
5
|
class File
|
6
6
|
include Glimmer
|
7
7
|
|
8
|
-
attr_accessor :dirty_content, :line_numbers_content, :selection, :selection_count, :line_number, :find_text, :replace_text, :top_index, :
|
9
|
-
attr_reader :name
|
8
|
+
attr_accessor :dirty_content, :line_numbers_content, :selection, :selection_count, :line_number, :find_text, :replace_text, :top_index, :display_path, :case_sensitive
|
9
|
+
attr_reader :name, :path
|
10
10
|
|
11
11
|
def initialize(path)
|
12
12
|
raise "Not a file path: #{path}" unless ::File.file?(path)
|
13
13
|
@command_history = []
|
14
|
-
@display_path = path
|
15
14
|
@name = ::File.basename(path)
|
16
|
-
|
17
|
-
@display_path = @path.sub(Dir.local_dir.path, '').sub(/^\//, '')
|
15
|
+
self.path = ::File.expand_path(path)
|
18
16
|
@top_index = 0
|
19
17
|
@selection_count = 0
|
20
18
|
@selection = Point.new(0, 0 + @selection_count)
|
@@ -43,6 +41,15 @@ module Glimmer
|
|
43
41
|
end
|
44
42
|
end
|
45
43
|
|
44
|
+
def path=(the_path)
|
45
|
+
@path = the_path
|
46
|
+
generate_display_path
|
47
|
+
end
|
48
|
+
|
49
|
+
def generate_display_path
|
50
|
+
@display_path = @path.sub(Dir.local_dir.path, '').sub(/^\//, '')
|
51
|
+
end
|
52
|
+
|
46
53
|
# to use for widget data-binding
|
47
54
|
def content=(value)
|
48
55
|
Command.do(self) # record a native (OS-widget) operation
|
@@ -67,11 +74,12 @@ module Glimmer
|
|
67
74
|
end
|
68
75
|
|
69
76
|
def name=(the_name)
|
70
|
-
|
77
|
+
new_path = path.sub(/#{Regexp.escape(@name)}$/, the_name)
|
71
78
|
@name = the_name
|
72
|
-
|
73
|
-
|
74
|
-
|
79
|
+
if ::File.exists?(path)
|
80
|
+
FileUtils.mv(path, new_path)
|
81
|
+
self.path = new_path
|
82
|
+
end
|
75
83
|
end
|
76
84
|
|
77
85
|
def dirty_content=(the_content)
|
@@ -516,9 +516,16 @@ module Glimmer
|
|
516
516
|
config_yaml = ::File.read(@config_file_path)
|
517
517
|
return if config_yaml.to_s.strip.empty?
|
518
518
|
@config = YAML.load(config_yaml)
|
519
|
-
@config[:
|
519
|
+
open_file_paths1 = @config[:open_file_paths1] || @config[:open_file_paths]
|
520
|
+
open_file_paths2 = @config[:open_file_paths2]
|
521
|
+
open_file_paths1.to_a.each do |file_path|
|
520
522
|
Dir.local_dir.selected_child_path = file_path
|
521
523
|
end
|
524
|
+
Gladiator.drag = true
|
525
|
+
open_file_paths2.to_a.each do |file_path|
|
526
|
+
Dir.local_dir.selected_child_path = file_path
|
527
|
+
end
|
528
|
+
Gladiator.drag = false
|
522
529
|
Dir.local_dir.selected_child_path = @config[:selected_child_path] if @config[:selected_child_path]
|
523
530
|
Dir.local_dir.selected_child&.caret_position = Dir.local_dir.selected_child&.caret_position_for_caret_position_start_of_line(@config[:caret_position].to_i) if @config[:caret_position]
|
524
531
|
Dir.local_dir.selected_child&.top_index = @config[:top_index].to_i if @config[:top_index]
|
@@ -536,6 +543,10 @@ module Glimmer
|
|
536
543
|
return unless @loaded_config
|
537
544
|
child = Dir.local_dir.selected_child
|
538
545
|
return if child.nil?
|
546
|
+
tab_folder1 = @tab_folder1 || @tab_folder
|
547
|
+
tab_folder2 = @tab_folder2
|
548
|
+
open_file_paths1 = tab_folder1&.swt_widget&.items&.to_a.map {|i| i.get_data('file_path')}
|
549
|
+
open_file_paths2 = tab_folder2&.swt_widget&.items&.to_a.map {|i| i.get_data('file_path')}
|
539
550
|
@config = {
|
540
551
|
selected_child_path: child.path,
|
541
552
|
caret_position: child.caret_position,
|
@@ -544,7 +555,8 @@ module Glimmer
|
|
544
555
|
shell_height: swt_widget&.getBounds&.height,
|
545
556
|
shell_x: swt_widget&.getBounds&.x,
|
546
557
|
shell_y: swt_widget&.getBounds&.y,
|
547
|
-
|
558
|
+
open_file_paths1: open_file_paths1,
|
559
|
+
open_file_paths2: open_file_paths2,
|
548
560
|
}
|
549
561
|
config_yaml = YAML.dump(@config)
|
550
562
|
::File.write(@config_file_path, config_yaml) unless config_yaml.to_s.empty?
|
@@ -644,6 +656,7 @@ module Glimmer
|
|
644
656
|
end
|
645
657
|
new_file_path = ::File.expand_path(::File.join(directory_path, 'new_file'))
|
646
658
|
FileUtils.touch(new_file_path)
|
659
|
+
# TODO look into refreshing only the parent directory to avoid slowdown
|
647
660
|
Dir.local_dir.refresh(async: false, force: true)
|
648
661
|
new_tree_item = @tree.depth_first_search {|ti| ti.getData.path == new_file_path}.first
|
649
662
|
@tree.swt_widget.showItem(new_tree_item)
|
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.2.
|
4
|
+
version: 0.2.4
|
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-07-
|
11
|
+
date: 2020-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|