brodieG / diffobj

Compare R Objects with a Diff
229 stars 12 forks source link

skip "Press ENTER to continue..." ? #163

Closed moodymudskipper closed 2 years ago

moodymudskipper commented 2 years ago

Hi, I'm using with the package more and more and loving it.

I'm frustrated however by the mandatory (?) "Press ENTER to continue..." that seems for most of my use cases like an unnecessary step, and moreso since I'd like to use my own prompt there to trigger different actions when looping through diffs . I saw that with interactive = FALSE I could do without it but then the output is printed to the console and I'd like to keep it in the viewer. Is there any way around it ?

brodieG commented 2 years ago

Yes there is:

f <- tempfile(fileext=".html")
diffPrint(1:2, 2:3, pager=list(file.path=f))

This is documented somewhat obliquely in ?Pager. Note that if you do this you become responsible for deleting the file. The reason for the "press enter..." business is that this guarantees that the HTML file will be rendered by the viewer before it is deleted. Maybe there is a way to register a callback on the viewer to delete the file once it is rendered.

brodieG commented 2 years ago

@moodymudskipper does this address your issue?

moodymudskipper commented 2 years ago

It does! Thanks a lot!