eliben / pss

pss is a power-tool for searching inside source code files.
Other
327 stars 46 forks source link

Redirected output has two line breaks between each line on Windows #10

Closed benhoyt closed 8 years ago

benhoyt commented 11 years ago

Because the input files are opened in binary mode and stdout is opened as text, on Windows when redirecting the output to a file you end up with CR CR LF line breaks, which is incorrect, and most editors show as two line breaks (extra blank line in between every line).

The "proper" fix would be to open the file in text mode, but as you're doing binary stuff on it too, it's easiest just to replace CR LF with LF before outputting (which the text-opened stdout will convert back to CR LF).

Fixed in this commit

eliben commented 11 years ago

Can you submit a pull request with a test for this?

benhoyt commented 11 years ago

How's this commit look for a test? Note that it only fails on Windows, and my fix above fixes it.

eliben commented 11 years ago

It looks fine. Would you like to submit a pull request?

benhoyt commented 11 years ago

Hmmm, I'd like to :-) ... but I'm really struggling to figure out how to create a pull request on your repo from a single commit on mine. I'm a git + GitHub newbie. I spent about 15 minutes trying just now, so am giving up for now (need to do some other stuff).

eliben commented 11 years ago

Github has some pretty good info on that. For example https://help.github.com/articles/using-pull-requests and https://help.github.com/articles/creating-a-pull-request

Basically what you need is to bring your fork repo up to date with mine, create a branch and then "compare" it which should present the option to send a pull request. It has to be a single commit beyond the master pointer of the original branch.

If the above makes little sense you should probably learn about Git first :-) But you can also just send me a patch file generated vs. the tip of pss and I will apply it myself.

benhoyt commented 11 years ago

Thanks! I think I missed the steps of bringing my fork up to date with yours and creating a branch. I'll have a crack at that in the next couple of days.

eliben commented 11 years ago

No worries. I pushed 1.39 today, it will be a while until the next released version. I suppose you're working with a git clone anyway.

On Fri, Sep 20, 2013 at 9:15 PM, Ben Hoyt notifications@github.com wrote:

Thanks! I think I missed the steps of bringing my fork up to date with yours and creating a branch. I'll have a crack at that in the next couple of days.

— Reply to this email directly or view it on GitHubhttps://github.com/eliben/pss/issues/10#issuecomment-24855600 .

eliben commented 8 years ago

Here too, interested in pushing this through?

[just going through old issues]

benhoyt commented 8 years ago

Hmmm, this is not an issue anymore on the latest master, so I guess something fixed it. I thought it might be the -U / --universal-newlines option, but it looks like that's off by default, so probably something else. In any case, it's fine now. :-)