diff options
-rw-r--r-- | go.mod | 1 | ||||
-rw-r--r-- | go.sum | 20 | ||||
-rw-r--r-- | pkg/config/user_config.go | 2 | ||||
-rw-r--r-- | pkg/gui/list_context_config.go | 27 | ||||
-rw-r--r-- | pkg/gui/presentation/commits.go | 25 | ||||
-rw-r--r-- | pkg/gui/presentation/reflog_commits.go | 25 | ||||
-rw-r--r-- | vendor/github.com/kyokomi/emoji/v2/.gitignore | 2 | ||||
-rw-r--r-- | vendor/github.com/kyokomi/emoji/v2/LICENSE | 21 | ||||
-rw-r--r-- | vendor/github.com/kyokomi/emoji/v2/README.md | 53 | ||||
-rw-r--r-- | vendor/github.com/kyokomi/emoji/v2/emoji.go | 157 | ||||
-rw-r--r-- | vendor/github.com/kyokomi/emoji/v2/emoji_codemap.go | 7715 | ||||
-rw-r--r-- | vendor/github.com/kyokomi/emoji/v2/go.mod | 3 | ||||
-rw-r--r-- | vendor/github.com/kyokomi/emoji/v2/wercker.yml | 33 | ||||
-rw-r--r-- | vendor/modules.txt | 3 |
14 files changed, 8052 insertions, 35 deletions
@@ -25,6 +25,7 @@ require ( github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect github.com/kylelemons/godebug v1.1.0 // indirect + github.com/kyokomi/emoji/v2 v2.2.8 github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-colorable v0.1.7 // indirect github.com/mattn/go-runewidth v0.0.13 @@ -23,7 +23,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= -github.com/fatih/color v1.7.1-0.20180516100307-2d684516a886 h1:NAFoy+QgUpERgK3y1xiVh5HcOvSeZHpXTTo5qnvnuK4= github.com/fatih/color v1.7.1-0.20180516100307-2d684516a886/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= @@ -33,7 +32,6 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell/v2 v2.0.0 h1:GRWG8aLfWAlekj9Q6W29bVvkHENc6hp79XOqG4AWDOs= github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= github.com/gdamore/tcell/v2 v2.3.11 h1:ECO6WqHGbKZ3HrSL7bG/zArMCmLaNr5vcjjMVnLHpzc= github.com/gdamore/tcell/v2 v2.3.11/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU= @@ -48,7 +46,6 @@ github.com/go-git/go-billy/v5 v5.0.0 h1:7NQHvd9FVid8VL4qVUMm8XifBK+2xCoZ2lSk0agR github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12 h1:PbKy9zOy4aAKrJ5pibIRpVO2BXnK1Tlcg+caKI7Ox5M= github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw= -github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= @@ -62,7 +59,6 @@ github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= @@ -86,34 +82,29 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3 github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= +github.com/kyokomi/emoji/v2 v2.2.8 h1:jcofPxjHWEkJtkIbcLHvZhxKgCPl6C7MyjTrD4KDqUE= +github.com/kyokomi/emoji/v2 v2.2.8/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg= github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -132,7 +123,6 @@ github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -155,14 +145,12 @@ github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70 github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 h1:hb9wdF1z5waM+dSIICn1l0DkLVDT3hqhhQsDNUmHPRE= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201002202402-0a1ea396d57c h1:dk0ukUIHmGHqASjP0iue2261isepFCC6XRCSd1nHgDw= golang.org/x/net v0.0.0-20201002202402-0a1ea396d57c/go.mod h1:iQL9McJNjoIa5mjH6nYTCTZXUN6RP+XW3eib7Ya3XcI= @@ -178,24 +166,20 @@ golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210611083646-a4fc73990273 h1:faDu4veV+8pcThn4fewv6TVlNCezafGoC1gM/mxQLbQ= golang.org/x/sys v0.0.0-20210611083646-a4fc73990273/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210503060354-a79de5458b56 h1:b8jxX3zqjpqb2LklXPzKSGJhzyxCOZSz8ncv8Nv+y7w= golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index f87567ac0..4855bf816 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -66,6 +66,7 @@ type GitConfig struct { OverrideGpg bool `yaml:"overrideGpg"` DisableForcePushing bool `yaml:"disableForcePushing"` CommitPrefixes map[string]CommitPrefixConfig `yaml:"commitPrefixes"` + ParseEmoji bool `yaml:"parseEmoji"` } type PagingConfig struct { @@ -332,6 +333,7 @@ func GetDefaultConfig() *UserConfig { AllBranchesLogCmd: "git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium", DisableForcePushing: false, CommitPrefixes: map[string]CommitPrefixConfig(nil), + ParseEmoji: false, }, Refresher: RefresherConfig{ RefreshInterval: 10, diff --git a/pkg/gui/list_context_config.go b/pkg/gui/list_context_config.go index 02e989f55..6e9563069 100644 --- a/pkg/gui/list_context_config.go +++ b/pkg/gui/list_context_config.go @@ -150,6 +150,7 @@ func (gui *Gui) tagsListContext() *ListContext { } func (gui *Gui) branchCommitsListContext() *ListContext { + parseEmoji := gui.Config.GetUserConfig().Git.ParseEmoji return &ListContext{ BasicContext: &BasicContext{ ViewName: "commits", @@ -164,7 +165,13 @@ func (gui *Gui) branchCommitsListContext() *ListContext { Gui: gui, ResetMainViewOriginOnFocus: true, GetDisplayStrings: func() [][]string { - return presentation.GetCommitListDisplayStrings(gui.State.Commits, gui.State.ScreenMode != SCREEN_NORMAL, gui.cherryPickedCommitShaMap(), gui.State.Modes.Diffing.Ref) + return presentation.GetCommitListDisplayStrings( + gui.State.Commits, + gui.State.ScreenMode != SCREEN_NORMAL, + gui.cherryPickedCommitShaMap(), + gui.State.Modes.Diffing.Ref, + parseEmoji, + ) }, SelectedItem: func() (ListItem, bool) { item := gui.getSelectedLocalCommit() @@ -174,6 +181,7 @@ func (gui *Gui) branchCommitsListContext() *ListContext { } func (gui *Gui) reflogCommitsListContext() *ListContext { + parseEmoji := gui.Config.GetUserConfig().Git.ParseEmoji return &ListContext{ BasicContext: &BasicContext{ ViewName: "commits", @@ -187,7 +195,13 @@ func (gui *Gui) reflogCommitsListContext() *ListContext { Gui: gui, ResetMainViewOriginOnFocus: true, GetDisplayStrings: func() [][]string { - return presentation.GetReflogCommitListDisplayStrings(gui.State.FilteredReflogCommits, gui.State.ScreenMode != SCREEN_NORMAL, gui.cherryPickedCommitShaMap(), gui.State.Modes.Diffing.Ref) + return presentation.GetReflogCommitListDisplayStrings( + gui.State.FilteredReflogCommits, + gui.State.ScreenMode != SCREEN_NORMAL, + gui.cherryPickedCommitShaMap(), + gui.State.Modes.Diffing.Ref, + parseEmoji, + ) }, SelectedItem: func() (ListItem, bool) { item := gui.getSelectedReflogCommit() @@ -197,6 +211,7 @@ func (gui *Gui) reflogCommitsListContext() *ListContext { } func (gui *Gui) subCommitsListContext() *ListContext { + parseEmoji := gui.Config.GetUserConfig().Git.ParseEmoji return &ListContext{ BasicContext: &BasicContext{ ViewName: "branches", @@ -210,7 +225,13 @@ func (gui *Gui) subCommitsListContext() *ListContext { Gui: gui, ResetMainViewOriginOnFocus: true, GetDisplayStrings: func() [][]string { - return presentation.GetCommitListDisplayStrings(gui.State.SubCommits, gui.State.ScreenMode != SCREEN_NORMAL, gui.cherryPickedCommitShaMap(), gui.State.Modes.Diffing.Ref) + return presentation.GetCommitListDisplayStrings( + gui.State.SubCommits, + gui.State.ScreenMode != SCREEN_NORMAL, + gui.cherryPickedCommitShaMap(), + gui.State.Modes.Diffing.Ref, + parseEmoji, + ) }, SelectedItem: func() (ListItem, bool) { item := gui.getSelectedSubCommit() diff --git a/pkg/gui/presentation/commits.go b/pkg/gui/presentation/commits.go index aeecd71a7..a3fcdb834 100644 --- a/pkg/gui/presentation/commits.go +++ b/pkg/gui/presentation/commits.go @@ -7,12 +7,13 @@ import ( "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/theme" "github.com/jesseduffield/lazygit/pkg/utils" + "github.com/kyokomi/emoji/v2" ) -func GetCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, cherryPickedCommitShaMap map[string]bool, diffName string) [][]string { +func GetCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, cherryPickedCommitShaMap map[string]bool, diffName string, parseEmoji bool) [][]string { lines := make([][]string, len(commits)) - var displayFunc func(*models.Commit, map[string]bool, bool) []string + var displayFunc func(*models.Commit, map[string]bool, bool, bool) []string if fullDescription { displayFunc = getFullDescriptionDisplayStringsForCommit } else { @@ -21,13 +22,13 @@ func GetCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, for i := range commits { diffed := commits[i].Sha == diffName - lines[i] = displayFunc(commits[i], cherryPickedCommitShaMap, diffed) + lines[i] = displayFunc(commits[i], cherryPickedCommitShaMap, diffed, parseEmoji) } return lines } -func getFullDescriptionDisplayStringsForCommit(c *models.Commit, cherryPickedCommitShaMap map[string]bool, diffed bool) []string { +func getFullDescriptionDisplayStringsForCommit(c *models.Commit, cherryPickedCommitShaMap map[string]bool, diffed, parseEmoji bool) []string { red := color.New(color.FgRed) yellow := color.New(color.FgYellow) green := color.New(color.FgGreen) @@ -73,10 +74,15 @@ func getFullDescriptionDisplayStringsForCommit(c *models.Commit, cherryPickedCom truncatedAuthor := utils.TruncateWithEllipsis(c.Author, 17) - return []string{shaColor.Sprint(c.ShortSha()), secondColumnString, yellow.Sprint(truncatedAuthor), tagString + defaultColor.Sprint(c.Name)} + name := c.Name + if parseEmoji { + name = emoji.Sprint(name) + } + + return []string{shaColor.Sprint(c.ShortSha()), secondColumnString, yellow.Sprint(truncatedAuthor), tagString + defaultColor.Sprint(name)} } -func getDisplayStringsForCommit(c *models.Commit, cherryPickedCommitShaMap map[string]bool, diffed bool) []string { +func getDisplayStringsForCommit(c *models.Commit, cherryPickedCommitShaMap map[string]bool, diffed, parseEmoji bool) []string { red := color.New(color.FgRed) yellow := color.New(color.FgYellow) green := color.New(color.FgGreen) @@ -120,7 +126,12 @@ func getDisplayStringsForCommit(c *models.Commit, cherryPickedCommitShaMap map[s tagString = utils.ColoredStringDirect(strings.Join(c.Tags, " "), tagColor) + " " } - return []string{shaColor.Sprint(c.ShortSha()), actionString + tagString + defaultColor.Sprint(c.Name)} + name := c.Name + if parseEmoji { + name = emoji.Sprint(name) + } + + return []string{shaColor.Sprint(c.ShortSha()), actionString + tagString + defaultColor.Sprint(name)} } func actionColorMap(str string) color.Attribute { diff --git a/pkg/gui/presentation/reflog_commits.go b/pkg/gui/presentation/reflog_commits.go index d435c1387..31a125e32 100644 --- a/pkg/gui/presentation/reflog_commits.go +++ b/pkg/gui/presentation/reflog_commits.go @@ -5,12 +5,13 @@ import ( "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/theme" "github.com/jesseduffield/lazygit/pkg/utils" + "github.com/kyokomi/emoji/v2" ) -func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, cherryPickedCommitShaMap map[string]bool, diffName string) [][]string { +func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, cherryPickedCommitShaMap map[string]bool, diffName string, parseEmoji bool) [][]string { lines := make([][]string, len(commits)) - var displayFunc func(*models.Commit, map[string]bool, bool) []string + var displayFunc func(*models.Commit, map[string]bool, bool, bool) []string if fullDescription { displayFunc = getFullDescriptionDisplayStringsForReflogCommit } else { @@ -19,7 +20,7 @@ func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription for i := range commits { diffed := commits[i].Sha == diffName - lines[i] = displayFunc(commits[i], cherryPickedCommitShaMap, diffed) + lines[i] = displayFunc(commits[i], cherryPickedCommitShaMap, diffed, parseEmoji) } return lines @@ -36,24 +37,34 @@ func coloredReflogSha(c *models.Commit, cherryPickedCommitShaMap map[string]bool return shaColor.Sprint(c.ShortSha()) } -func getFullDescriptionDisplayStringsForReflogCommit(c *models.Commit, cherryPickedCommitShaMap map[string]bool, diffed bool) []string { +func getFullDescriptionDisplayStringsForReflogCommit(c *models.Commit, cherryPickedCommitShaMap map[string]bool, diffed, parseEmoji bool) []string { colorAttr := theme.DefaultTextColor if diffed { colorAttr = theme.DiffTerminalColor } + name := c.Name + if parseEmoji { + name = emoji.Sprint(name) + } + return []string{ coloredReflogSha(c, cherryPickedCommitShaMap), utils.ColoredString(utils.UnixToDate(c.UnixTimestamp), color.FgMagenta), - utils.ColoredString(c.Name, colorAttr), + utils.ColoredString(name, colorAttr), } } -func getDisplayStringsForReflogCommit(c *models.Commit, cherryPickedCommitShaMap map[string]bool, diffed bool) []string { +func getDisplayStringsForReflogCommit(c *models.Commit, cherryPickedCommitShaMap map[string]bool, diffed, parseEmoji bool) []string { defaultColor := color.New(theme.DefaultTextColor) + name := c.Name + if parseEmoji { + name = emoji.Sprint(name) + } + return []string{ coloredReflogSha(c, cherryPickedCommitShaMap), - defaultColor.Sprint(c.Name), + defaultColor.Sprint(name), } } diff --git a/vendor/github.com/kyokomi/emoji/v2/.gitignore b/vendor/github.com/kyokomi/emoji/v2/.gitignore new file mode 100644 index 000000000..8cd9b9168 --- /dev/null +++ b/vendor/github.com/kyokomi/emoji/v2/.gitignore @@ -0,0 +1,2 @@ +.idea +emoji.iml diff --git a/vendor/github.com/kyokomi/emoji/v2/LICENSE b/vendor/github.com/kyokomi/emoji/v2/LICENSE new file mode 100644 index 000000000..239874e0c --- /dev/null +++ b/vendor/github.com/kyokomi/emoji/v2/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 kyokomi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/kyokomi/emoji/v2/README.md b/vendor/github.com/kyokomi/emoji/v2/README.md new file mode 100644 index 000000000..e60459859 --- /dev/null +++ b/vendor/github.com/kyokomi/emoji/v2/README.md @@ -0,0 +1,53 @@ +# Emoji +Emoji is a simple golang package. + +[![wercker status](https://app.wercker.com/status/7bef60de2c6d3e0e6c13d56b2393c5d8/s/master "wercker status")](https://app.wercker.com/project/byKey/7bef60de2c6d3e0e6c13d56b2393c5d8) +[![Coverage Status](https://coveralls.io/repos/kyokomi/emoji/badge.png?branch=master)](https://coveralls.io/r/kyokomi/emoji?branch=master) +[![GoDoc](https://pkg.go.dev/badge/github.com/kyokomi/emoji.svg)](https://pkg.go.dev/github.com/kyokomi/emoji/v2) + +Get it: + +``` +go get github.com/kyokomi/emoji/v2 +``` + +Import it: + +``` +import ( + "github.com/kyokomi/emoji/v2" +) +``` + +## Usage + +```go +package main + +import ( + "fmt" + + "github.com/kyokomi/emoji/v2" +) + +func main() { + fmt.Println("Hello World Emoji!") + + emoji.Println(":beer: Beer!!!") + + pizzaMessage := emoji.Sprint("I like a :pizza: and :sushi:!!") + fmt.Println(pizzaMessage) +} +``` + +## Demo + +![demo](screen/image.png) + +## Reference + +- [unicode Emoji Charts](http://www.unicode.org/emoji/charts/emoji-list.html) + +## License + +[MIT](https://github.com/kyokomi/emoji/blob/master/LICENSE) diff --git a/vendor/github.com/kyokomi/emoji/v2/emoji.go b/vendor/github.com/kyokomi/emoji/v2/emoji.go new file mode 100644 index 000000000..6913a2ea4 --- /dev/null +++ b/vendor/github.com/kyokomi/emoji/v2/emoji.go @@ -0,0 +1,157 @@ +// Package emoji terminal output. +package emoji + +import ( + "bytes" + "errors" + "fmt" + "io" + "regexp" + "unicode" +) + +//go:generate generateEmojiCodeMap -pkg emoji -o emoji_codemap.go + +// Replace Padding character for emoji. +var ( + ReplacePadding = " " +) + +// CodeMap gets the underlying map of emoji. +func CodeMap() map[string]string { + return emojiCode() +} + +// RevCodeMap gets the underlying map of emoji. +func RevCodeMap() map[string][]string { + return emojiRevCode() +} + +func AliasList(shortCode string) []string { + return emojiRevCode()[emojiCode()[shortCode]] +} + +// HasAlias flags if the given `shortCode` has multiple aliases with other +// codes. +func HasAlias(shortCode string) bool { + return len(AliasList(shortCode)) > 1 +} + +// NormalizeShortCode normalizes a given `shortCode` to a deterministic alias. +func NormalizeShortCode(shortCode string) string { + shortLists := AliasList(shortCode) + if len(shortLists) == 0 { + return shortCode + } + return shortLists[0] +} + +// regular expression that matches :flag-[countrycode]: +var flagRegexp = regexp.MustCompile(":flag-([a-z]{2}):") + +func emojize(x string) string { + str, ok := emojiCode()[x] + if ok { + return str + ReplacePadding + } + if match := flagRegexp.FindStringSubmatch(x); len(match) == 2 { + return regionalIndicator(match[1][0]) + regionalIndicator(match[1][1]) + } + return x +} + +// regionalIndicator maps a lowercase letter to a unicode regional indicator +func regionalIndicator(i byte) string { + return string('\U0001F1E6' + rune(i) - 'a') +} + +func replaseEmoji(input *bytes.Buffer) string { + emoji := bytes.NewBufferString(":") + for { + i, _, err := input.ReadRune() + if err != nil { + // not replase + return emoji.String() + } + + if i == ':' && emoji.Len() == 1 { + return emoji.String() + replaseEmoji(input) + } + + emoji.WriteRune(i) + switch { + case unicode.IsSpace(i): + return emoji.String() + case i == ':': + return emojize(emoji.String()) + } + } +} + +func compile(x string) string { + if x == "" { + return "" + } + + input := bytes.NewBufferString(x) + output := bytes.NewBufferString("") + + for { + i, _, err := input.ReadRune() + if err != nil { + break + } + switch i { + default: + output.WriteRune(i) + case ':': + output.WriteString(replaseEmoji(input)) + } + } + return output.String() +} + +// Print is fmt.Print which supports emoji +func Print(a ...interface{}) (int, error) { + return fmt.Print(compile(fmt.Sprint(a...))) +} + +// Println is fmt.Println which supports emoji +func Println(a ...interface{}) (int, error) { + return fmt.Println(compile(fmt.Sprint(a...))) +} + +// Printf is fmt.Printf which supports emoji +func Printf(format string, a ...interface{}) (int, error) { + return fmt.Print(compile(fmt.Sprintf(format, a...))) +} + +// Fprint is fmt.Fprint which supports emoji +func Fprint(w io.Writer, a ...interface{}) (int, error) { + return fmt.Fprint(w, compile(fmt.Sprint(a...))) +} + +// Fprintln is fmt.Fprintln which supports emoji +func Fprintln(w io.Writer, a ...interface{}) (int, error) { + return fmt.Fprintln(w, compile(fmt.Sprint(a...))) +} + +// Fprintf is fmt.Fprintf which supports emoji +func Fprintf(w io.Writer, format string, a ...interface{}) (int, error) { + return fmt.Fprint(w, compile(fmt.Sprintf(format, a...))) +} + +// Sprint is fmt.Sprint which supports emoji +func Sprint(a ...interface{}) string { + return compile(fmt.Sprint(a...)) +} + +// Sprintf is fmt.Sprintf which supports emoji +func Sprintf(format string, a ...interface{}) string { + return compile(fmt.Sprintf(format, a...)) +} + +// Errorf is fmt.Errorf which supports emoji +func Errorf(format string, a ...interface{}) error { + return errors.New(compile(Sprintf(format, a...))) +} diff --git a/vendor/github.com/kyokomi/emoji/v2/emoji_codemap.go b/vendor/github.com/kyokomi/emoji/v2/emoji_codemap.go new file mode 100644 index 000000000..9a9d73b05 --- /dev/null +++ b/vendor/github.com/kyokomi/emoji/v2/emoji_codemap.go @@ -0,0 +1,7715 @@ +package emoji + +import ( + "sync" +) + +// NOTE: THIS FILE WAS PRODUCED BY THE +// EMOJICODEMAP CODE GENERATION TOOL (github.com/kyokomi/emoji/cmd/generateEmojiCodeMap) +// DO NOT EDIT + +var emojiCodeMap map[string]string +var emojiCodeMapInitOnce = sync.Once{} + +func emojiCode() map[string]string { + emojiCodeMapInitOnce.Do(func() { + emojiCodeMap = map[string]string{ + ":+1:": "\U0001f44d", + ":-1:": "\U0001f44e", + ":100:": "\U0001f4af", + ":1234:": "\U0001f522", + ":1st_place_medal:": "\U0001f947", + ":2nd_place_medal:": "\U0001f948", + ":3rd_place_medal:": "\U0001f949", + ":8ball:": "\U0001f3b1", + ":AB_button_(blood_type):": "\U0001f18e", + ":ATM_sign:": "\U0001f3e7", + ":A_button_(blood_type):": "\U0001f170", + ":Aquarius:": "\u2652", + ":Aries:": "\u2648", + ":BACK_arrow:": "\U0001f519", + ":B_button_(blood_type):": "\U0001f171", + ":CL_button:": "\U0001f191", + ":COOL_button:": "\U0001f192", + ":Cancer:": "\u264b", + ":Capricorn:": "\u2651", + ":Christmas_tree:": "\U0001f384", + ":END_arrow:": "\U0001f51a", + ":FREE_button:": "\U0001f193", + ":Gemini:": "\u264a", + ":ID_button:": "\U0001f194", + ":Japanese_acceptable_button:": "\U0001f251", + ":Japanese_application_button:": "\U0001f238", + ":Japanese_bargain_button:": "\U0001f250", + ":Japanese_castle:": "\U0001f3ef", + ":Japanese_congratulations_button:": "\u3297", + ":Japanese_discount_button:": "\U0001f239", + ":Japanese_dolls:": "\U0001f38e", + ":Japanese_free_of_charge_button:": "\U0001f21a", + ":Japanese_here_button:": "\U0001f201", + ":Japanese_monthly_amount_button:": "\U0001f237", + ":Japanese_no_vacancy_button:": "\U0001f235", + ":Japanese_not_free_of_charge_button:": "\U0001f236", + ":Japanese_open_for_business_button:": "\U0001f23a", + ":Japanese_passing_grade_button:": "\U0001f234", + ":Japanese_post_office:": "\U0001f3e3", + ":Japanese_prohibited_button:": "\U0001f232", + ":Japanese_reserved_button:": "\U0001f22f", + ":Japanese_secret_button:": "\u3299", + ":Japanese_service_charge_button:": "\U0001f202", + ":Japanese_symbol_for_beginner:": "\U0001f530", + ":Japanese_vacancy_button:": "\U0001f233", + ":Leo:": "\u264c", + ":Libra:": "\u264e", + ":Mrs._Claus:": "\U0001f936", + ":NEW_button:": "\U0001f195", + ":NG_button:": "\U0001f196", + ":OK_button:": "\U0001f197", + ":OK_hand:": "\U0001f44c", + ":ON!_ar |