dynamic_curses_input 1.1.0 → 1.2.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
  SHA256:
3
- metadata.gz: 9c428601614e3ac70ef3fcbf32e47f08c630e41fee379ac070042615d22247a2
4
- data.tar.gz: 6cb43128ee6336bbf5f8b86aa870b9ac106c0a965f684c4e55c2f3cf3ee1679c
3
+ metadata.gz: abd6d9170839e5a4e3c3612c28bdd38ed289a6bd608f05babd9b2c7aa64187be
4
+ data.tar.gz: 7399a896660df0ffd778e420d465a5ef9b51e6086790a632e3627c4f68091744
5
5
  SHA512:
6
- metadata.gz: 9cc2ecdbac0dd45a134b373e74f10dddfed6dd906cd61e53ea706886e47a2fe02323a4a8f95667e8a03863f5c1d74b3887cf95a346609db83880b659ca86769a
7
- data.tar.gz: f6df58e040695ae079a1d231ccf85ce01b080e06644c398e31946f50b691c4e841bed51af4252392af855b173aba709ed49612b15b7c4a9716d14924d7c3fa0f
6
+ metadata.gz: e4b6155144005e614681ca2643ceb585a20f726530fd3df7f832aa743e904c9075a0187c600c0f23ccfb35daf80b887f49e39174a6ede1b2b72ed71dc047842e
7
+ data.tar.gz: 5eb5070443e66adc6b431f0a31a703aadeecedfc264db73041ff0192c18914c39e923b917f16cf74133322a29e00233503d4201217a7e2ce90347e3ed41c9d0b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dynamic_curses_input (1.0.1.1)
4
+ dynamic_curses_input (1.1.0)
5
5
  curses
6
6
  reline
7
7
 
@@ -21,9 +21,9 @@ GEM
21
21
  rainbow (3.1.1)
22
22
  rake (13.0.6)
23
23
  regexp_parser (2.8.1)
24
- reline (0.3.6)
24
+ reline (0.3.7)
25
25
  io-console (~> 0.5)
26
- rexml (3.2.5)
26
+ rexml (3.2.6)
27
27
  rubocop (1.55.0)
28
28
  json (~> 2.3)
29
29
  language_server-protocol (>= 3.17.0)
data/LICENSE ADDED
@@ -0,0 +1,71 @@
1
+ PixelRidge Business Exclusive General Public Use License for Software Executables (PixelRidge-BEGPULSE)
2
+
3
+ ## Version 1.2
4
+
5
+ ### Preamble
6
+
7
+ This License governs the terms under which the software ("Software") provided by PixelRidge Softworks ("Licensor") may be used, modified, and distributed.
8
+
9
+ ### 1. Definitions
10
+
11
+ - **Software**: The original software and associated documentation provided under this license.
12
+ - **Business Purposes**: Any activity designed with the main intent to generate revenue or profit.
13
+ - **Modification**: Any change or addition to the Software's source code or executable.
14
+ - **Distribution**: The act of making the Software available to third parties.
15
+ - **Contributor**: Any individual or entity that modifies or distributes the Software.
16
+
17
+ ### 2. License Grant
18
+
19
+ Subject to the terms and conditions of this License, Licensor hereby grants you a worldwide, non-exclusive, non-transferable, non-sublicensable license to use and modify the Software.
20
+
21
+ ### 3. Attribution
22
+
23
+ You must provide proper attribution to the Licensor by including a plain-view backlink to the Licensor's website. This backlink must be easily visible to all users and not hidden under any circumstances.
24
+
25
+ ### 4. Business Use
26
+
27
+ If you wish to use the Software for Business Purposes, you must obtain written permission from PixelRidge Softworks. Failure to obtain such permission will result in a violation of this License.
28
+
29
+ ### 5. Indemnification
30
+
31
+ You agree to indemnify, defend, and hold harmless PixelRidge Softworks and its affiliates from and against any and all claims, damages, losses, liabilities, costs, and expenses arising out of or relating to your use or distribution of the Software.
32
+
33
+ ### 6. No Warranty and Limitation of Liability
34
+
35
+ The Software is provided "AS-IS," without any warranty of any kind, either express or implied. The Software is designed to be highly secure but will only be as secure as the system on which it is deployed. On an insecure system, the Software may exacerbate existing security issues. PixelRidge Softworks shall not be liable for any damages arising from the use of the Software.
36
+
37
+ ### 7. Updates and Versioning
38
+
39
+ PixelRidge Softworks may or may not provide updates to the Software in the future. There is no obligation to provide updates or support for the Software. The latest version of this License shall always be considered the governing terms. PixelRidge Softworks will provide reasonable notice in the event of a license change.
40
+
41
+ ### 8. Source Code Availability
42
+
43
+ Any modifications to the Software must remain open-source and source-available in their entirety.
44
+
45
+ ### 9. Compliance Monitoring
46
+
47
+ Compliance with this License may or may not be monitored by PixelRidge Softworks. You grant PixelRidge Softworks the right to monitor for compliance as it sees fit.
48
+
49
+ ### 10. Data Collection
50
+
51
+ If the Software collects any data, such data will be used in accordance with PixelRidge Softworks' privacy policy.
52
+
53
+ ### 11. Export Control
54
+
55
+ You agree not to use the Software in violation of any export laws or regulations.
56
+
57
+ ### 12. Termination and Revocation
58
+
59
+ This License will automatically terminate if you fail to comply with any of its terms or conditions. Revocation is allowed only in the event of a violation of this License.
60
+
61
+ ### 13. Dispute Resolution
62
+
63
+ Any disputes arising out of this License shall be resolved through arbitration in Alberta, Canada.
64
+
65
+ ### 14. Jurisdiction
66
+
67
+ This License shall be governed by the laws of Alberta, Canada.
68
+
69
+ ### 15. Miscellaneous
70
+
71
+ This License constitutes the entire agreement between you and PixelRidge Softworks concerning the Software. It may only be modified in writing, signed by both parties.
@@ -5,29 +5,34 @@ require_relative 'lib/dynamic_curses_input/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'dynamic_curses_input'
7
7
  spec.version = DynamicCursesInput::VERSION
