1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-03 00:57:52 +02:00

fix delta

This commit is contained in:
Jesse Duffield
2020-10-11 09:49:07 +11:00
parent 582fd24d78
commit b8ad1883f5
5 changed files with 71 additions and 8 deletions

View File

@ -400,6 +400,15 @@ func (v *View) Write(p []byte) (n int, err error) {
}
default:
cells := v.parseInput(ch)
if v.ei.instruction.kind != NONE {
switch v.ei.instruction.kind {
case ERASE_IN_LINE:
v.eraseInLine()
}
v.ei.instructionRead()
continue
}
if cells == nil {
continue
}
@ -416,6 +425,31 @@ func (v *View) Write(p []byte) (n int, err error) {
return len(p), nil
}
func (v *View) eraseInLine() {
code := v.ei.instruction.param1
switch code {
case 0:
// need to write till end of the line with cells containing the same bg colour as we currently have.
if len(v.lines) == 0 {
v.lines = append(v.lines, []cell{})
}
nl := len(v.lines)
width, _ := v.Size()
cellCount := width - len(v.lines[nl-1])
c := cell{
fgColor: v.ei.curFgColor,
bgColor: v.ei.curBgColor,
chr: ' ',
}
for i := 0; i < cellCount; i++ {
v.lines[nl-1] = append(v.lines[nl-1], c)
}
default:
// don't recognise sequence. Until we merge the gocui master branch we can't handle going backwards.
}
}
// parseInput parses char by char the input written to the View. It returns nil
// while processing ESC sequences. Otherwise, it returns a cell slice that
// contains the processed data.