mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-10 04:07:18 +02:00
more consistent rendering
This commit is contained in:
parent
06ca71e955
commit
9a9e3d506d
@ -23,6 +23,7 @@ import (
|
|||||||
"github.com/jesseduffield/lazygit/pkg/gui/modes/diffing"
|
"github.com/jesseduffield/lazygit/pkg/gui/modes/diffing"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/modes/filtering"
|
"github.com/jesseduffield/lazygit/pkg/gui/modes/filtering"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/presentation/authors"
|
"github.com/jesseduffield/lazygit/pkg/gui/presentation/authors"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/presentation/graph"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
"github.com/jesseduffield/lazygit/pkg/i18n"
|
"github.com/jesseduffield/lazygit/pkg/i18n"
|
||||||
@ -462,8 +463,8 @@ func NewGui(log *logrus.Entry, gitCommand *commands.GitCommand, oSCommand *oscom
|
|||||||
|
|
||||||
var RuneReplacements = map[rune]string{
|
var RuneReplacements = map[rune]string{
|
||||||
// for the commit graph
|
// for the commit graph
|
||||||
'⏣': "M",
|
graph.MergeSymbol: "M",
|
||||||
'⎔': "o",
|
graph.CommitSymbol: "o",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run setup the gui with keybindings and start the mainloop
|
// Run setup the gui with keybindings and start the mainloop
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
||||||
)
|
)
|
||||||
|
|
||||||
const mergeSymbol = "⏣"
|
const MergeSymbol = '⏣'
|
||||||
const commitSymbol = "⎔"
|
const CommitSymbol = '◯'
|
||||||
|
|
||||||
type cellType int
|
type cellType int
|
||||||
|
|
||||||
@ -35,9 +35,9 @@ func (cell *Cell) render(writer io.StringWriter) {
|
|||||||
case CONNECTION:
|
case CONNECTION:
|
||||||
adjustedFirst = first
|
adjustedFirst = first
|
||||||
case COMMIT:
|
case COMMIT:
|
||||||
adjustedFirst = commitSymbol
|
adjustedFirst = string(CommitSymbol)
|
||||||
case MERGE:
|
case MERGE:
|
||||||
adjustedFirst = mergeSymbol
|
adjustedFirst = string(MergeSymbol)
|
||||||
}
|
}
|
||||||
|
|
||||||
var rightStyle *style.TextStyle
|
var rightStyle *style.TextStyle
|
||||||
|
@ -45,20 +45,20 @@ func TestRenderCommitGraph(t *testing.T) {
|
|||||||
{Sha: "D", Parents: []string{"G"}},
|
{Sha: "D", Parents: []string{"G"}},
|
||||||
},
|
},
|
||||||
expectedOutput: `
|
expectedOutput: `
|
||||||
1 ⎔
|
1 ◯
|
||||||
2 ⎔
|
2 ◯
|
||||||
3 ⎔
|
3 ◯
|
||||||
4 ⏣─╮
|
4 ⏣─╮
|
||||||
7 │ ⎔
|
7 │ ◯
|
||||||
5 ⎔─╯
|
5 ◯─╯
|
||||||
8 ⎔
|
8 ◯
|
||||||
9 ⏣─╮
|
9 ⏣─╮
|
||||||
B │ ⎔
|
B │ ◯
|
||||||
D │ ⎔
|
D │ ◯
|
||||||
A ⎔ │
|
A ◯ │
|
||||||
E ⎔ │
|
E ◯ │
|
||||||
F ⎔ │
|
F ◯ │
|
||||||
D ⎔─╯`,
|
D ◯─╯`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "with a path that has room to move to the left",
|
name: "with a path that has room to move to the left",
|
||||||
@ -71,12 +71,12 @@ func TestRenderCommitGraph(t *testing.T) {
|
|||||||
{Sha: "6", Parents: []string{"7"}},
|
{Sha: "6", Parents: []string{"7"}},
|
||||||
},
|
},
|
||||||
expectedOutput: `
|
expectedOutput: `
|
||||||
1 ⎔
|
1 ◯
|
||||||
2 ⏣─╮
|
2 ⏣─╮
|
||||||
4 │ ⏣─╮
|
4 │ ⏣─╮
|
||||||
3 ⎔─╯ │
|
3 ◯─╯ │
|
||||||
5 ⎔───╯
|
5 ◯───╯
|
||||||
6 ⎔`,
|
6 ◯`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "with a new commit",
|
name: "with a new commit",
|
||||||
@ -90,13 +90,13 @@ func TestRenderCommitGraph(t *testing.T) {
|
|||||||
{Sha: "6", Parents: []string{"7"}},
|
{Sha: "6", Parents: []string{"7"}},
|
||||||
},
|
},
|
||||||
expectedOutput: `
|
expectedOutput: `
|
||||||
1 ⎔
|
1 ◯
|
||||||
2 ⏣─╮
|
2 ⏣─╮
|
||||||
4 │ ⏣─╮
|
4 │ ⏣─╮
|
||||||
Z │ │ │ ⎔
|
Z │ │ │ ◯
|
||||||
3 ⎔─╯ │ │
|
3 ◯─╯ │ │
|
||||||
5 ⎔───╯ │
|
5 ◯───╯ │
|
||||||
6 ⎔ ╭───╯`,
|
6 ◯ ╭───╯`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "with a path that has room to move to the left and continues",
|
name: "with a path that has room to move to the left and continues",
|
||||||
@ -109,12 +109,12 @@ func TestRenderCommitGraph(t *testing.T) {
|
|||||||
{Sha: "7", Parents: []string{"11"}},
|
{Sha: "7", Parents: []string{"11"}},
|
||||||
},
|
},
|
||||||
expectedOutput: `
|
expectedOutput: `
|
||||||
1 ⎔
|
1 ◯
|
||||||
2 ⏣─╮
|
2 ⏣─╮
|
||||||
3 ⏣─│─╮
|
3 ⏣─│─╮
|
||||||
5 ⏣─│─│─╮
|
5 ⏣─│─│─╮
|
||||||
4 │ ⎔─╯ │
|
4 │ ◯─╯ │
|
||||||
7 ⎔─╯ ╭─╯`,
|
7 ◯─╯ ╭─╯`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "with a path that has room to move to the left and continues",
|
name: "with a path that has room to move to the left and continues",
|
||||||
@ -128,13 +128,13 @@ func TestRenderCommitGraph(t *testing.T) {
|
|||||||
{Sha: "B", Parents: []string{"C"}},
|
{Sha: "B", Parents: []string{"C"}},
|
||||||
},
|
},
|
||||||
expectedOutput: `
|
expectedOutput: `
|
||||||
1 ⎔
|
1 ◯
|
||||||
2 ⏣─╮
|
2 ⏣─╮
|
||||||
3 ⏣─│─╮
|
3 ⏣─│─╮
|
||||||
5 ⏣─│─│─╮
|
5 ⏣─│─│─╮
|
||||||
7 ⏣─│─│─│─╮
|
7 ⏣─│─│─│─╮
|
||||||
4 ⎔─┴─╯ │ │
|
4 ◯─┴─╯ │ │
|
||||||
B ⎔ ╭───╯ │`,
|
B ◯ ╭───╯ │`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "with a path that has room to move to the left and continues",
|
name: "with a path that has room to move to the left and continues",
|
||||||
@ -147,10 +147,10 @@ func TestRenderCommitGraph(t *testing.T) {
|
|||||||
},
|
},
|
||||||
expectedOutput: `
|
expectedOutput: `
|
||||||
1 ⏣─╮
|
1 ⏣─╮
|
||||||
3 │ ⎔
|
3 │ ◯
|
||||||
2 ⏣─│
|
2 ⏣─│
|
||||||
4 ⏣─│─╮
|
4 ⏣─│─╮
|
||||||
6 ⎔ │ │`,
|
6 ◯ │ │`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "new merge path fills gap before continuing path on right",
|
name: "new merge path fills gap before continuing path on right",
|
||||||
@ -163,10 +163,10 @@ func TestRenderCommitGraph(t *testing.T) {
|
|||||||
},
|
},
|
||||||
expectedOutput: `
|
expectedOutput: `
|
||||||
1 ⏣─┬─┬─╮
|
1 ⏣─┬─┬─╮
|
||||||
4 │ │ ⎔ │
|
4 │ │ ◯ │
|
||||||
2 ⎔─│─╯ │
|
2 ◯─│─╯ │
|
||||||
A ⏣─│─╮ │
|
A ⏣─│─╮ │
|
||||||
B │ │ ⎔ │`,
|
B │ │ ◯ │`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "with a path that has room to move to the left and continues",
|
name: "with a path that has room to move to the left and continues",
|
||||||
@ -181,14 +181,14 @@ func TestRenderCommitGraph(t *testing.T) {
|
|||||||
{Sha: "C", Parents: []string{"D"}},
|
{Sha: "C", Parents: []string{"D"}},
|
||||||
},
|
},
|
||||||
expectedOutput: `
|
expectedOutput: `
|
||||||
1 ⎔
|
1 ◯
|
||||||
2 ⏣─╮
|
2 ⏣─╮
|
||||||
3 ⏣─│─╮
|
3 ⏣─│─╮
|
||||||
5 ⏣─│─│─╮
|
5 ⏣─│─│─╮
|
||||||
7 ⏣─│─│─│─╮
|
7 ⏣─│─│─│─╮
|
||||||
4 ⎔─┴─╯ │ │
|
4 ◯─┴─╯ │ │
|
||||||
B ⎔ ╭───╯ │
|
B ◯ ╭───╯ │
|
||||||
C ⎔ │ ╭───╯`,
|
C ◯ │ ╭───╯`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "with a path that has room to move to the left and continues",
|
name: "with a path that has room to move to the left and continues",
|
||||||
@ -205,16 +205,16 @@ func TestRenderCommitGraph(t *testing.T) {
|
|||||||
{Sha: "D", Parents: []string{"F"}},
|
{Sha: "D", Parents: []string{"F"}},
|
||||||
},
|
},
|
||||||
expectedOutput: `
|
expectedOutput: `
|
||||||
1 ⎔
|
1 ◯
|
||||||
2 ⏣─╮
|
2 ⏣─╮
|
||||||
3 ⏣─│─╮
|
3 ⏣─│─╮
|
||||||
5 ⏣─│─│─╮
|
5 ⏣─│─│─╮
|
||||||
7 ⏣─│─│─│─╮
|
7 ⏣─│─│─│─╮
|
||||||
8 ⏣─│─│─│─│─╮
|
8 ⏣─│─│─│─│─╮
|
||||||
4 ⎔─┴─╯ │ │ │
|
4 ◯─┴─╯ │ │ │
|
||||||
B ⎔ ╭───╯ │ │
|
B ◯ ╭───╯ │ │
|
||||||
C ⎔ │ ╭───╯ │
|
C ◯ │ ╭───╯ │
|
||||||
D ⎔ │ │ ╭───╯`,
|
D ◯ │ │ ╭───╯`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ func TestRenderPipeSet(t *testing.T) {
|
|||||||
{fromPos: 0, toPos: 0, fromSha: "b", toSha: "c", kind: STARTS, style: green},
|
{fromPos: 0, toPos: 0, fromSha: "b", toSha: "c", kind: STARTS, style: green},
|
||||||
},
|
},
|
||||||
prevCommit: &models.Commit{Sha: "a"},
|
prevCommit: &models.Commit{Sha: "a"},
|
||||||
expectedStr: "⎔",
|
expectedStr: "◯",
|
||||||
expectedStyles: []style.TextStyle{green},
|
expectedStyles: []style.TextStyle{green},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -279,7 +279,7 @@ func TestRenderPipeSet(t *testing.T) {
|
|||||||
{fromPos: 0, toPos: 0, fromSha: "selected", toSha: "c", kind: STARTS, style: green},
|
{fromPos: 0, toPos: 0, fromSha: "selected", toSha: "c", kind: STARTS, style: green},
|
||||||
},
|
},
|
||||||
prevCommit: &models.Commit{Sha: "a"},
|
prevCommit: &models.Commit{Sha: "a"},
|
||||||
expectedStr: "⎔",
|
expectedStr: "◯",
|
||||||
expectedStyles: []style.TextStyle{highlightStyle},
|
expectedStyles: []style.TextStyle{highlightStyle},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -349,7 +349,7 @@ func TestRenderPipeSet(t *testing.T) {
|
|||||||
{fromPos: 2, toPos: 0, fromSha: "c1", toSha: "a2", kind: TERMINATES, style: green},
|
{fromPos: 2, toPos: 0, fromSha: "c1", toSha: "a2", kind: TERMINATES, style: green},
|
||||||
},
|
},
|
||||||
prevCommit: &models.Commit{Sha: "a1"},
|
prevCommit: &models.Commit{Sha: "a1"},
|
||||||
expectedStr: "⎔─┴─╯",
|
expectedStr: "◯─┴─╯",
|
||||||
expectedStyles: []style.TextStyle{
|
expectedStyles: []style.TextStyle{
|
||||||
yellow, magenta, magenta, green, green,
|
yellow, magenta, magenta, green, green,
|
||||||
},
|
},
|
||||||
@ -406,7 +406,7 @@ func TestRenderPipeSet(t *testing.T) {
|
|||||||
{fromPos: 0, toPos: 0, fromSha: "a2", toSha: "a3", kind: STARTS, style: yellow},
|
{fromPos: 0, toPos: 0, fromSha: "a2", toSha: "a3", kind: STARTS, style: yellow},
|
||||||
},
|
},
|
||||||
prevCommit: &models.Commit{Sha: "selected"},
|
prevCommit: &models.Commit{Sha: "selected"},
|
||||||
expectedStr: "⎔",
|
expectedStr: "◯",
|
||||||
expectedStyles: []style.TextStyle{
|
expectedStyles: []style.TextStyle{
|
||||||
yellow,
|
yellow,
|
||||||
},
|
},
|
||||||
@ -418,7 +418,7 @@ func TestRenderPipeSet(t *testing.T) {
|
|||||||
{fromPos: 1, toPos: 1, fromSha: "selected", toSha: "b3", kind: CONTINUES, style: red},
|
{fromPos: 1, toPos: 1, fromSha: "selected", toSha: "b3", kind: CONTINUES, style: red},
|
||||||
},
|
},
|
||||||
prevCommit: &models.Commit{Sha: "selected"},
|
prevCommit: &models.Commit{Sha: "selected"},
|
||||||
expectedStr: "⎔ │",
|
expectedStr: "◯ │",
|
||||||
expectedStyles: []style.TextStyle{
|
expectedStyles: []style.TextStyle{
|
||||||
highlightStyle, nothing, highlightStyle,
|
highlightStyle, nothing, highlightStyle,
|
||||||
},
|
},
|
||||||
@ -431,7 +431,7 @@ func TestRenderPipeSet(t *testing.T) {
|
|||||||
{fromPos: 2, toPos: 2, fromSha: "selected", toSha: "b3", kind: CONTINUES, style: red},
|
{fromPos: 2, toPos: 2, fromSha: "selected", toSha: "b3", kind: CONTINUES, style: red},
|
||||||
},
|
},
|
||||||
prevCommit: &models.Commit{Sha: "selected"},
|
prevCommit: &models.Commit{Sha: "selected"},
|
||||||
expectedStr: "⎔ │ │",
|
expectedStr: "◯ │ │",
|
||||||
expectedStyles: []style.TextStyle{
|
expectedStyles: []style.TextStyle{
|
||||||
highlightStyle, nothing, green, nothing, highlightStyle,
|
highlightStyle, nothing, green, nothing, highlightStyle,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user