Skip to content

Commit

Permalink
Add j and k for scrolling up and down
Browse files Browse the repository at this point in the history
  • Loading branch information
mkchoi212 committed Dec 30, 2017
1 parent 1a90d93 commit fb15258
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
17 changes: 17 additions & 0 deletions conflict.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ func (c *Conflict) getPaddingLines() (topPadding, bottomPadding []string) {

if c.topPeek >= start {
c.topPeek = start
} else if c.topPeek < 0 {
c.topPeek = 0
}

for _, l := range lines[start-c.topPeek : start] {
Expand All @@ -117,6 +119,8 @@ func (c *Conflict) getPaddingLines() (topPadding, bottomPadding []string) {

if c.bottomPeek >= len(lines)-c.End {
c.bottomPeek = len(lines) - c.End
} else if c.bottomPeek < 0 {
c.bottomPeek = 0
}

for _, l := range lines[end : end+c.bottomPeek] {
Expand Down Expand Up @@ -151,3 +155,16 @@ func nextConflict(g *gocui.Gui, v *gocui.View) error {
conflicts[cur].Select(g, false)
return nil
}

func scroll(g *gocui.Gui, c *Conflict, direction int) {
if direction == Up {
c.topPeek--
c.bottomPeek++
} else if direction == Down {
c.topPeek++
} else {
return
}

c.Select(g, false)
}
9 changes: 6 additions & 3 deletions summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ func printHelp(v *gocui.View) {
a - select left screen
d - select right screen
h - print help
q || Ctrl+c - quit application
j - scroll down
k - scroll up
h | ? - print help
q | Ctrl+c - quit
`
fmt.Fprintf(v, Purple(Regular, instruction))
fmt.Fprintf(v, Black(Regular, instruction))
}

func printSummary() {
Expand Down

0 comments on commit fb15258

Please sign in to comment.