textbringer 1.0.3 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,24 +43,27 @@ module Textbringer
43
43
  Buffer.current = window.buffer
44
44
  end
45
45
 
46
- def self.delete_window
47
- if @@current.echo_area?
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(@@current)
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(@@current.lines + window.lines, window.columns)
61
- @@current.delete
61
+ window.resize(target.lines + window.lines, window.columns)
62
+ target.delete
62
63
  @@list.delete_at(i)
63
- self.current = window
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 @@ module Textbringer
455
458
  end
456
459
  end
457
460
  end
458
- @window.addstr(c)
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 @@ module Textbringer
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
- new_lines = (old_lines / 2.0).ceil
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 @@ module Textbringer
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/lib/textbringer.rb CHANGED
@@ -22,6 +22,7 @@ require_relative "textbringer/commands/register"
22
22
  require_relative "textbringer/commands/keyboard_macro"
23
23
  require_relative "textbringer/commands/fill"
24
24
  require_relative "textbringer/commands/server"
25
+ require_relative "textbringer/commands/input_method"
25
26
  require_relative "textbringer/commands/help"
26
27
  require_relative "textbringer/mode"
27
28
  require_relative "textbringer/modes/fundamental_mode"
@@ -32,5 +33,8 @@ require_relative "textbringer/modes/backtrace_mode"
32
33
  require_relative "textbringer/modes/completion_list_mode"
33
34
  require_relative "textbringer/modes/buffer_list_mode"
34
35
  require_relative "textbringer/modes/help_mode"
36
+ require_relative "textbringer/input_method"
37
+ require_relative "textbringer/input_methods/t_code_input_method"
38
+ require_relative "textbringer/input_methods/hiragana_input_method"
35
39
  require_relative "textbringer/plugin"
36
40
  require_relative "textbringer/controller"
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.4'
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", "~> 1.1"
26
- spec.add_runtime_dependency "clipboard", "~> 1.1"
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", "~> 12.0"
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.3
4
+ version: 1.1.1
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: 2020-03-10 00:00:00.000000000 Z
11
+ date: 2022-01-06 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.4'
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.2.0.pre1
257
- signing_key:
247
+ rubygems_version: 3.4.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}}