console 0.4 → 0.5
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.
- data/ext/console/console.c +7 -4
- metadata +37 -27
data/ext/console/console.c
CHANGED
@@ -31,11 +31,14 @@ static inline int calc_width(char* string, long strlen, long byte_offset, size_t
|
|
31
31
|
return -1;
|
32
32
|
}
|
33
33
|
else if(*num_bytes == 0) {
|
34
|
-
rb_raise(rb_eArgError, "malformed string: NULL byte at position %ld", byte_offset);
|
35
|
-
|
34
|
+
//rb_raise(rb_eArgError, "malformed string: NULL byte at position %ld", byte_offset);
|
35
|
+
// it's fine to have a NULL byte. forge ahead!
|
36
|
+
*num_bytes = 1;
|
37
|
+
*num_cols = 0;
|
38
|
+
}
|
39
|
+
else {
|
40
|
+
*num_cols = wcwidth(wc);
|
36
41
|
}
|
37
|
-
|
38
|
-
*num_cols = wcwidth(wc);
|
39
42
|
|
40
43
|
return 0;
|
41
44
|
}
|
metadata
CHANGED
@@ -1,32 +1,33 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: console
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 5
|
9
|
+
version: "0.5"
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- William Morgan
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
16
|
+
|
17
|
+
date: 2011-06-27 20:12:30 -07:00
|
13
18
|
default_executable:
|
14
19
|
dependencies: []
|
15
|
-
|
16
|
-
|
17
|
-
(e.g. ASCII) characters and know how much horizontal realestate the result takes
|
18
|
-
on the screen. This is generally necessary when you want to have internationalization
|
19
|
-
support in a console-based program. Console currently provides utility methods for
|
20
|
-
determining the display width of a string, and for taking a substring based on display
|
21
|
-
position and display width.
|
20
|
+
|
21
|
+
description: Console is a helper class for displaying super-ASCII strings on the console. Console is needed when you want to mix two-column (e.g. Chinese) and single-column (e.g. ASCII) characters and know how much horizontal realestate the result takes on the screen. This is generally necessary when you want to have internationalization support in a console-based program. Console currently provides utility methods for determining the display width of a string, and for taking a substring based on display position and display width.
|
22
22
|
email: wmorgan-console@masanjin.net
|
23
23
|
executables: []
|
24
|
-
|
24
|
+
|
25
|
+
extensions:
|
25
26
|
- ext/console/extconf.rb
|
26
|
-
extra_rdoc_files:
|
27
|
+
extra_rdoc_files:
|
27
28
|
- README
|
28
29
|
- ext/console/console.c
|
29
|
-
files:
|
30
|
+
files:
|
30
31
|
- README
|
31
32
|
- ext/console/extconf.rb
|
32
33
|
- ext/console/console.c
|
@@ -35,28 +36,37 @@ files:
|
|
35
36
|
has_rdoc: true
|
36
37
|
homepage: http://masanjin.net/console
|
37
38
|
licenses: []
|
39
|
+
|
38
40
|
post_install_message:
|
39
|
-
rdoc_options:
|
41
|
+
rdoc_options:
|
40
42
|
- -c
|
41
43
|
- utf8
|
42
|
-
require_paths:
|
44
|
+
require_paths:
|
43
45
|
- lib
|
44
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
47
|
none: false
|
46
|
-
requirements:
|
47
|
-
- -
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
|
50
|
-
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
hash: 3
|
52
|
+
segments:
|
53
|
+
- 0
|
54
|
+
version: "0"
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
56
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
56
64
|
requirements: []
|
65
|
+
|
57
66
|
rubyforge_project:
|
58
67
|
rubygems_version: 1.6.0
|
59
68
|
signing_key:
|
60
69
|
specification_version: 3
|
61
70
|
summary: Console is a helper for properly handling super-ASCII strings on the console.
|
62
71
|
test_files: []
|
72
|
+
|