File: conflict-with-context.riff-output

package info (click to toggle)
rust-riffdiff 3.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 5,784 kB
  • sloc: sh: 206; python: 132; makefile: 11
file content (84 lines) | stat: -rw-r--r-- 3,741 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
diff --cc m/search.go
index 5b67346,e5b580f..0000000
--- m/search.go
+++ m/search.go
@@@ -10,45 -6,9 +10,79 @@@ import 
  	"github.com/walles/moar/m/linenumbers"
  )
  
++<<<<<<< HEAD
 +func (p *Pager) scrollToSearchHits() {
 +	if p.searchPattern == nil {
 +		// This is not a search
 +		return
 +	}
 +
 +	lineNumber := p.scrollPosition.lineNumber(p)
 +	if lineNumber == nil {
 +		// No lines to search
 +		return
 +	}
 +
 +	firstHitPosition := p.findFirstHit(*lineNumber, nil, false)
 +	if firstHitPosition == nil && (*lineNumber != linenumbers.LineNumber{}) {
 +		// Try again from the top
 +		firstHitPosition = p.findFirstHit(linenumbers.LineNumber{}, lineNumber, false)
 +	}
 +	if firstHitPosition == nil {
 +		// No match, give up
 +		return
 +	}
 +
 +	if firstHitPosition.isVisible(p) {
 +		// Already on-screen, never mind
 +		return
 +	}
 +
 +	p.scrollPosition = *firstHitPosition
 +}
 +
 +// NOTE: When we search, we do that by looping over the *input lines*, not the
 +// screen lines. That's why startPosition is a LineNumber rather than a
 +// scrollPosition.
 +//
 +// The `beforePosition` parameter is exclusive, meaning that line will not be
 +// searched.
 +//
 +// For the actual searching, this method will call _findFirstHit() in parallel
 +// on multiple cores, to help large file search performance.
++||||||| parent of b835e9a (Fix the warnings)
++func (p *Pager) scrollToSearchHits() {
++	if p.searchPattern == nil {
++		// This is not a search
++		return
++	}
++
++	firstHitPosition := p.findFirstHit(*p.scrollPosition.lineNumber(p), nil, false)
++	if firstHitPosition == nil {
++		// Try again from the top
++		firstHitPosition = p.findFirstHit(linenumbers.LineNumber{}, p.scrollPosition.lineNumber(p), false)
++	}
++	if firstHitPosition == nil {
++		// No match, give up
++		return
++	}
++
++	if firstHitPosition.isVisible(p) {
++		// Already on-screen, never mind
++		return
++	}
++
++	p.scrollPosition = *firstHitPosition
++}
++
+ // NOTE: When we search, we do that by looping over the *input lines*, not
+ // the screen lines. That's why we're using a line number rather than a
+ // scrollPosition for searching.
++=======
+ // NOTE: When we search, we do that by looping over the *input lines*, not
+ // the screen lines. That's why we're using a line number rather than a
+ // scrollPosition for searching.
++>>>>>>> b835e9a (Fix the warnings)
  //
  // FIXME: We should take startPosition.deltaScreenLines into account as well!
  func (p *Pager) findFirstHit(startPosition linenumbers.LineNumber, beforePosition *linenumbers.LineNumber, backwards bool) *scrollPosition {