Skip to content

Commit

Permalink
Merge pull request #5 from watzon/master
Browse files Browse the repository at this point in the history
Update for Crystal 0.32.1
  • Loading branch information
Papierkorb authored Dec 20, 2019
2 parents 39098fd + ca8318f commit 21b31dd
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions samples/colorized_prompt.cr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "../../src/fancyline"
require "../src/fancyline"

# Demonstration of colorized prompts.

Expand All @@ -7,7 +7,7 @@ puts "Press Ctrl-C or Ctrl-D to quit."

loop do
lprompt = "#{Dir.current} ❱❱❱ ".colorize(:blue).mode(:bold).to_s
rprompt = "❰❰❰ #{Time.now}".colorize(:yellow).mode(:bold).to_s
rprompt = "❰❰❰ #{Time.local}".colorize(:yellow).mode(:bold).to_s

input = fancy.readline(lprompt, rprompt: rprompt)

Expand Down
2 changes: 1 addition & 1 deletion samples/concurrent_output.cr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ logger.info "Hit Ctrl-D or Ctrl-C to end the demo."

# Simulate a background task writing something onto standard output.
spawn do
loop do |i|
0.upto(Int64::MAX).each do |i|
fancy.grab_output do # Grab the output
logger.info "Running #{i} seconds..." # Print something
end
Expand Down
2 changes: 1 addition & 1 deletion samples/multiline_prompt.cr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "../../src/fancyline"
require "../src/fancyline"

# Demonstration of multi-line prompts.

Expand Down
2 changes: 1 addition & 1 deletion samples/right_prompt.cr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "../../src/fancyline"
require "../src/fancyline"

# Demonstration of a RPROMPT. The `rprompt` will be displayed on the right-hand
# end of the terminal window.
Expand Down
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ dependencies:
github: Papierkorb/cute
version: ">= 0.3.1"

crystal: 0.24.1
crystal: 0.32.1

license: MPL-2
4 changes: 2 additions & 2 deletions src/fancyline/tty/dumb.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ class Fancyline
true
end

def columns
def columns : Int32
80
end

def rows
def rows : Int32
25
end

Expand Down
8 changes: 4 additions & 4 deletions src/fancyline/tty/vt100.cr
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ class Fancyline
{% end %}
end

def columns
winsize.try(&.ws_col) || ENV["COLUMNS"]?.try(&.to_i?) || 80
def columns : Int32
winsize.try(&.ws_col.to_i) || ENV["COLUMNS"]?.try(&.to_i?) || 80
end

def rows
winsize.try(&.ws_row) || ENV["ROWS"]?.try(&.to_i?) || 25
def rows : Int32
winsize.try(&.ws_row.to_i) || ENV["ROWS"]?.try(&.to_i?) || 25
end

def prepare_line
Expand Down
2 changes: 1 addition & 1 deletion src/fancyline/widget/history_search.cr
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Fancyline
if editor.empty?
@matches.clear
else
@matches = history.lines.grep needle_regex
@matches = history.lines.select needle_regex
end

@position = 0
Expand Down

0 comments on commit 21b31dd

Please sign in to comment.