8
- spec.authors = ['VetheonGames']
9
- spec.email = ['vetheon@pixelatedstudios.net']
8
+ spec.authors = ['PixelRidge-Softworks']
9
+ spec.email = ['connorc@pixelridgesoftworks.com']
10
10
 
11
11
  spec.summary = 'A simple library for making Curses TUI input more dynamic and user-friendly'
12
12
  spec.description = "Dynamic Curses Input is a highly simple, yet powerful gem that allows simple implementation of
13
13
  dynamic typing in curses TUI menus built in Ruby. For example, one can't simply use their arrow
14
- keys to navigate and edit inputs in Cursese TUI menus without adding a bunch of extra code to your
14
+ keys to navigate and edit inputs in Curses TUI menus without adding a bunch of extra code to your
15
15
  project to handle it. A lot of which can be tricky to handle. This gem eliminates the need for
16
16
  that code, by providing simple to use methods that allow developers to capture user input, while
17
17
  allowing the special keys to work as the average user would expect.
18
18
  IE: When you press the left arrow key, the cursor moves to the left and allows you to delete a
19
- character you entered that isn't the last character you entered."
20
- spec.homepage = 'https://github.com/Pixelated-Studios/dynamic_curses_input'
19
+ character you entered that isn't the last character you entered.
20
+
21
+ KNOWN BUG: X & Y coords for placing windows appear to be broken right now. Will fix with
22
+ next update"
23
+ spec.homepage = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/dynamic_curses_input'
21
24
  spec.license = 'MIT'
22
25
  spec.required_ruby_version = '3.2.2'
23
26
 
24
27
  spec.metadata['homepage_uri'] = spec.homepage
25
- spec.metadata['source_code_uri'] = 'https://github.com/Pixelated-Studios/dynamic_curses_input'
26
- spec.metadata['changelog_uri'] = 'https://github.com/Pixelated-Studios/dynamic_curses_input/blob/main/CHANGELOG.md'
28
+ spec.metadata['source_code_uri'] = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/dynamic_curses_input'
29
+ spec.metadata['changelog_uri'] = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/dynamic_curses_input/src/branch/main/CHANGELOG.md'
27
30
 
28
31
  # Specify which files should be added to the gem when it is released.
29
- spec.files = Dir.glob('{bin,lib,sig}/**/*') + Dir.glob('*').reject { |f| f.start_with?('spec', '.rspec', 'dynamic_curses_input.gemspec') }
30
- spec.files << 'LICENSE.txt'
32
+ spec.files = Dir.glob('{bin,lib,sig}/**/*') + Dir.glob('*').reject do |f|
33
+ f.start_with?('spec', '.rspec', 'dynamic_curses_input.gemspec')
34
+ end
35
+ spec.files << 'LICENSE'
31
36
  spec.files << 'README.md'
32
37
  spec.files << 'dynamic_curses_input.gemspec'
33
38
 
