-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.go
70 lines (54 loc) · 1.04 KB
/
page.go
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
package peco
func (l *Location) SetColumn(n int) {
l.col = n
}
func (l Location) Column() int {
return l.col
}
func (l *Location) SetLineNumber(n int) {
l.lineno = n
}
func (l Location) LineNumber() int {
return l.lineno
}
func (l *Location) SetOffset(n int) {
l.offset = n
}
func (l Location) Offset() int {
return l.offset
}
func (l *Location) SetPerPage(n int) {
l.perPage = n
}
func (l Location) PerPage() int {
return l.perPage
}
func (l *Location) SetPage(n int) {
l.page = n
}
func (l Location) Page() int {
return l.page
}
func (l *Location) SetTotal(n int) {
l.total = n
}
func (l Location) Total() int {
return l.total
}
func (l *Location) SetMaxPage(n int) {
l.maxPage = n
}
func (l Location) MaxPage() int {
return l.maxPage
}
func (l Location) PageCrop() PageCrop {
return PageCrop{
perPage: l.perPage,
currentPage: l.page,
}
}
// Crop returns a new Buffer whose contents are
// bound within the given range
func (pf PageCrop) Crop(in Buffer) Buffer {
return NewFilteredBuffer(in, pf.currentPage, pf.perPage)
}