diffobj icon indicating copy to clipboard operation
diffobj copied to clipboard

`disp.width` calcs with width changing styles

Open brodieG opened this issue 7 years ago • 1 comments

Notice how disp.width does not help in the least avoid wrapping:

> my.pal <- PaletteOfStyles()
> my.style <- StyleRaw()   # See `?Style` for custom styles
> my.style@[email protected] <- function(x) sprintf("--%s--", x)
> my.pal["ansi256", "light", "rgb"] <- list(my.style) # note `list()`
> ## Output has no format now for format/color.mode/brightness
> ## we modified ...
> ## `pager="off"` for CRAN compliance; you may omit in normal use
> diffPrint(
+    1:3, 2:5, format="ansi256", color.mode="rgb", brightness="light",
+    palette.of.styles=my.pal, pager="off", disp.width=80
+ )
< --1:3--      > 2:5        
@@ 1 @@        @@ 1 @@      
< [1] --1-- 2  > [1] 2 3 4 5
:  3           ~            

brodieG avatar Aug 29 '16 00:08 brodieG

This is not trivial, and not very valuable. Mostly we need to re-order code in as.character so we can get the true width of the output. This is likely to be somewhat complicated to do properly without breaking other stuff.

For now we just documented this problem.

brodieG avatar Nov 12 '16 00:11 brodieG