textbringer 1.0.3 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a50dd7957ac593c31d5f1f0102d2240b277f419cd7ea431af422afe53cb3746b
4
- data.tar.gz: 7c4ad8bca8b8ec2ca21bea0a855872f4de39f7e18e22c64e072a4723fbf8a029
3
+ metadata.gz: 1cadae924b2e85758480d58a7f4ba6ff48fc6ac1971039159a8b81a1a0bbbd29
4
+ data.tar.gz: cb981c7fb394e1c4683cd1365f5da1ed1f372c4254d3e9d8ca5782cad18cf167
5
5
  SHA512:
6
- metadata.gz: 96b9ca053d2efeef296ff47db39aa1ef8d345456a5bd3a762025a4928ffb63dc8a3f63cdab5c60e6280a1cf47d56eedfa7734ddd0a23d0bd368fece0e58a96a3
7
- data.tar.gz: 1cbe3d4cc148f6d837913c5080199bff92417a584fd6b9a452d2f414e1b9e3a09259ce16cc7bfd5a05c2987ac2bc4a55f1d417d42314c59155100d5d0c98764c
6
+ metadata.gz: a57df2132fc40661649106e25f523e7f866ae469020fb33b687d1bf05921f0b4f17915271df4745035737b3be0c65d34650ae55af3ca10d4f677d7c2ac4d7715
7
+ data.tar.gz: fd5081ffaa6a8f42466fdc9fd82d6acd4a732941c66d5e2d37fd1c2a66cafba947de668a08ea60ac87f171306aadcaeca6e815991666bcac47ac376a8cd16d73
@@ -3,15 +3,14 @@ name: ubuntu
3
3
  on: [push]
4
4
 
5
5
  jobs:
6
- build:
7
- runs-on: ubuntu-latest
6
+ test:
8
7
  strategy:
9
8
  matrix:
10
- ruby: [ '2.6.x', '2.5.x', '2.4.x' ]
9
+ ruby: [ head, 2.7, 2.6, 2.5, 2.4 ]
10
+ runs-on: ubuntu-latest
11
11
  steps:
12
- - uses: actions/checkout@master
13
- - name: Set up Ruby
14
- uses: actions/setup-ruby@v1
12
+ - uses: actions/checkout@v2
13
+ - uses: ruby/setup-ruby@v1
15
14
  with:
16
15
  ruby-version: ${{ matrix.ruby }}
17
16
  - name: Install dependencies
@@ -7,16 +7,13 @@ jobs:
7
7
  runs-on: windows-latest
8
8
  strategy:
9
9
  matrix:
10
- ruby: [ '2.6.x', '2.5.x', '2.4.x' ]
10
+ ruby: [ 'mingw', 'mswin', '2.7', '2.6', '2.5' ]
11
11
  steps:
12
- - uses: actions/checkout@master
12
+ - uses: actions/checkout@v2
13
13
  - name: Set up Ruby
14
- uses: actions/setup-ruby@v1
14
+ uses: ruby/setup-ruby@v1
15
15
  with:
16
16
  ruby-version: ${{ matrix.ruby }}
17
- - name: Set up Bundler
18
- run: gem install bundler --no-document
19
- - name: Install dependencies
20
- run: bundle install
17
+ bundler-cache: true
21
18
  - name: Run test
22
19
  run: bundle exec rake test
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.0.4
2
+
3
+ * Support Ruby 3.0.
4
+ * Do not record backtrace of Quit (C-g).
5
+
1
6
  ## 1.0.3
2
7
 
3
8
  * Fix indentation bugs.
