66
77import { select , isCancel } from "@clack/prompts" ;
88import { labelColors , textColors } from "../init/colors.js" ;
9+ import { formatForDisplay } from "../../../lib/util/emoji.js" ;
910import type { CommitInfo } from "../shared/types.js" ;
1011import { getCommitDetails , getCommitDiff } from "../shared/git-operations.js" ;
1112import readline from "readline" ;
@@ -46,6 +47,7 @@ export function displayCommitList(
4647 hasMore : boolean ,
4748 hasPreviousPage : boolean = false ,
4849 hasMorePages : boolean = false ,
50+ emojiModeActive : boolean = true ,
4951) : void {
5052 console . log ( ) ;
5153 console . log (
@@ -64,10 +66,11 @@ export function displayCommitList(
6466 const commit = commits [ i ] ;
6567 const number = i . toString ( ) ;
6668 const mergeIndicator = commit . isMerge ? " [Merge]" : "" ;
69+ const displaySubject = formatForDisplay ( commit . subject , emojiModeActive ) ;
6770 const truncatedSubject =
68- commit . subject . length > 50
69- ? commit . subject . substring ( 0 , 47 ) + "..."
70- : commit . subject ;
71+ displaySubject . length > 50
72+ ? displaySubject . substring ( 0 , 47 ) + "..."
73+ : displaySubject ;
7174
7275 console . log (
7376 ` ${ textColors . brightCyan ( `[${ number } ]` ) } ${ textColors . brightWhite ( commit . shortHash ) } ${ truncatedSubject } ${ mergeIndicator } ` ,
@@ -124,14 +127,16 @@ export function displayCommitDetails(
124127 commit : CommitInfo ,
125128 showBody : boolean = true ,
126129 showFiles : boolean = true ,
130+ emojiModeActive : boolean = true ,
127131) : void {
128132 console . log ( ) ;
129133 console . log (
130134 `${ label ( "detail" , "green" ) } ${ textColors . pureWhite ( "Commit Details" ) } ` ,
131135 ) ;
132136 console . log ( ) ;
133137 console . log ( ` ${ textColors . brightWhite ( "Hash:" ) } ${ commit . hash } ` ) ;
134- console . log ( ` ${ textColors . brightWhite ( "Subject:" ) } ${ commit . subject } ` ) ;
138+ const displaySubject = formatForDisplay ( commit . subject , emojiModeActive ) ;
139+ console . log ( ` ${ textColors . brightWhite ( "Subject:" ) } ${ displaySubject } ` ) ;
135140 console . log ( ) ;
136141 console . log (
137142 ` ${ textColors . brightWhite ( "Author:" ) } ${ commit . author . name } <${ commit . author . email } >` ,
@@ -174,7 +179,8 @@ export function displayCommitDetails(
174179 if ( showBody ) {
175180 if ( commit . body ) {
176181 console . log ( ` ${ textColors . brightWhite ( "Body:" ) } ` ) ;
177- const bodyLines = commit . body . split ( "\n" ) ;
182+ const displayBody = formatForDisplay ( commit . body , emojiModeActive ) ;
183+ const bodyLines = displayBody . split ( "\n" ) ;
178184 bodyLines . forEach ( ( line ) => {
179185 console . log ( ` ${ line } ` ) ;
180186 } ) ;
0 commit comments