ov icon indicating copy to clipboard operation
ov copied to clipboard

`ov -F` not auto add LF if the last line of file do not has LF

Open charlie-wong opened this issue 3 months ago β€’ 4 comments

  • ov version v0.33.3 rev:a5e120e
  • Reproduce
    User@Server $ echo -n ok > ok.log
    User@Server $ hexyl ok.log
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚00000000β”‚ 6f 6b                   β”Š                         β”‚ok      β”Š        β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    User@Server $ less -F ok.log # auto append LF
    ok
    User@Server $ ov -F ok.log # do not append LF, after enter, result is
    okUser@Server $ # <--- this is not that good!
    

charlie-wong avatar Mar 30 '24 15:03 charlie-wong

Thank you for the issue.

That's certainly how it works. However, I am not convinced that adding LF is correct. What kind of problems will occur?

noborus avatar Mar 31 '24 00:03 noborus

Yes, just add LF is not right, it should be related to the OS

But when it works with git log, no auto line-feed will make output not good, like

User@Server $ git log --format=format:'%C(red)%h %C(green)%as %C(reset)%s' -2
d85af43 2024-03-24 docs: add README
64abd80 2024-03-24 docs: add .gitignoreUser@Server $ 

charlie-wong avatar Apr 01 '24 02:04 charlie-wong

thank you for your reply.

It seems correct to use tformat in the example you mention.

git log --format=tformat:'%C(red)%h %C(green)%as %C(reset)%s' -2

The current behavior is the same as --no-pager. I still don't think this behavior should be the same as less.

noborus avatar Apr 02 '24 02:04 noborus

ok, got it!

charlie-wong avatar Apr 02 '24 09:04 charlie-wong