data/README.md CHANGED
@@ -4,7 +4,6 @@
4
4
  [![ubuntu](https://github.com/shugo/textbringer/workflows/ubuntu/badge.svg)](https://github.com/shugo/textbringer/actions?query=workflow%3Aubuntu)
5
5
  [![windows](https://github.com/shugo/textbringer/workflows/windows/badge.svg)](https://github.com/shugo/textbringer/actions?query=workflow%3Awindows)
6
6
  [![macos](https://github.com/shugo/textbringer/workflows/macos/badge.svg)](https://github.com/shugo/textbringer/actions?query=workflow%3Amacos)
7
- [![ruby-head](https://github.com/shugo/textbringer/workflows/ruby-head/badge.svg)](https://github.com/shugo/textbringer/actions?query=workflow%3Aruby-head)
8
7
  [![codecov](https://codecov.io/gh/shugo/textbringer/branch/master/graph/badge.svg)](https://codecov.io/gh/shugo/textbringer)
9
8
 
10
9
  Textbringer is a member of a demon race that takes on the form of an Emacs-like
@@ -3,7 +3,7 @@
3
3
  module Textbringer
4
4
  module Commands
5
5
  define_command(:find_file, doc: "Open or create a file.") do
6
- |file_name = read_file_name("Find file: ")|
6
+ |file_name = read_file_name("Find file: ", default: (Buffer.current.file_name ? File.dirname(Buffer.current.file_name) : Dir.pwd) + "/")|
7
7
  config = EditorConfig.load_file(file_name)
8
8
  buffer = Buffer.find_file(file_name)
9
9
  if buffer.new_file?
@@ -86,12 +86,13 @@ module Commands
86
86
 
87
87
  define_command(:write_file,
88
88
  doc: "Save the current buffer as the specified file.") do
89
- |file_name = read_file_name("Write file: ")|
89
+ |file_name = read_file_name("Write file: ",
90
+ default: Buffer.current.file_name)|
90
91
  if File.directory?(file_name)
91
92
  file_name = File.expand_path(Buffer.current.name, file_name)
92
93
  end
93
94
  if File.exist?(file_name)
94
- unless y_or_n?("File `#{file_name}' exists; overwrite?")
95
+ unless y_or_n?("File exists; overwrite?")
95
96
  message("Cancelled")
96
97
  next
97
98
  end
@@ -21,27 +21,36 @@ def show_help
21
21
  end
22
22
  private :show_help
23
23
 
24
+ def keymap_bindings(keymap)
25
+ s = format("%-16s %s\n", "Key", "Binding")
26
+ s << format("%-16s %s\n", "---", "-------")
27
+ s << "\n"
28
+ keymap.each do |key_sequence, command|
29
+ if command != :self_insert
30
+ s << format("%-16s [%s]\n",
31
+ Keymap.key_sequence_string(key_sequence),
32
+ command)
33
+ end
34
+ end
35
+ s
36
+ end
37
+
24
38
  define_command(:describe_bindings,
25
39
  doc: "Display the key bindings.") do
26
40
  show_help do |help|
27
- s = format("%-16s %s\n", "Key", "Binding")
28
- s << format("%-16s %s\n", "---", "-------")
29
- s << "\n"
30
- bindings = {}
31
- [
32
- GLOBAL_MAP,
33
- Buffer.current.keymap,
34
- Controller.current.overriding_map
35
- ].each do |map|
36
- map&.each do |key_sequence, command|
37
- bindings[key_sequence] = command
38
- end
41
+ s = ""
42
+ if Controller.current.overriding_map
43
+ s << "Overriding Bindings:\n"
44
+ s << keymap_bindings(Controller.current.overriding_map)
45
+ s << "\n"
39
46
  end
40
- bindings.each do |key_sequence, command|
41
- s << format("%-16s [%s]\n",
42
- Keymap.key_sequence_string(key_sequence),
43
- command)
47
+ if Buffer.current.keymap
48
+ s << "Current Buffer Bindings:\n"
49
+ s << keymap_bindings(Buffer.current.keymap)
50
+ s << "\n"
44
51
  end
52
+ s << "Global Bindings:\n"
53
+ s << keymap_bindings(GLOBAL_MAP)
45
54
  help.insert(s)
46
55
  end
47
56
  push_help_command([:describe_bindings])
@@ -276,7 +276,7 @@ def goto_global_mark
276
276
  Window.redisplay
277
277
  signals = [:INT, :TERM, :KILL]
278
278
  begin
279
- opts = /mswin32|mingw32/ =~ RUBY_PLATFORM ? {} : {pgroup: true}
279
+ opts = /mswin|mingw/ =~ RUBY_PLATFORM ? {} : {pgroup: true}
280
280
  if CONFIG[:shell_file_name]
281
281
  cmd = [CONFIG[:shell_file_name], CONFIG[:shell_command_switch], cmd]
282
282
  end
@@ -108,7 +108,7 @@ def show_exception(e)
108
108
  if e.is_a?(SystemExit) || e.is_a?(SignalException)
109
109
  raise
110
110
  end
111
- if Buffer.current&.name != "*Backtrace*"
111
+ if !e.is_a?(Quit) && Buffer.current&.name != "*Backtrace*"
112
112
  buffer = Buffer.find_or_new("*Backtrace*", undo_limit: 0)
113
113
  if !buffer.mode.is_a?(BacktraceMode)
114
114
  buffer.apply_mode(BacktraceMode)
@@ -316,8 +316,8 @@ def read_key_sequence(prompt)
316
316
 
317
317
  HOOKS = Hash.new { |h, k| h[k] = [] }
318
318
 
319
- def add_hook(name, func = Proc.new)
320
- HOOKS[name].unshift(func)
319
+ def add_hook(name, func = nil, &block)
320
+ HOOKS[name].unshift(func || block)
321
321
  end
322
322
 
323
323
  def remove_hook(name, func)
@@ -1,3 +1,3 @@
1
1
  module Textbringer
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -455,7 +455,11 @@ def redisplay
455
455
  end
456
456
  end
457
457
  end
458
- @window.addstr(c)
458
+ if c == "\uFEFF"
459
+ # ncurses on macOS prints U+FEFF as space, so ignore it
460
+ else
461
+ @window.addstr(c)
462
+ end
459
463
  break if newx == columns && cury == lines - 2
460
464
  @buffer.forward_char
461
465
  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.0.4
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: 2020-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -178,7 +178,6 @@ files:
178
178
  - ".editorconfig"
179
179
  - ".gitattributes"
180
180
  - ".github/workflows/macos.yml"
181
- - ".github/workflows/ruby-head.yml"
182
181
  - ".github/workflows/ubuntu.yml"
183
182
  - ".github/workflows/windows.yml"
184
183
  - ".gitignore"
@@ -238,7 +237,7 @@ homepage: https://github.com/shugo/textbringer
238
237
  licenses:
239
238
  - MIT
240
239
  metadata: {}
241
- post_install_message:
240
+ post_install_message:
242
241
  rdoc_options: []
243
242
  require_paths:
244
243
  - lib
@@ -253,8 +252,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
252
  - !ruby/object:Gem::Version
254
253
  version: '0'
255
254
  requirements: []
256
- rubygems_version: 3.2.0.pre1
257
- signing_key:
255
+ rubygems_version: 3.2.3
256
+ signing_key:
258
257
  specification_version: 4
259
258
  summary: An Emacs-like text editor
260
259
  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}}