Index: modules/comment/comment.css
===================================================================
RCS file: modules/comment/comment.css
diff -N modules/comment/comment.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/comment/comment.css	7 Oct 2006 21:53:21 -0000
@@ -0,0 +1,3 @@
+.indented {
+  margin-left: 25px;
+}
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.488
diff -u -p -r1.488 comment.module
--- modules/comment/comment.module	17 Sep 2006 19:09:34 -0000	1.488
+++ modules/comment/comment.module	7 Oct 2006 21:53:23 -0000
@@ -888,11 +888,23 @@ function comment_render($node, $cid = 0)
         $output .= drupal_get_form('comment_controls', $mode, $order, $comments_per_page);
       }
 
+      $last_depth = 0;
+      drupal_add_css(drupal_get_path('module', 'comment') . '/comment.css');
       while ($comment = db_fetch_object($result)) {
         $comment = drupal_unpack($comment);
         $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
         $comment->depth = count(explode('.', $comment->thread)) - 1;
 
+        if ($comment->depth > $last_depth) {
+          $divs++;
+          $output .= '<div class="indented">';
+        }
+        else if ($comment->depth < $last_depth) {
+          $divs--;
+          $output .= '</div>';
+        }
+        $last_depth = $comment->depth;
+
         if ($mode == COMMENT_MODE_FLAT_COLLAPSED) {
           $output .= theme('comment_flat_collapsed', $comment);
         }
@@ -906,7 +918,9 @@ function comment_render($node, $cid = 0)
           $output .= theme('comment_thread_expanded', $comment);
         }
       }
-
+      for ($i = 0; $i < $divs; $i++) {
+        $output .= '</div>';
+      }
       $output .= theme('pager', NULL, $comments_per_page, 0);
 
       if (db_num_rows($result) && (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_BELOW || variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE_BELOW)) {
@@ -1639,23 +1653,13 @@ function theme_comment_flat_expanded($co
 }
 
 function theme_comment_thread_collapsed($comment) {
-  $output  = '<div style="margin-left:'. ($comment->depth * 25) ."px;\">\n";
   $output .= theme('comment_view', $comment, '', 0);
-  $output .= "</div>\n";
   return $output;
 }
 
 function theme_comment_thread_expanded($comment) {
   $output = '';
-  if ($comment->depth) {
-    $output .= '<div style="margin-left:'. ($comment->depth * 25) ."px;\">\n";
-  }
-
   $output .= theme('comment_view', $comment, module_invoke_all('link', 'comment', $comment, 0));
-
-  if ($comment->depth) {
-    $output .= "</div>\n";
-  }
   return $output;
 }
 
