@@ -83,18 +83,18 @@ renderTimelineItem now totalItems idx (itemType, _extraBody) =
8383 hLimit maxCommentWidth $ borderFunc
8484 (topLabel username createdAt now)
8585 (markdownToWidgetsWithWidth (maxCommentWidth - 2 ) descriptionBody)
86- Right item -> renderItemWithBorder now borderFunc item
86+ Right item -> renderItemWithBorder now (idx == totalItems - 1 ) borderFunc item
8787
8888topLabel :: Text -> UTCTime -> UTCTime -> Widget n
8989topLabel username createdAt now =
9090 (withAttr usernameAttr (str [i |#{username} |]) <+> str [i |opened #{timeFromNow (diffUTCTime now createdAt)}|])
9191 & padLeftRight 1
9292
93- renderItemWithBorder :: UTCTime -> (Widget n -> Widget n -> Widget n ) -> Either IssueEvent IssueComment -> Widget n
94- renderItemWithBorder now borderFunc item =
93+ renderItemWithBorder :: UTCTime -> Bool -> (Widget n -> Widget n -> Widget n ) -> Either IssueEvent IssueComment -> Widget n
94+ renderItemWithBorder now isLast borderFunc item =
9595 case item of
9696 Right comment -> renderComment now borderFunc comment
97- Left event -> renderEvent now event
97+ Left event -> renderEvent now isLast event
9898
9999renderComment :: UTCTime -> (Widget n -> Widget n -> Widget n ) -> IssueComment -> Widget n
100100renderComment now borderFunc (IssueComment {issueCommentUser= (SimpleUser {simpleUserLogin= (N username)}), issueCommentCreatedAt, .. }) =
@@ -103,23 +103,27 @@ renderComment now borderFunc (IssueComment {issueCommentUser=(SimpleUser {simple
103103 (markdownToWidgetsWithWidth (maxCommentWidth - 2 ) issueCommentBody)
104104 where commentTime = issueCommentCreatedAt
105105
106- renderEvent :: UTCTime -> IssueEvent -> Widget n
107- renderEvent now issueEvent =
106+ renderEvent :: UTCTime -> Bool -> IssueEvent -> Widget n
107+ renderEvent now isLast issueEvent =
108108 let actorName :: Text = case simpleUserLogin (issueEventActor issueEvent) of
109109 N username -> username
110110 eventText = getEventDescription (issueEventType issueEvent)
111111 iconWidget = getEventIconWithColor (issueEventType issueEvent)
112112 timeAgo = timeFromNow (diffUTCTime now (issueEventCreatedAt issueEvent))
113- in hLimit maxCommentWidth $
114- padLeft (Pad 4 ) $ hBox [
115- iconWidget
116- , str " "
117- , withAttr usernameAttr $ str (toString actorName)
118- , str " "
119- , str eventText
120- , str " "
121- , withAttr italicText $ str timeAgo
122- ]
113+ eventLine = hLimit maxCommentWidth $
114+ padLeft (Pad 4 ) $ hBox [
115+ iconWidget
116+ , str " "
117+ , withAttr usernameAttr $ str (toString actorName)
118+ , str " "
119+ , str eventText
120+ , str " "
121+ , withAttr italicText $ str timeAgo
122+ ]
123+ continuationLine = if isLast
124+ then emptyWidget
125+ else hLimit maxCommentWidth $ padLeft (Pad 4 ) $ withAttr timelineBorderAttr $ str " │"
126+ in vBox [eventLine, continuationLine]
123127
124128commentTopLabel :: Text -> UTCTime -> UTCTime -> Widget n
125129commentTopLabel username commentTime now =
0 commit comments