Skip to content

Instantly share code, notes, and snippets.

@jeremy-w
Created September 10, 2013 01:44
Show Gist options
  • Save jeremy-w/6503988 to your computer and use it in GitHub Desktop.
Save jeremy-w/6503988 to your computer and use it in GitHub Desktop.

Threading (jws, 2013-0909)

Reddit Threading

Currently, Cauldron indents with every reply.

So we might have a conversation like this:

A: Hey
 \- B: Hello
     \- A: How goes?
         \- B: Well, well.
             \- A: Glad to hear it.
 \- C: Hiya there!
     \- A: Greetings!
        \- C: Having a good day, mate?
     \- B: Hey hey hey!
         \- A: Hey yourself. ;)

And it would be indented like so.

Compact Threading

The issue is there are a lot of threads with just a single reply all along the branch, like the A/B exchange.

Instead, I propose only indenting where necessary to distinguish cousins. The A/B exchange has only a single child of each node. The A/B/C exchange has two children of the C node, so we need to distinguish those sub-threads.

The "compact threading" looks like so:

A: Hey
 \- B: Hello
     \- A: How goes?
     \- B: Well, well.
     \- A: Glad to hear it.
 \- C: Hiya there!
     \- A: Greetings!
         \- C: Having a good day, mate?
     \- B: Hey hey hey!
         \- A: Hey yourself. ;)

The basic rule is to back up and indent where two nodes not in the same thread would nevertheless appear at the same level of indentation.

Compacter with Grouping

We can get cleverer if we have other means to group nodes than purely indentation. For example, vertical spacing, or circling/background coloring, might let us render this like:

A: Hey
 \- B: Hello
 \- A: How goes?
 \- B: Well, well.
 \- A: Glad to hear it.

 \- C: Hiya there!
     \- A: Greetings!
     \- C: Having a good day, mate?

     \- B: Hey hey hey!
     \- A: Hey yourself. ;)

In this case, you would indent only when there are 2 replies to the same node, like the top A->B and A->C nodes and the lower C->A and C->B.

Once we have just simple "straight growth", we can avoid indenting, and just stack the thread to avoid excess right-scrolling.

Testing

It should be possible to grab a few snatches of global and see what the rightmost point is of threads drawn using these various techniques. It's possible in practice that none of the variants does much to eliminate right-scrolling in actual practice because straight growth is less common than I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment