anchor.diff: -%% Copyright (c) 2008-2015 Robert Virding
  +%% Copyright (c) 2008-2016 Robert Virding
   %%
   %% Licensed under the Apache License, Version 2.0 (the "License");
   %% you may not use this file except in compliance with the License.
  
positive.code:             Vs = if I+Vl < L-10 -> Vcs;
                      true -> term(V, D, I, L)
                   end,
              {break,[Ks,newline(I, Vs)]}
      end.
  
  %% last_length(Chars) -> Length.
  
negative.code: map_rest(KVs, D, I, L) ->
      map_rest(KVs, I, D, I, L-1).
  
  map_rest(_, _, 0, _, _) -> " ...";              %Reached our depth
  map_rest([K,V|KVs], CurL, D, I, L) ->
      case map_assoc(K, V, CurL+1, D, I, L) of
          {curr_line,KVcs,KVl} ->                 %Both fit on current line
              [$\s,KVcs,map_rest(KVs, CurL+KVl+1, D-1, I, L)];
          {one_line,KVcs,KVl} ->                  %Both fit on one line
              [newline(I, KVcs),map_rest(KVs, I+KVl, D-1, I, L)];
          {sep_lines,Kcs,Vcs} ->                  %On separate lines
              %% Force a break after K/V split.
              [newline(I, Kcs),newline(I, Vcs),map_rest(KVs, L, D-1, I, L)]
      end;
  map_rest(E, CurL, D, I, L) ->
      map_last(E, CurL, D, I, L).
  
  %% Print any remaining element as list element.
  map_last(Tail, CurL, D, I, L) ->
      list_tail(Tail, CurL, D, I, L).
  
  