Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty printing duplicates lines #276

Closed
x-yuri opened this issue Feb 24, 2015 · 6 comments
Closed

Pretty printing duplicates lines #276

x-yuri opened this issue Feb 24, 2015 · 6 comments

Comments

@x-yuri
Copy link

x-yuri commented Feb 24, 2015

Gemfile:

source 'https://rubygems.org'
gem 'mina', github: 'mina-deploy/mina', ref: '9b97f8ebc6ddf1e80b295921edfb46907b925726'   # current master

Minafile:

# change 102 in the script to result of `tput cols`
task :t1 do
  (0..102).each { |i|
    print_char (i % 10).to_s
  }
  print_char "\n"
  print_str (0..102).map { |i| (i % 10).to_s }.join + "\n"
end

$ bundle exec mina t1 (with tput cols == 102):

       01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234
       01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234
567890
       01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234
567890

@x-yuri
Copy link
Author

x-yuri commented Feb 24, 2015

Apparently, this is owing to this commit. Which fixes displaying password prompts, when you're expected to enter a password on the same line. But when terminal width is less then line to be printed, print_clear thing doesn't work.

@pramodshinde
Copy link

@x-yuri I checked with current master for given rake task its getting printed correctly

$bundle exec mina t1

       0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
       0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012

I think this issue can be closed.

@x-yuri
Copy link
Author

x-yuri commented Jun 29, 2016

No, I still can reproduce it with current master (fc02c9385c7f7760aa39f8d46edbda8bcd3512a9). It must be not really clear, that you've got to change 102 in the test script with your actual screen width (tput cols). In any case, it must be a number big enough for the numbers to not fit the line. So both lines are supposed to be wrapped, what we can't see in your output.

@pramodshinde
Copy link

@x-yuri My terminal shows 130 on tput cols, Can you tell me how to change it to 102 also when you say '...in test script which test script with your actual screen width' are you referring here? Am I missing something?

@x-yuri
Copy link
Author

x-yuri commented Jun 29, 2016

tput cols reports number of columns your terminal has (actual screen width). And you're not supposed to change it (though you can if running x server, just resize the window). You're supposed to replace 102 in the test script with what tput cols outputs. So, for 130 columns test script looks like:

task :t1 do
  (0..130).each { |i|
    print_char (i % 10).to_s
  }
  print_char "\n"
  print_str (0..130).map { |i| (i % 10).to_s }.join + "\n"
end

@d4be4st
Copy link
Member

d4be4st commented Jul 8, 2016

This should be fixed i new 1.0.0 release

@d4be4st d4be4st closed this as completed Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants