summaryrefslogtreecommitdiffhomepage
path: root/dragon/console_prompt.rb
diff options
context:
space:
mode:
Diffstat (limited to 'dragon/console_prompt.rb')
-rw-r--r--dragon/console_prompt.rb21
1 files changed, 11 insertions, 10 deletions
diff --git a/dragon/console_prompt.rb b/dragon/console_prompt.rb
index b97bdba..8c02de0 100644
--- a/dragon/console_prompt.rb
+++ b/dragon/console_prompt.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
# Copyright 2019 DragonRuby LLC
# MIT License
# console_prompt.rb has been released under MIT (*only this file*).
@@ -71,14 +72,14 @@ module GTK
return if @cursor_position.zero?
new_pos = @cursor_position - 1
- (is_word_boundary? @current_input_str[new_pos]) ?
+ (is_word_boundary? @current_input_str[new_pos]) ?
(new_pos -= 1 until !(is_word_boundary? @current_input_str[new_pos - 1]) || new_pos.zero?):
(new_pos -= 1 until (is_word_boundary? @current_input_str[new_pos - 1]) || new_pos.zero?)
@cursor_position = new_pos
update_cursor_position_px
end
-
+
def move_cursor_right
@cursor_position += 1 if @cursor_position < current_input_str.length
update_cursor_position_px
@@ -91,7 +92,7 @@ module GTK
(is_word_boundary? @current_input_str[new_pos]) ?
(new_pos += 1 until !(is_word_boundary? @current_input_str[new_pos]) || (new_pos.equal? str_len)):
(new_pos += 1 until (is_word_boundary? @current_input_str[new_pos]) || (new_pos.equal? str_len))
-
+
@cursor_position = new_pos
update_cursor_position_px
end
@@ -157,11 +158,11 @@ S
# partition the original list of items into a string to be printed
items.each_slice(columns).each_with_index do |cells, i|
- pretty_print_row_seperator string_width, cell_width, column_width, columns
+ pretty_print_row_separator string_width, cell_width, column_width, columns
pretty_print_row cells, string_width, cell_width, column_width, columns
end
- pretty_print_row_seperator string_width, cell_width, column_width, columns
+ pretty_print_row_separator string_width, cell_width, column_width, columns
end
end
@@ -174,17 +175,17 @@ S
"#{" " * (string_width.length - c.length) } #{c} |"
end.join
- # remove seperators between empty values
+ # remove separators between empty values
formated_row = formated_row.gsub(" | ", " ")
puts formated_row
end
- def pretty_print_row_seperator string_width, cell_width, column_width, columns
+ def pretty_print_row_separator string_width, cell_width, column_width, columns
# this is a joint: +--------
column_joint = "+#{"-" * cell_width}"
- # multiple joints create a row seperator: +----+----+
+ # multiple joints create a row separator: +----+----+
puts (column_joint * columns) + "+"
end
@@ -193,12 +194,12 @@ S
args.outputs.reserved << (@cursor_color.to_h.merge x: x + @cursor_position_px + 0.5,
y: y + 5,
x2: x + @cursor_position_px + 0.5,
- y2: y + @font_style.letter_size.y + 5)
+ y2: y + @font_style.letter_size.y + 4)
args.outputs.reserved << (@cursor_color.to_h.merge x: x + @cursor_position_px + 1,
y: y + 5,
x2: x + @cursor_position_px + 1,
- y2: y + @font_style.letter_size.y + 5)
+ y2: y + @font_style.letter_size.y + 4)
# debugging rectangle for string
# args.outputs.reserved << (@cursor_color.to_h.merge x: x,