@@ -9,7 +9,7 @@ module DynamicCursesInput
9
9
  # Class for creating a colored window
10
10
  class ColorWindow
11
11
  # Initialize instance variables and setup curses
12
- def initialize(echo, x, y)
12
+ def initialize(echo, x, y) # rubocop:disable Metrics/MethodLength, Naming/MethodParameterName
13
13
  @echo = echo # Determines whether input should be echoed to the screen
14
14
  setup_curses_color # Setup curses
15
15
  @x = x
@@ -26,7 +26,7 @@ module DynamicCursesInput
26
26
  end
27
27
 
28
28
  # Method that adds colored text to the window
29
- def add_color_window(color, text, x, y, input: nil, echo: true)
29
+ def add_color_window(color, text, x, y, input: nil, echo: true) # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists, Naming/MethodParameterName
30
30
  # Map color names to color pair numbers
31
31
  color_map = {
32
32
  'black' => 1,
@@ -70,7 +70,7 @@ module DynamicCursesInput
70
70
  end
71
71
 
72
72
  # Set cursor position manually on the X and Y axis
73
- def set_position(y, x)
73
+ def set_position(y, x) # rubocop:disable Naming/MethodParameterName
74
74
  Curses.setpos(y, x)
75
75
  end
76
76
  end
@@ -47,6 +47,8 @@ module DynamicCursesInput
47
47
  case chk
48
48
  when Curses::KEY_LEFT then handle_left_key # Move cursor left
49
49
  when Curses::KEY_RIGHT then handle_right_key # Move cursor right
50
+ when Curses::KEY_UP then handle_up_key
51
+ when Curses::KEY_DOWN then handle_down_key
50
52
  when Curses::KEY_BACKSPACE, 127 then handle_backspace_key # Delete character
51
53
  when 10, 13 then handle_enter_key # Break loop if enter key is pressed
52
54
  else handle_default_key(chk) # Add character to input string
@@ -63,6 +65,16 @@ module DynamicCursesInput
63
65
  @cursor_pos = CursorMover.right(@cursor_pos, @input.length)
64
66
  end
65
67
 
68
+ # Move cursor down
69
+ def handle_down_key
70
+ @cursor_pos = CursorMover.down(@cursor_pos, @input.length)
71
+ end
72
+
73
+ # Move cursor up
74
+ def handle_up_key
75
+ @cursor_pos = CursorMover.up(@cursor_pos, @input.length)
76
+ end
77
+
66
78
  # Delete character
67
79
  def handle_backspace_key
68
80
  @input, @cursor_pos = CharacterDeleter.delete(@input, @cursor_pos)
@@ -103,8 +115,18 @@ module DynamicCursesInput
103
115
  cursor_pos == length ? cursor_pos : cursor_pos + 1
104
116
  end
105
117
 
118
+ # Handle down arrow key
119
+ def self.down(_, length)
120
+ length # Move to the end of the line
121
+ end
122
+
123
+ # Handle up arrow key
124
+ def self.up(_, _length)
125
+ 0 # Move to the beginning of the line (position 0)
126
+ end
127
+
106
128
  # Set cursor position
107
- def self.set_position(y, x)
129
+ def self.set_position(y, x) # rubocop:disable Naming/MethodParameterName
108
130
  Curses.setpos(y, x)
109
131
  end
110
132
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DynamicCursesInput
4
- VERSION = '1.1.0'
4
+ VERSION = '1.2.1'
5
5
  end
@@ -15,12 +15,12 @@ module DynamicCursesInput
15
15
  InputHandler.catch_input(echo)
16
16
  end
17
17
 
18
- def self.ask_question(color = 'white', question, x: 'center', input: true, echo: nil)
18
+ def self.ask_question(color = 'white', question, x: 'center', input: true, echo: nil) # rubocop:disable Naming/MethodParameterName
19
19
  Curses.clear
20
20
  ColorWindow.add_color_window(color, question, y:, x:, input:, echo:)
21
21
  end
22
22
 
23
- def self.print_color_window(color, text, y_value: nil, x: 'center', input: nil, echo: true)
23
+ def self.print_color_window(color, text, y_value: nil, x: 'center', input: nil, echo: true) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/ParameterLists, Naming/MethodParameterName
24
24
  case x
25
25
  when 'center'
26
26
  terminal_size = `stty size`.split.map(&:to_i)
@@ -59,7 +59,7 @@ module DynamicCursesInput
59
59
  class << self
60
60
  private
61
61
 
62
- def process_print_color_window_args(args)
62
+ def process_print_color_window_args(args) # rubocop:disable Metrics/MethodLength
63
63
  case args.size
64
64
  when 2
65
65
  ['white', args[0], args[1], 'center', nil, true]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic_curses_input
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
- - VetheonGames
7
+ - PixelRidge-Softworks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-26 00:00:00.000000000 Z
11
+ date: 2023-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -55,14 +55,17 @@ dependencies:
55
55
  description: |-
56
56
  Dynamic Curses Input is a highly simple, yet powerful gem that allows simple implementation of
57
57
  dynamic typing in curses TUI menus built in Ruby. For example, one can't simply use their arrow
58
- keys to navigate and edit inputs in Cursese TUI menus without adding a bunch of extra code to your
58
+ keys to navigate and edit inputs in Curses TUI menus without adding a bunch of extra code to your
59
59
  project to handle it. A lot of which can be tricky to handle. This gem eliminates the need for
60
60
  that code, by providing simple to use methods that allow developers to capture user input, while
61
61
  allowing the special keys to work as the average user would expect.
62
62
  IE: When you press the left arrow key, the cursor moves to the left and allows you to delete a
63
63
  character you entered that isn't the last character you entered.
64
+
65
+ KNOWN BUG: X & Y coords for placing windows appear to be broken right now. Will fix with
66
+ next update
64
67
  email:
65
- - vetheon@pixelatedstudios.net
68
+ - connorc@pixelridgesoftworks.com
66
69
  executables: []
67
70
  extensions: []
68
71
  extra_rdoc_files: []
@@ -71,25 +74,24 @@ files:
71
74
  - CODE_OF_CONDUCT.md
72
75
  - Gemfile
73
76
  - Gemfile.lock
74
- - LICENSE.txt
77
+ - LICENSE
75
78
  - README.md
76
79
  - Rakefile
77
80
  - bin/console
78
81
  - bin/setup
79
- - buildgem.sh
80
82
  - dynamic_curses_input.gemspec
81
83
  - lib/dynamic_curses_input.rb
82
84
  - lib/dynamic_curses_input/color_window.rb
83
85
  - lib/dynamic_curses_input/input_handler.rb
84
86
  - lib/dynamic_curses_input/version.rb
85
87
  - sig/dynamic_curses_input.rbs
86
- homepage: https://github.com/Pixelated-Studios/dynamic_curses_input
88
+ homepage: https://git.pixelridgesoftworks.com/PixelRidge-Softworks/dynamic_curses_input
87
89
  licenses:
88
90
  - MIT
89
91
  metadata:
90
- homepage_uri: https://github.com/Pixelated-Studios/dynamic_curses_input
91
- source_code_uri: https://github.com/Pixelated-Studios/dynamic_curses_input
92
- changelog_uri: https://github.com/Pixelated-Studios/dynamic_curses_input/blob/main/CHANGELOG.md
92
+ homepage_uri: https://git.pixelridgesoftworks.com/PixelRidge-Softworks/dynamic_curses_input
93
+ source_code_uri: https://git.pixelridgesoftworks.com/PixelRidge-Softworks/dynamic_curses_input
94
+ changelog_uri: https://git.pixelridgesoftworks.com/PixelRidge-Softworks/dynamic_curses_input/src/branch/main/CHANGELOG.md
93
95
  post_install_message:
94
96
  rdoc_options: []
95
97
  require_paths:
@@ -105,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
107
  - !ruby/object:Gem::Version
106
108
  version: '0'
107
109
  requirements: []
108
- rubygems_version: 3.4.16
110
+ rubygems_version: 3.5.0.dev
109
111
  signing_key:
110
112
  specification_version: 4
111
113
  summary: A simple library for making Curses TUI input more dynamic and user-friendly
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2023 VetheonGames
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/buildgem.sh DELETED
@@ -1,22 +0,0 @@
1
- #/bin/bash
2
- echo "rebuilding dynamic_curses_input..."
3
- sleep 1
4
- echo "Uninstalling existing version..."
5
- sleep 1
6
- gem uninstall dynamic_curses_input
7
- sleep 1
8
- echo "Cleaning up old files..."
9
- sleep 1
10
- gem cleanup dynamic_curses_input
11
- sleep 1
12
- echo "Building DCI..."
13
- sleep 1
14
- gem build dynamic_curses_input.gemspec
15
- echo "built!"
16
- sleep 1
17
- echo "Installing new version of DCI..."
18
- sleep 1
19
- gem install dynamic_curses_input-1.0.1.1.gem
20
- echo "Installed!"
21
- echo "press any key to exit..."
22
- read -p ""