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 +4 -4
- data/.github/workflows/ubuntu.yml +5 -6
- data/.github/workflows/windows.yml +4 -7
- data/CHANGES.md +5 -0
- data/README.md +0 -1
- data/lib/textbringer/commands/files.rb +4 -3
- data/lib/textbringer/commands/help.rb +25 -16
- data/lib/textbringer/commands/misc.rb +1 -1
- data/lib/textbringer/utils.rb +3 -3
- data/lib/textbringer/version.rb +1 -1
- data/lib/textbringer/window.rb +5 -1
- metadata +6 -7
- data/.github/workflows/ruby-head.yml +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cadae924b2e85758480d58a7f4ba6ff48fc6ac1971039159a8b81a1a0bbbd29
|
4
|
+
data.tar.gz: cb981c7fb394e1c4683cd1365f5da1ed1f372c4254d3e9d8ca5782cad18cf167
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
7
|
-
runs-on: ubuntu-latest
|
6
|
+
test:
|
8
7
|
strategy:
|
9
8
|
matrix:
|
10
|
-
ruby: [
|
9
|
+
ruby: [ head, 2.7, 2.6, 2.5, 2.4 ]
|
10
|
+
runs-on: ubuntu-latest
|
11
11
|
steps:
|
12
|
-
- uses: actions/checkout@
|
13
|
-
-
|
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.
|
10
|
+
ruby: [ 'mingw', 'mswin', '2.7', '2.6', '2.5' ]
|
11
11
|
steps:
|
12
|
-
- uses: actions/checkout@
|
12
|
+
- uses: actions/checkout@v2
|
13
13
|
- name: Set up Ruby
|
14
|
-
uses:
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
15
|
with:
|
16
16
|
ruby-version: ${{ matrix.ruby }}
|
17
|
-
|
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
data/README.md
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
[](https://github.com/shugo/textbringer/actions?query=workflow%3Aubuntu)
|
5
5
|
[](https://github.com/shugo/textbringer/actions?query=workflow%3Awindows)
|
6
6
|
[](https://github.com/shugo/textbringer/actions?query=workflow%3Amacos)
|
7
|
-
[](https://github.com/shugo/textbringer/actions?query=workflow%3Aruby-head)
|
8
7
|
[](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
|
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 =
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
41
|
-
s <<
|
42
|
-
|
43
|
-
|
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 = /
|
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
|
data/lib/textbringer/utils.rb
CHANGED
@@ -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 =
|
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)
|
data/lib/textbringer/version.rb
CHANGED
data/lib/textbringer/window.rb
CHANGED
@@ -455,7 +455,11 @@ def redisplay
|
|
455
455
|
end
|
456
456
|
end
|
457
457
|
end
|
458
|
-
|
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.
|
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-
|
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.
|
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}}
|