textbringer 1.0.0 → 1.0.1
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/.gitattributes +1 -0
- data/.github/workflows/macos.yml +15 -0
- data/.github/workflows/ruby-head.yml +30 -0
- data/.github/workflows/ubuntu.yml +26 -0
- data/.github/workflows/windows.yml +22 -0
- data/CHANGES.md +5 -0
- data/README.md +4 -7
- data/lib/textbringer.rb +0 -2
- data/lib/textbringer/buffer.rb +4 -6
- data/lib/textbringer/color.rb +0 -2
- data/lib/textbringer/commands.rb +0 -2
- data/lib/textbringer/commands/buffers.rb +0 -2
- data/lib/textbringer/commands/clipboard.rb +0 -2
- data/lib/textbringer/commands/ctags.rb +0 -2
- data/lib/textbringer/commands/dabbrev.rb +0 -2
- data/lib/textbringer/commands/files.rb +0 -2
- data/lib/textbringer/commands/fill.rb +1 -1
- data/lib/textbringer/commands/help.rb +0 -2
- data/lib/textbringer/commands/isearch.rb +0 -2
- data/lib/textbringer/commands/keyboard_macro.rb +0 -2
- data/lib/textbringer/commands/misc.rb +0 -2
- data/lib/textbringer/commands/register.rb +0 -2
- data/lib/textbringer/commands/replace.rb +0 -2
- data/lib/textbringer/commands/server.rb +0 -2
- data/lib/textbringer/commands/windows.rb +0 -2
- data/lib/textbringer/config.rb +0 -2
- data/lib/textbringer/controller.rb +0 -2
- data/lib/textbringer/errors.rb +0 -2
- data/lib/textbringer/face.rb +0 -2
- data/lib/textbringer/faces/basic.rb +0 -2
- data/lib/textbringer/faces/programming.rb +0 -2
- data/lib/textbringer/keymap.rb +0 -2
- data/lib/textbringer/mode.rb +0 -2
- data/lib/textbringer/modes/backtrace_mode.rb +0 -2
- data/lib/textbringer/modes/buffer_list_mode.rb +0 -2
- data/lib/textbringer/modes/c_mode.rb +0 -2
- data/lib/textbringer/modes/completion_list_mode.rb +0 -2
- data/lib/textbringer/modes/fundamental_mode.rb +0 -2
- data/lib/textbringer/modes/help_mode.rb +0 -2
- data/lib/textbringer/modes/programming_mode.rb +1 -3
- data/lib/textbringer/modes/ruby_mode.rb +5 -4
- data/lib/textbringer/plugin.rb +0 -2
- data/lib/textbringer/ring.rb +0 -2
- data/lib/textbringer/utils.rb +0 -2
- data/lib/textbringer/version.rb +1 -3
- data/lib/textbringer/window.rb +0 -2
- metadata +8 -5
- data/.travis.yml +0 -56
- data/appveyor.yml +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '009c68bcdc928faff20b7ca1b75f92b21641dc6d29e392a05a279267418983d1'
|
4
|
+
data.tar.gz: cad85dfebd2dc1b70cdbf9212bcda296bcde8204e529b0d82ce1663434a05d4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4923385439037b9ce5aa099a029f9ca6a3bc87205f85a74febaf165c3e512501303ad25c86cdc73191bf1fcd9cf9faa15b9633996bd1efdc69bb231fba781afe
|
7
|
+
data.tar.gz: 9a624d55143b47100a6fc9a538d29c9f1151d7c6c38d3fdb4865739fd8d2b7a9c76bda2f8a29a6921ddc9e9e8cd8e5c73f1c25031fc9244e81da3547946559a4
|
data/.gitattributes
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.rb diff=ruby
|
@@ -0,0 +1,15 @@
|
|
1
|
+
name: macos
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: macos-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@master
|
10
|
+
- name: Install dependencies
|
11
|
+
run: |
|
12
|
+
gem install bundler --no-document
|
13
|
+
bundle install
|
14
|
+
- name: Run test
|
15
|
+
run: bundle exec rake test
|
@@ -0,0 +1,30 @@
|
|
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}}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: ubuntu
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [ '2.6.x', '2.5.x', '2.4.x' ]
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@master
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: actions/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: ${{ matrix.ruby }}
|
17
|
+
- name: Install dependencies
|
18
|
+
run: |
|
19
|
+
sudo apt install libncursesw5-dev
|
20
|
+
gem install bundler --no-document
|
21
|
+
bundle install
|
22
|
+
- name: Run test
|
23
|
+
run: xvfb-run bundle exec rake test
|
24
|
+
env:
|
25
|
+
UPLOAD_TO_CODECOV: 1
|
26
|
+
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: windows
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: windows-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [ '2.6.x', '2.5.x', '2.4.x' ]
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@master
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: actions/setup-ruby@v1
|
15
|
+
with:
|
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
|
21
|
+
- name: Run test
|
22
|
+
run: bundle exec rake test
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# 
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/textbringer)
|
4
|
-
[](https://github.com/shugo/textbringer/actions?query=workflow%3Aubuntu)
|
5
|
+
[](https://github.com/shugo/textbringer/actions?query=workflow%3Awindows)
|
6
|
+
[](https://github.com/shugo/textbringer/actions?query=workflow%3Amacos)
|
7
|
+
[](https://github.com/shugo/textbringer/actions?query=workflow%3Aruby-head)
|
6
8
|
[](https://codecov.io/gh/shugo/textbringer)
|
7
9
|
|
8
10
|
Textbringer is a member of a demon race that takes on the form of an Emacs-like
|
@@ -107,8 +109,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/shugo/
|
|
107
109
|
## License
|
108
110
|
|
109
111
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
110
|
-
|
111
|
-
|
112
|
-
## Credit
|
113
|
-
|
114
|
-
Logo made with [DesignEvo](https://www.designevo.com/en/).
|
data/lib/textbringer.rb
CHANGED
data/lib/textbringer/buffer.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
require "nkf"
|
4
2
|
require "unicode/display_width"
|
5
3
|
require "json"
|
@@ -524,7 +522,7 @@ def goto_char(pos)
|
|
524
522
|
if pos < 0 || pos > size
|
525
523
|
raise RangeError, "Out of buffer"
|
526
524
|
end
|
527
|
-
if !@binary && /[\x80-\xbf]/n
|
525
|
+
if !@binary && byte_after(pos)&.match?(/[\x80-\xbf]/n)
|
528
526
|
raise ArgumentError, "Position is in the middle of a character"
|
529
527
|
end
|
530
528
|
@goal_column = nil
|
@@ -578,12 +576,12 @@ def insert(x, merge_undo = false)
|
|
578
576
|
|
579
577
|
def newline
|
580
578
|
indentation = save_point { |saved|
|
581
|
-
if /[ \t]
|
579
|
+
if char_after&.match?(/[ \t]/)
|
582
580
|
next ""
|
583
581
|
end
|
584
582
|
beginning_of_line
|
585
583
|
s = @point
|
586
|
-
while /[ \t]
|
584
|
+
while char_after&.match?(/[ \t]/)
|
587
585
|
forward_char
|
588
586
|
end
|
589
587
|
str = substring(s, @point)
|
@@ -1247,7 +1245,7 @@ def transpose_chars
|
|
1247
1245
|
end
|
1248
1246
|
|
1249
1247
|
def gap_filled_with_nul?
|
1250
|
-
|
1248
|
+
@contents[@gap_start...@gap_end]&.match?(/\A\0*\z/)
|
1251
1249
|
end
|
1252
1250
|
|
1253
1251
|
def composite_edit
|
data/lib/textbringer/color.rb
CHANGED
data/lib/textbringer/commands.rb
CHANGED
data/lib/textbringer/config.rb
CHANGED
data/lib/textbringer/errors.rb
CHANGED
data/lib/textbringer/face.rb
CHANGED
data/lib/textbringer/keymap.rb
CHANGED
data/lib/textbringer/mode.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
module Textbringer
|
4
2
|
class ProgrammingMode < FundamentalMode
|
5
3
|
# abstract mode
|
@@ -32,7 +30,7 @@ def initialize(buffer)
|
|
32
30
|
def indent_line
|
33
31
|
result = false
|
34
32
|
level = calculate_indentation
|
35
|
-
return result if level.nil?
|
33
|
+
return result if level.nil? || level < 0
|
36
34
|
@buffer.save_excursion do
|
37
35
|
@buffer.beginning_of_line
|
38
36
|
@buffer.composite_edit do
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
require "ripper"
|
4
2
|
|
5
3
|
module Textbringer
|
@@ -175,7 +173,7 @@ def toggle_test
|
|
175
173
|
|
176
174
|
private
|
177
175
|
|
178
|
-
INDENT_BEG_RE = /^([ \t]*)(
|
176
|
+
INDENT_BEG_RE = /^([ \t]*)(class|module|def|if|unless|case|while|until|for|begin|end)\b/
|
179
177
|
|
180
178
|
def space_width(s)
|
181
179
|
s.gsub(/\t/, " " * @buffer[:tab_width]).size
|
@@ -209,6 +207,9 @@ def calculate_indentation
|
|
209
207
|
start_line = @buffer.current_line
|
210
208
|
tokens = Ripper.lex(@buffer.substring(start_pos, bol_pos))
|
211
209
|
_, event, text = tokens.last
|
210
|
+
if event == :on_nl
|
211
|
+
_, event, text = tokens[-2]
|
212
|
+
end
|
212
213
|
if event == :on_tstring_beg ||
|
213
214
|
event == :on_heredoc_beg ||
|
214
215
|
event == :on_regexp_beg ||
|
@@ -243,7 +244,7 @@ def calculate_indentation
|
|
243
244
|
else
|
244
245
|
indentation = base_indentation + @buffer[:indent_level]
|
245
246
|
end
|
246
|
-
if @buffer.looking_at?(/[ \t]*([}\])]|(end|else|elsif|when|rescue|ensure)\b)/)
|
247
|
+
if @buffer.looking_at?(/[ \t]*([}\])]|(end|else|elsif|when|in|rescue|ensure)\b)/)
|
247
248
|
indentation -= @buffer[:indent_level]
|
248
249
|
end
|
249
250
|
_, last_event, last_text = tokens.reverse_each.find { |_, e, _|
|
data/lib/textbringer/plugin.rb
CHANGED
data/lib/textbringer/ring.rb
CHANGED
data/lib/textbringer/utils.rb
CHANGED
data/lib/textbringer/version.rb
CHANGED
data/lib/textbringer/window.rb
CHANGED
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shugo Maeda
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|
@@ -176,14 +176,17 @@ extensions: []
|
|
176
176
|
extra_rdoc_files: []
|
177
177
|
files:
|
178
178
|
- ".editorconfig"
|
179
|
+
- ".gitattributes"
|
180
|
+
- ".github/workflows/macos.yml"
|
181
|
+
- ".github/workflows/ruby-head.yml"
|
182
|
+
- ".github/workflows/ubuntu.yml"
|
183
|
+
- ".github/workflows/windows.yml"
|
179
184
|
- ".gitignore"
|
180
|
-
- ".travis.yml"
|
181
185
|
- CHANGES.md
|
182
186
|
- Gemfile
|
183
187
|
- LICENSE.txt
|
184
188
|
- README.md
|
185
189
|
- Rakefile
|
186
|
-
- appveyor.yml
|
187
190
|
- bin/console
|
188
191
|
- exe/tbclient
|
189
192
|
- exe/tbtags
|
@@ -250,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
250
253
|
- !ruby/object:Gem::Version
|
251
254
|
version: '0'
|
252
255
|
requirements: []
|
253
|
-
rubygems_version: 3.1.0.
|
256
|
+
rubygems_version: 3.1.0.pre2
|
254
257
|
signing_key:
|
255
258
|
specification_version: 4
|
256
259
|
summary: An Emacs-like text editor
|
data/.travis.yml
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
matrix:
|
3
|
-
include:
|
4
|
-
- os: linux
|
5
|
-
dist: trusty
|
6
|
-
sudo: false
|
7
|
-
rvm: 2.4.5
|
8
|
-
- os: linux
|
9
|
-
dist: trusty
|
10
|
-
sudo: false
|
11
|
-
rvm: 2.5.2
|
12
|
-
- os: linux
|
13
|
-
dist: trusty
|
14
|
-
sudo: false
|
15
|
-
rvm: 2.6.0
|
16
|
-
- os: linux
|
17
|
-
dist: trusty
|
18
|
-
sudo: false
|
19
|
-
rvm: ruby-head
|
20
|
-
- os: osx
|
21
|
-
osx_image: xcode8.2
|
22
|
-
rvm: 2.4.5
|
23
|
-
- os: osx
|
24
|
-
osx_image: xcode8.2
|
25
|
-
rvm: 2.5.2
|
26
|
-
- os: osx
|
27
|
-
osx_image: xcode8.2
|
28
|
-
rvm: 2.6.0
|
29
|
-
- os: osx
|
30
|
-
osx_image: xcode8.2
|
31
|
-
rvm: ruby-head
|
32
|
-
allow_failures:
|
33
|
-
- os: osx
|
34
|
-
- rvm: ruby-head
|
35
|
-
fast_finish: true
|
36
|
-
cache: bundler
|
37
|
-
before_install:
|
38
|
-
- gem update --system
|
39
|
-
- gem install bundler-audit
|
40
|
-
script:
|
41
|
-
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
42
|
-
xvfb-run bundle exec rake test;
|
43
|
-
else
|
44
|
-
bundle exec rake test;
|
45
|
-
fi
|
46
|
-
env:
|
47
|
-
global:
|
48
|
-
UPLOAD_TO_CODECOV: 1
|
49
|
-
notifications:
|
50
|
-
email:
|
51
|
-
on_success: never
|
52
|
-
on_failure: always
|
53
|
-
addons:
|
54
|
-
apt:
|
55
|
-
packages:
|
56
|
-
- xclip
|
data/appveyor.yml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
---
|
2
|
-
clone_depth: 10
|
3
|
-
install:
|
4
|
-
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
|
5
|
-
- bundle install
|
6
|
-
- ps: '[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12'
|
7
|
-
- ps: Invoke-WebRequest -Uri https://curl.haxx.se/ca/cacert.pem -OutFile C:\projects\textbringer\cacert.pem
|
8
|
-
build: off
|
9
|
-
test_script:
|
10
|
-
- rake
|
11
|
-
deploy: off
|
12
|
-
environment:
|
13
|
-
UPLOAD_TO_CODECOV: 1
|
14
|
-
SSL_CERT_FILE: C:\projects\textbringer\cacert.pem
|
15
|
-
matrix:
|
16
|
-
- ruby_version: "24"
|
17
|
-
- ruby_version: "24-x64"
|
18
|
-
- ruby_version: "25"
|
19
|
-
- ruby_version: "25-x64"
|