textbringer 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acc31bc853df5cf7a60816b8b22397e96eea7aa3
4
- data.tar.gz: '058c53153c9645dfe51c7aaf9112e0a9ef27e5b5'
3
+ metadata.gz: b377f0a0be9ac761f63bafbc0db3798e14eefecc
4
+ data.tar.gz: ff3014ee193c52e2be1b028210e8024c0c10f708
5
5
  SHA512:
6
- metadata.gz: 6d66c3c3fefd66a2ac7b669c24216a77a627b9265ca93d3ac9d3ed4321b6dbc3433ab70bd6b1a675e740dad40ad684f84579bd8f81d57a238fc16412fb913fad
7
- data.tar.gz: 8d9b9c1cb9717ad7da44786b46be1033e85017eb5f42a06cff89b83d81813ca4c4a147e2c7d03b366ddf885022dd81453b8905ec84d49e4e9005d8cb110cda0f
6
+ metadata.gz: 5928dac977797697ebe072e51fa09fbc892b4e581a5197411cc70d32b9eee8615645d34a62bba7fc11e2e99cab71a63c1c8224083ee6f5b4cd411404423418b4
7
+ data.tar.gz: 6895b2ad1f81511cf742aa472bb58b60d4785923de48ce1c68750915b39b6911ec80afc30dcec3fd09e0dcc142060840bfb7045bebc3aad27681fa378f8cc195
data/README.md CHANGED
@@ -15,7 +15,7 @@ editor.
15
15
 
16
16
  ## Usage
17
17
 
18
- $ tb
18
+ $ textbringer
19
19
 
20
20
  You can quit the editor by C-x C-c.
21
21
 
File without changes
@@ -374,6 +374,14 @@ module Textbringer
374
374
  end
375
375
  end
376
376
 
377
+ def byte_before(location = @point)
378
+ if location <= point_min || location > point_max
379
+ nil
380
+ else
381
+ byte_after(location - 1)
382
+ end
383
+ end
384
+
377
385
  def char_after(location = @point)
378
386
  if @binary
379
387
  byte_after(location)
@@ -598,7 +606,7 @@ module Textbringer
598
606
  end_of_line
599
607
  forward_char
600
608
  s = @point
601
- while !end_of_buffer? && byte_after != "\n" &&
609
+ while !end_of_line? &&
602
610
  Buffer.display_width(substring(s, @point)) < column
603
611
  forward_char
604
612
  end
@@ -619,7 +627,7 @@ module Textbringer
619
627
  backward_char
620
628
  beginning_of_line
621
629
  s = @point
622
- while !end_of_buffer? && byte_after != "\n" &&
630
+ while !end_of_line? &&
623
631
  Buffer.display_width(substring(s, @point)) < column
624
632
  forward_char
625
633
  end
@@ -648,21 +656,27 @@ module Textbringer
648
656
  end
649
657
 
650
658
  def beginning_of_line
651
- while !beginning_of_buffer? &&
652
- byte_after(@point - 1) != "\n"
659
+ while !beginning_of_line?
653
660
  backward_char
654
661
  end
655
662
  @point
656
663
  end
657
664
 
665
+ def beginning_of_line?
666
+ beginning_of_buffer? || byte_before == "\n"
667
+ end
668
+
658
669
  def end_of_line
659
- while !end_of_buffer? &&
660
- byte_after(@point) != "\n"
670
+ while !end_of_line?
661
671
  forward_char
662
672
  end
663
673
  @point
664
674
  end
665
675
 
676
+ def end_of_line?
677
+ end_of_buffer? || byte_after == "\n"
678
+ end
679
+
666
680
  def new_mark(location = @point)
667
681
  Mark.new(self, location).tap { |m|
668
682
  @marks << m
@@ -1034,7 +1048,7 @@ module Textbringer
1034
1048
  end
1035
1049
 
1036
1050
  def transpose_chars
1037
- if end_of_buffer? || char_after == "\n"
1051
+ if end_of_line?
1038
1052
  backward_char
1039
1053
  end
1040
1054
  if beginning_of_buffer?
@@ -636,7 +636,7 @@ module Textbringer
636
636
  Window.redisplay
637
637
  signals = [:INT, :TERM, :KILL]
638
638
  begin
639
- Open3.popen2e(cmd) do |input, output, wait_thread|
639
+ Open3.popen2e(cmd, pgroup: true) do |input, output, wait_thread|
640
640
  input.close
641
641
  loop do
642
642
  status = output.wait_readable(0.5)
@@ -660,7 +660,7 @@ module Textbringer
660
660
  else
661
661
  sig = signals.shift
662
662
  message("Send #{sig} to #{wait_thread.pid}")
663
- Process.kill(sig, wait_thread.pid)
663
+ Process.kill(sig, -wait_thread.pid)
664
664
  end
665
665
  end
666
666
  end
@@ -121,6 +121,7 @@ module Textbringer
121
121
  GLOBAL_MAP.define_key(?\C-g, :keyboard_quit)
122
122
  GLOBAL_MAP.define_key(?\C-s, :isearch_forward)
123
123
  GLOBAL_MAP.define_key(?\C-r, :isearch_backward)
124
+ GLOBAL_MAP.define_key("\e!", :shell_execute)
124
125
  GLOBAL_MAP.handle_undefined_key do |key|
125
126
  if key.is_a?(Integer) && key > 0x80
126
127
  begin
@@ -1,3 +1,3 @@
1
1
  module Textbringer
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/textbringer.gemspec CHANGED
@@ -19,6 +19,8 @@ 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.3'
23
+
22
24
  spec.add_runtime_dependency "ncursesw", "~> 1.4"
23
25
  spec.add_runtime_dependency "unicode-display_width", "~> 1.1"
24
26
 
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: 0.1.0
4
+ version: 0.1.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: 2017-01-21 00:00:00.000000000 Z
11
+ date: 2017-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ncursesw
@@ -113,7 +113,7 @@ description: Textbringer is a member of a demon race that takes on the form of a
113
113
  email:
114
114
  - shugo@ruby-lang.org
115
115
  executables:
116
- - tb
116
+ - textbringer
117
117
  extensions: []
118
118
  extra_rdoc_files: []
119
119
  files:
@@ -125,7 +125,7 @@ files:
125
125
  - README.md
126
126
  - Rakefile
127
127
  - bin/console
128
- - exe/tb
128
+ - exe/textbringer
129
129
  - lib/textbringer.rb
130
130
  - lib/textbringer/buffer.rb
131
131
  - lib/textbringer/commands.rb
@@ -155,7 +155,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - ">="
157
157
  - !ruby/object:Gem::Version
158
- version: '0'
158
+ version: '2.3'
159
159
  required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  requirements:
161
161
  - - ">="