textbringer 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ubuntu.yml +5 -9
- data/.github/workflows/windows.yml +4 -7
- data/CHANGES.md +47 -0
- data/README.md +0 -2
- data/bin/merge_mazegaki_dic +25 -0
- data/exe/textbringer +6 -5
- data/lib/textbringer.rb +4 -0
- data/lib/textbringer/buffer.rb +40 -3
- data/lib/textbringer/commands/clipboard.rb +3 -3
- data/lib/textbringer/commands/ctags.rb +3 -3
- data/lib/textbringer/commands/dabbrev.rb +1 -1
- data/lib/textbringer/commands/files.rb +18 -3
- data/lib/textbringer/commands/help.rb +25 -16
- data/lib/textbringer/commands/input_method.rb +18 -0
- data/lib/textbringer/commands/isearch.rb +23 -2
- data/lib/textbringer/commands/misc.rb +8 -3
- data/lib/textbringer/commands/windows.rb +8 -4
- data/lib/textbringer/config.rb +2 -1
- data/lib/textbringer/controller.rb +7 -1
- data/lib/textbringer/input_method.rb +63 -0
- data/lib/textbringer/input_methods/hiragana_input_method.rb +70 -0
- data/lib/textbringer/input_methods/t_code_input_method.rb +458 -0
- data/lib/textbringer/input_methods/t_code_input_method/tables.rb +64 -0
- data/lib/textbringer/keymap.rb +45 -26
- data/lib/textbringer/modes/backtrace_mode.rb +1 -1
- data/lib/textbringer/modes/buffer_list_mode.rb +1 -1
- data/lib/textbringer/modes/c_mode.rb +4 -0
- data/lib/textbringer/modes/completion_list_mode.rb +1 -1
- data/lib/textbringer/modes/help_mode.rb +1 -1
- data/lib/textbringer/modes/programming_mode.rb +24 -2
- data/lib/textbringer/modes/ruby_mode.rb +70 -12
- data/lib/textbringer/utils.rb +10 -5
- data/lib/textbringer/version.rb +1 -1
- data/lib/textbringer/window.rb +25 -10
- data/textbringer.gemspec +4 -5
- metadata +19 -28
- data/.github/workflows/ruby-head.yml +0 -30
data/lib/textbringer/utils.rb
CHANGED
@@ -66,6 +66,9 @@ def foreground(&block)
|
|
66
66
|
alias next_tick foreground
|
67
67
|
|
68
68
|
def foreground!
|
69
|
+
if Thread.current == Thread.main
|
70
|
+
return yield
|
71
|
+
end
|
69
72
|
q = Queue.new
|
70
73
|
foreground do
|
71
74
|
begin
|
@@ -105,7 +108,7 @@ def show_exception(e)
|
|
105
108
|
if e.is_a?(SystemExit) || e.is_a?(SignalException)
|
106
109
|
raise
|
107
110
|
end
|
108
|
-
if Buffer.current&.name != "*Backtrace*"
|
111
|
+
if !e.is_a?(Quit) && Buffer.current&.name != "*Backtrace*"
|
109
112
|
buffer = Buffer.find_or_new("*Backtrace*", undo_limit: 0)
|
110
113
|
if !buffer.mode.is_a?(BacktraceMode)
|
111
114
|
buffer.apply_mode(BacktraceMode)
|
@@ -176,6 +179,7 @@ def read_from_minibuffer(prompt, completion_proc: nil, default: nil,
|
|
176
179
|
Window.current.buffer = Buffer.current = old_buffer
|
177
180
|
Buffer.minibuffer[:completion_proc] = old_completion_proc
|
178
181
|
Buffer.minibuffer.keymap = old_minibuffer_map
|
182
|
+
Buffer.minibuffer.disable_input_method
|
179
183
|
Controller.current.current_prefix_arg = old_current_prefix_arg
|
180
184
|
if COMPLETION[:original_buffer]
|
181
185
|
COMPLETION[:completions_window].buffer = COMPLETION[:original_buffer]
|
@@ -196,8 +200,9 @@ def read_file_name(prompt, default: nil)
|
|
196
200
|
end
|
197
201
|
}
|
198
202
|
}
|
203
|
+
initial_value = default&.sub(%r"\A#{Regexp.quote(Dir.pwd)}/", "")
|
199
204
|
file = read_from_minibuffer(prompt, completion_proc: f,
|
200
|
-
initial_value:
|
205
|
+
initial_value: initial_value)
|
201
206
|
File.expand_path(file)
|
202
207
|
end
|
203
208
|
|
@@ -238,7 +243,7 @@ def yes_or_no?(prompt)
|
|
238
243
|
}
|
239
244
|
end
|
240
245
|
|
241
|
-
Y_OR_N_MAP
|
246
|
+
define_keymap :Y_OR_N_MAP
|
242
247
|
Y_OR_N_MAP.define_key(?y, :self_insert_and_exit_minibuffer)
|
243
248
|
Y_OR_N_MAP.define_key(?n, :self_insert_and_exit_minibuffer)
|
244
249
|
Y_OR_N_MAP.define_key(?\C-g, :abort_recursive_edit)
|
@@ -313,8 +318,8 @@ def read_key_sequence(prompt)
|
|
313
318
|
|
314
319
|
HOOKS = Hash.new { |h, k| h[k] = [] }
|
315
320
|
|
316
|
-
def add_hook(name, func =
|
317
|
-
HOOKS[name].unshift(func)
|
321
|
+
def add_hook(name, func = nil, &block)
|
322
|
+
HOOKS[name].unshift(func || block)
|
318
323
|
end
|
319
324
|
|
320
325
|
def remove_hook(name, func)
|
data/lib/textbringer/version.rb
CHANGED
data/lib/textbringer/window.rb
CHANGED
@@ -43,24 +43,27 @@ def self.current=(window)
|
|
43
43
|
Buffer.current = window.buffer
|
44
44
|
end
|
45
45
|
|
46
|
-
def self.delete_window
|
47
|
-
if
|
46
|
+
def self.delete_window(target = @@current)
|
47
|
+
if target.echo_area?
|
48
48
|
raise EditorError, "Can't delete the echo area"
|
49
49
|
end
|
50
50
|
if @@list.size == 2
|
51
51
|
raise EditorError, "Can't delete the sole window"
|
52
52
|
end
|
53
|
-
i = @@list.index(
|
53
|
+
i = @@list.index(target)
|
54
|
+
return if i.nil?
|
54
55
|
if i == 0
|
55
56
|
window = @@list[1]
|
56
57
|
window.move(0, 0)
|
57
58
|
else
|
58
59
|
window = @@list[i - 1]
|
59
60
|
end
|
60
|
-
window.resize(
|
61
|
-
|
61
|
+
window.resize(target.lines + window.lines, window.columns)
|
62
|
+
target.delete
|
62
63
|
@@list.delete_at(i)
|
63
|
-
|
64
|
+
if target == @@current
|
65
|
+
self.current = window
|
66
|
+
end
|
64
67
|
end
|
65
68
|
|
66
69
|
def self.delete_other_windows
|
@@ -455,7 +458,12 @@ def redisplay
|
|
455
458
|
end
|
456
459
|
end
|
457
460
|
end
|
458
|
-
|
461
|
+
if Buffer.display_width(c) == 0
|
462
|
+
# ncurses on macOS prints U+FEFF, U+FE0F etc. as space,
|
463
|
+
# so ignore it
|
464
|
+
else
|
465
|
+
@window.addstr(c)
|
466
|
+
end
|
459
467
|
break if newx == columns && cury == lines - 2
|
460
468
|
@buffer.forward_char
|
461
469
|
end
|
@@ -538,9 +546,16 @@ def scroll_down
|
|
538
546
|
@top_of_window.location = 0
|
539
547
|
end
|
540
548
|
|
541
|
-
def split
|
549
|
+
def split(other_lines = nil)
|
542
550
|
old_lines = lines
|
543
|
-
|
551
|
+
if other_lines
|
552
|
+
if other_lines < CONFIG[:window_min_height]
|
553
|
+
raise EditorError, "Window too small"
|
554
|
+
end
|
555
|
+
new_lines = lines - other_lines
|
556
|
+
else
|
557
|
+
new_lines = (old_lines / 2.0).ceil
|
558
|
+
end
|
544
559
|
if new_lines < CONFIG[:window_min_height]
|
545
560
|
raise EditorError, "Window too small"
|
546
561
|
end
|
@@ -645,7 +660,7 @@ def redisplay_mode_line
|
|
645
660
|
@mode_line.setpos(0, 0)
|
646
661
|
attrs = @@has_colors ? Face[:mode_line].attributes : Curses::A_REVERSE
|
647
662
|
@mode_line.attrset(attrs)
|
648
|
-
@mode_line.addstr("#{@buffer.name} ")
|
663
|
+
@mode_line.addstr("#{@buffer.input_method_status} #{@buffer.name} ")
|
649
664
|
@mode_line.addstr("[+]") if @buffer.modified?
|
650
665
|
@mode_line.addstr("[RO]") if @buffer.read_only?
|
651
666
|
@mode_line.addstr("[#{@buffer.file_encoding.name}/")
|
data/textbringer.gemspec
CHANGED
@@ -19,18 +19,17 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.required_ruby_version = '>= 2.
|
22
|
+
spec.required_ruby_version = '>= 2.6'
|
23
23
|
|
24
24
|
spec.add_runtime_dependency "curses", ">= 1.2.7"
|
25
|
-
spec.add_runtime_dependency "unicode-display_width", "
|
26
|
-
spec.add_runtime_dependency "clipboard", "
|
25
|
+
spec.add_runtime_dependency "unicode-display_width", ">= 1.1"
|
26
|
+
spec.add_runtime_dependency "clipboard", ">= 1.1"
|
27
27
|
spec.add_runtime_dependency "fiddley", ">= 0.0.5"
|
28
28
|
spec.add_runtime_dependency "editorconfig"
|
29
29
|
|
30
30
|
spec.add_development_dependency "bundler"
|
31
|
-
spec.add_development_dependency "rake", "
|
31
|
+
spec.add_development_dependency "rake", ">= 12.0"
|
32
32
|
spec.add_development_dependency "test-unit"
|
33
33
|
spec.add_development_dependency "simplecov"
|
34
|
-
spec.add_development_dependency "codecov"
|
35
34
|
spec.add_development_dependency "ripper-tags"
|
36
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textbringer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shugo Maeda
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|
@@ -28,28 +28,28 @@ dependencies:
|
|
28
28
|
name: unicode-display_width
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: clipboard
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
@@ -98,14 +98,14 @@ dependencies:
|
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '12.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '12.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
@@ -136,20 +136,6 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: codecov
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: ripper-tags
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,7 +164,6 @@ files:
|
|
178
164
|
- ".editorconfig"
|
179
165
|
- ".gitattributes"
|
180
166
|
- ".github/workflows/macos.yml"
|
181
|
-
- ".github/workflows/ruby-head.yml"
|
182
167
|
- ".github/workflows/ubuntu.yml"
|
183
168
|
- ".github/workflows/windows.yml"
|
184
169
|
- ".gitignore"
|
@@ -188,6 +173,7 @@ files:
|
|
188
173
|
- README.md
|
189
174
|
- Rakefile
|
190
175
|
- bin/console
|
176
|
+
- bin/merge_mazegaki_dic
|
191
177
|
- exe/tbclient
|
192
178
|
- exe/tbtags
|
193
179
|
- exe/textbringer
|
@@ -202,6 +188,7 @@ files:
|
|
202
188
|
- lib/textbringer/commands/files.rb
|
203
189
|
- lib/textbringer/commands/fill.rb
|
204
190
|
- lib/textbringer/commands/help.rb
|
191
|
+
- lib/textbringer/commands/input_method.rb
|
205
192
|
- lib/textbringer/commands/isearch.rb
|
206
193
|
- lib/textbringer/commands/keyboard_macro.rb
|
207
194
|
- lib/textbringer/commands/misc.rb
|
@@ -215,6 +202,10 @@ files:
|
|
215
202
|
- lib/textbringer/face.rb
|
216
203
|
- lib/textbringer/faces/basic.rb
|
217
204
|
- lib/textbringer/faces/programming.rb
|
205
|
+
- lib/textbringer/input_method.rb
|
206
|
+
- lib/textbringer/input_methods/hiragana_input_method.rb
|
207
|
+
- lib/textbringer/input_methods/t_code_input_method.rb
|
208
|
+
- lib/textbringer/input_methods/t_code_input_method/tables.rb
|
218
209
|
- lib/textbringer/keymap.rb
|
219
210
|
- lib/textbringer/mode.rb
|
220
211
|
- lib/textbringer/modes/backtrace_mode.rb
|
@@ -238,7 +229,7 @@ homepage: https://github.com/shugo/textbringer
|
|
238
229
|
licenses:
|
239
230
|
- MIT
|
240
231
|
metadata: {}
|
241
|
-
post_install_message:
|
232
|
+
post_install_message:
|
242
233
|
rdoc_options: []
|
243
234
|
require_paths:
|
244
235
|
- lib
|
@@ -246,15 +237,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
246
237
|
requirements:
|
247
238
|
- - ">="
|
248
239
|
- !ruby/object:Gem::Version
|
249
|
-
version: '2.
|
240
|
+
version: '2.6'
|
250
241
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
242
|
requirements:
|
252
243
|
- - ">="
|
253
244
|
- !ruby/object:Gem::Version
|
254
245
|
version: '0'
|
255
246
|
requirements: []
|
256
|
-
rubygems_version: 3.
|
257
|
-
signing_key:
|
247
|
+
rubygems_version: 3.3.0.dev
|
248
|
+
signing_key:
|
258
249
|
specification_version: 4
|
259
250
|
summary: An Emacs-like text editor
|
260
251
|
test_files: []
|
@@ -1,30 +0,0 @@
|
|
1
|
-
name: ruby-head
|
2
|
-
|
3
|
-
on: [push]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
steps:
|
9
|
-
- uses: actions/checkout@master
|
10
|
-
- name: Set up RVM
|
11
|
-
run: |
|
12
|
-
curl -sSL https://get.rvm.io | bash
|
13
|
-
- name: Set up Ruby
|
14
|
-
run: |
|
15
|
-
source $HOME/.rvm/scripts/rvm
|
16
|
-
rvm install ruby-head --binary
|
17
|
-
rvm --default use ruby-head
|
18
|
-
- name: Install dependencies
|
19
|
-
run: |
|
20
|
-
source $HOME/.rvm/scripts/rvm
|
21
|
-
sudo apt install libncursesw5-dev
|
22
|
-
gem install bundler --no-document
|
23
|
-
bundle install
|
24
|
-
- name: Run test
|
25
|
-
run: |
|
26
|
-
source $HOME/.rvm/scripts/rvm
|
27
|
-
xvfb-run bundle exec rake test
|
28
|
-
env:
|
29
|
-
UPLOAD_TO_CODECOV: 1
|
30
|
-
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
|