Open brbrr opened 9 years ago
I went ahead and got rest-client myself to test it in my computer's actual terminal client (Terminal.app for OS X) and I got the following:
[2] pry(main)> RestClient.get "http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=bd82977b86bf27fb59a04b61b657fb6f"
=> "{\"coord\":{\"lon\":-0.13,\"lat\":51.51},\"weather\":[{\"id\":801,\"main\":\"Clouds\",\"description\":\"few clouds\",\"icon\":\"02d\"}],\"base\":\"cmc stations\",\"main\":{\"temp\":290.012,\"pressure\":1011.3,\"humidity\":75,\"temp_min\":290.012,\"temp_max\":290.012,\"sea_level\":1021.21,\"grnd_level\":1011.3},\"wind\":{\"speed\":5.21,\"deg\":154.502},\"clouds\":{\"all\":24},\"dt\":1445962756,\"sys\":{\"message\":0.0087,\"country\":\"GB\",\"sunrise\":1445928342,\"sunset\":1445964130},\"id\":2643743,\"name\":\"London\",\"cod\":200}\n"
So I'm assuming that OpenWeatherMap puts the
Edit: I see now what you were referring to. That should all be one single line but the copy comes out as multiple chunks.\n
in themselves.
Ok, now I executing same command in Terminal.app and in TerminalPlus, and copy paste reponses here:
Terminal.app:
revairx:~ brbrr$ ruby -e 'require "rest-client"; puts RestClient.get "http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=bd82977b86bf27fb59a04b61b657fb6f"'
{"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"base":"cmc stations","main":{"temp":287.907,"pressure":1011.41,"humidity":81,"temp_min":287.907,"temp_max":287.907,"sea_level":1021.37,"grnd_level":1011.41},"wind":{"speed":4.27,"deg":151.504},"clouds":{"all":88},"dt":1445963787,"sys":{"message":0.0029,"country":"GB","sunrise":1445928344,"sunset":1445964128},"id":2643743,"name":"London","cod":200}
(added indents only for 2 lines)
TerminalPlus
revairx:~ brbrr$ ruby -e 'require "rest-client"; puts RestClient.get "http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=bd82977b86bf2
7fb59a04b61b657fb6f"' {"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"base":"cmc stations","main": {"temp":287.907,"pressure":1011.41,"humidity":81,"temp_min":287.907,"temp_max":287.907,"sea_level":1021.37,"grnd_level":1011.41},"wind":{"speed":4.2 7,"deg":151.504},"clouds":{"all":88},"dt":1445963787,"sys":{"message":0.0029,"country":"GB","sunrise":1445928344,"sunset":1445964128},"id":2643743," name":"London","cod":200}
(here I indent same line beginnings: revairx:~...
and {"coord"...
And actually this would work with any of multiline string, i.e. less output, or long hash printing
one more example. in pry execute:
hsh = {}
10.times { |t| hsh['$$' * (t+1)]='&&' * (t+1) }
hsh.to_s
than copy and paste result in same terminal window. string would be broken in to parts.
My apologies, I misunderstood what the issue is. I see now what the problem is. Fixing this will take a bit of work. It is related to how output lines are displayed in a HTML-friendly format for Atom. I will try to get to this as soon as I can.
This ties in with my scroll bug (#173). A sketch of a solution is presented there. For this issue, we map backwards from a position in a line (wrapped version of the "true" set of lines) for the beginning/end of selection and to the copy from the "true" set of lines.
+1 for fixing this. I'm constantly open a new buffer, pasting in what I've copied from the terminal, then going through and deleting the newlines. Definitely a nuisance.
...but to be clear, not so much of a nuisance to prevent me from using this awesome package :)
While using terminal for tests, or repl (i.e.
pry
) I often need to copy some texts from terminal like server responses, some logged values like hashes, etc. But while I select and copy some multiline texts - new lines are also copied. here is simple example: (copy pasted as is, \n are saved) [8] pry(main)> RestClient.get "http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=bd82977b86bf27fb59a04b61b657fb6f" => "{\"coord\":{\"lon\":-0.13,\"lat\":51.51},\"weather\":[{\"id\":801,\"main\":\"Clouds\",\"description\":\"few clouds\",\"icon\":\"02d\"}],\"base\" :\"cmc stations\",\"main\":{\"temp\":290.012,\"pressure\":1011.3,\"humidity\":75,\"temp_min\":290.012,\"temp_max\":290.012,\"sea_level\":1021.21,\"g rnd_level\":1011.3},\"wind\":{\"speed\":5.21,\"deg\":154.502},\"clouds\":{\"all\":24},\"dt\":1445962580,\"sys\":{\"message\":0.011,\"country\":\"GB\ ",\"sunrise\":1445928342,\"sunset\":1445964130},\"id\":2643743,\"name\":\"London\",\"cod\":200}\n"