ifilter 0.2.2 → 0.2.3
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/lib/ifilter.rb +1 -0
- data/lib/ifilter/client.rb +4 -2
- data/lib/ifilter/input.rb +6 -0
- data/lib/ifilter/monospaced_string.rb +7 -0
- data/lib/ifilter/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01696dcf09c5878f8c3ec8a42507fb0cbe5c4509
|
4
|
+
data.tar.gz: 6537d31ec9da4eb91613e65bf61cb88903f57338
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 168780c7facb09fae521aa83f92cb35cb785cee7114ad2339830ab5b92fd1407718d1fcac7204264b3e4bdcc61d06ad6575c60e40a7861c170b932c36d57a0b6
|
7
|
+
data.tar.gz: 9f9eb1baf566ff3b2e582683171c8bcd56e67b08487f26c2493863edbff864781784e02c653c24b9f60ac92e3ab569ebf045dd4efcfdf5494ebecad1f298ea8c
|
data/lib/ifilter.rb
CHANGED
data/lib/ifilter/client.rb
CHANGED
@@ -2,6 +2,8 @@ require 'curses'
|
|
2
2
|
|
3
3
|
module Ifilter
|
4
4
|
class Client
|
5
|
+
using MonospacedString
|
6
|
+
|
5
7
|
def initialize(name)
|
6
8
|
@prompt = "#{name}> "
|
7
9
|
@target = []
|
@@ -100,7 +102,7 @@ module Ifilter
|
|
100
102
|
@window << match_string
|
101
103
|
@window.attrunset(Curses.color_pair(3))
|
102
104
|
|
103
|
-
@window << word[match_pos + match_string.
|
105
|
+
@window << word[match_pos + match_string.monospaced_bytesize, (@window.maxx - 1) - (match_pos + @input.monospaced_bytesize)]
|
104
106
|
else
|
105
107
|
@window << word[0, @window.maxx - 1]
|
106
108
|
end
|
@@ -114,7 +116,7 @@ module Ifilter
|
|
114
116
|
@window.setpos(0, @window.maxx)
|
115
117
|
|
116
118
|
word = "[#{@page_number}/#{max_page_number.zero? ? 1 : max_page_number}]"
|
117
|
-
@window << (' ' * (@window.maxx - @prompt.
|
119
|
+
@window << (' ' * (@window.maxx - @prompt.monospaced_bytesize - @input.monospaced_bytesize - word.monospaced_bytesize)) + word
|
118
120
|
end
|
119
121
|
|
120
122
|
def up_cursor_position
|
data/lib/ifilter/input.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Ifilter
|
2
2
|
class Input
|
3
|
+
using MonospacedString
|
4
|
+
|
3
5
|
attr_accessor :text
|
4
6
|
|
5
7
|
def initialize(text = '')
|
@@ -14,6 +16,10 @@ module Ifilter
|
|
14
16
|
@text.size
|
15
17
|
end
|
16
18
|
|
19
|
+
def monospaced_bytesize
|
20
|
+
@text.monospaced_bytesize
|
21
|
+
end
|
22
|
+
|
17
23
|
def backspace!
|
18
24
|
@text.chop!
|
19
25
|
end
|
data/lib/ifilter/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ifilter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaihar4
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- lib/ifilter.rb
|
115
115
|
- lib/ifilter/client.rb
|
116
116
|
- lib/ifilter/input.rb
|
117
|
+
- lib/ifilter/monospaced_string.rb
|
117
118
|
- lib/ifilter/version.rb
|
118
119
|
- lib/ifilter/window.rb
|
119
120
|
homepage: https://github.com/kaihar4/ifilter
|