Skip to content

Commit 4a67425

Browse files
authored
Merge pull request #522 from ccoVeille/receiver-cleanup
receiver cleanup
2 parents f883dcc + 363dfc7 commit 4a67425

22 files changed

+76
-76
lines changed

oviewer/content.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -286,18 +286,18 @@ func (es *parseState) parseEscapeSequence(mainc rune) bool {
286286
}
287287

288288
// overstrike set style for overstrike.
289-
func (state *parseState) overstrike(m content, style tcell.Style) tcell.Style {
290-
if !state.bsFlag {
289+
func (es *parseState) overstrike(m content, style tcell.Style) tcell.Style {
290+
if !es.bsFlag {
291291
return style
292292
}
293293

294-
if state.bsContent.mainc == m.mainc {
294+
if es.bsContent.mainc == m.mainc {
295295
style = OverStrikeStyle
296-
} else if state.bsContent.mainc == '_' {
296+
} else if es.bsContent.mainc == '_' {
297297
style = OverLineStyle
298298
}
299-
state.bsFlag = false
300-
state.bsContent = DefaultContent
299+
es.bsFlag = false
300+
es.bsContent = DefaultContent
301301
return style
302302
}
303303

oviewer/draw.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ func (root *Root) drawNoWrapLine(y int, startX int, lN int, lc contents) (int, i
296296

297297
// bodyStyle applies the style from the beginning to the end of one line of the body.
298298
// Apply style to contents.
299-
func (root *Root) bodyStyle(lc contents, s OVStyle) {
299+
func (*Root) bodyStyle(lc contents, s OVStyle) {
300300
RangeStyle(lc, 0, len(lc), s)
301301
}
302302

@@ -314,7 +314,7 @@ func (root *Root) searchHighlight(line LineC) {
314314
}
315315

316316
// plainStyle defaults to the original style.
317-
func (root *Root) plainStyle(lc contents) {
317+
func (*Root) plainStyle(lc contents) {
318318
for x := 0; x < len(lc); x++ {
319319
lc[x].style = tcell.StyleDefault
320320
}

oviewer/event.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ type eventCloseDocument struct {
277277
}
278278

279279
// CloseDocument fires the eventCloseDocument event.
280-
func (root *Root) CloseDocument(m *Document) {
280+
func (root *Root) CloseDocument(_ *Document) {
281281
root.sendCloseDocument()
282282
}
283283

oviewer/input_delimiter.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ func newDelimiterEvent(clist *candidate) *eventDelimiter {
4141
}
4242

4343
// Mode returns InputMode.
44-
func (e *eventDelimiter) Mode() InputMode {
44+
func (*eventDelimiter) Mode() InputMode {
4545
return Delimiter
4646
}
4747

4848
// Prompt returns the prompt string in the input field.
49-
func (e *eventDelimiter) Prompt() string {
49+
func (*eventDelimiter) Prompt() string {
5050
return "Delimiter:"
5151
}
5252

@@ -59,11 +59,11 @@ func (e *eventDelimiter) Confirm(str string) tcell.Event {
5959
}
6060

6161
// Up returns strings when the up key is pressed during input.
62-
func (e *eventDelimiter) Up(str string) string {
62+
func (e *eventDelimiter) Up(_ string) string {
6363
return e.clist.up()
6464
}
6565

6666
// Down returns strings when the down key is pressed during input.
67-
func (e *eventDelimiter) Down(str string) string {
67+
func (e *eventDelimiter) Down(_ string) string {
6868
return e.clist.down()
6969
}

oviewer/input_filter.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ func newSearchFilterEvent(clist *candidate) *eventInputFilter {
3535
}
3636

3737
// Mode returns InputMode.
38-
func (e *eventInputFilter) Mode() InputMode {
38+
func (*eventInputFilter) Mode() InputMode {
3939
return Filter
4040
}
4141

4242
// Prompt returns the prompt string in the input field.
43-
func (e *eventInputFilter) Prompt() string {
43+
func (*eventInputFilter) Prompt() string {
4444
return "&"
4545
}
4646

oviewer/input_goto.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ func newGotoEvent(clist *candidate) *eventGoto {
3030
}
3131

3232
// Mode returns InputMode.
33-
func (e *eventGoto) Mode() InputMode {
33+
func (*eventGoto) Mode() InputMode {
3434
return Goline
3535
}
3636

3737
// Prompt returns the prompt string in the input field.
38-
func (e *eventGoto) Prompt() string {
38+
func (*eventGoto) Prompt() string {
3939
return "Goto line:"
4040
}
4141

@@ -48,11 +48,11 @@ func (e *eventGoto) Confirm(str string) tcell.Event {
4848
}
4949

5050
// Up returns strings when the up key is pressed during input.
51-
func (e *eventGoto) Up(str string) string {
51+
func (e *eventGoto) Up(_ string) string {
5252
return e.clist.up()
5353
}
5454

5555
// Down returns strings when the down key is pressed during input.
56-
func (e *eventGoto) Down(str string) string {
56+
func (e *eventGoto) Down(_ string) string {
5757
return e.clist.down()
5858
}

oviewer/input_header.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ func newHeaderEvent() *eventHeader {
2626
}
2727

2828
// Mode returns InputMode.
29-
func (e *eventHeader) Mode() InputMode {
29+
func (*eventHeader) Mode() InputMode {
3030
return Header
3131
}
3232

3333
// Prompt returns the prompt string in the input field.
34-
func (e *eventHeader) Prompt() string {
34+
func (*eventHeader) Prompt() string {
3535
return "Header length:"
3636
}
3737

@@ -43,7 +43,7 @@ func (e *eventHeader) Confirm(str string) tcell.Event {
4343
}
4444

4545
// Up returns strings when the up key is pressed during input.
46-
func (e *eventHeader) Up(str string) string {
46+
func (*eventHeader) Up(str string) string {
4747
n, err := strconv.Atoi(str)
4848
if err != nil {
4949
return "0"
@@ -52,7 +52,7 @@ func (e *eventHeader) Up(str string) string {
5252
}
5353

5454
// Down returns strings when the down key is pressed during input.
55-
func (e *eventHeader) Down(str string) string {
55+
func (*eventHeader) Down(str string) string {
5656
n, err := strconv.Atoi(str)
5757
if err != nil || n <= 0 {
5858
return "0"

oviewer/input_jumptarget.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ func newJumpTargetEvent(clist *candidate) *eventJumpTarget {
3737
}
3838

3939
// Mode returns InputMode.
40-
func (e *eventJumpTarget) Mode() InputMode {
40+
func (*eventJumpTarget) Mode() InputMode {
4141
return JumpTarget
4242
}
4343

4444
// Prompt returns the prompt string in the input field.
45-
func (e *eventJumpTarget) Prompt() string {
45+
func (*eventJumpTarget) Prompt() string {
4646
return "Jump Target line:"
4747
}
4848

@@ -55,11 +55,11 @@ func (e *eventJumpTarget) Confirm(str string) tcell.Event {
5555
}
5656

5757
// Up returns strings when the up key is pressed during input.
58-
func (e *eventJumpTarget) Up(str string) string {
58+
func (e *eventJumpTarget) Up(_ string) string {
5959
return e.clist.up()
6060
}
6161

6262
// Down returns strings when the down key is pressed during input.
63-
func (e *eventJumpTarget) Down(str string) string {
63+
func (e *eventJumpTarget) Down(_ string) string {
6464
return e.clist.down()
6565
}

oviewer/input_multicolor.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ func newMultiColorEvent(clist *candidate) *eventMultiColor {
4545
}
4646

4747
// Mode returns InputMode.
48-
func (e *eventMultiColor) Mode() InputMode {
48+
func (*eventMultiColor) Mode() InputMode {
4949
return MultiColor
5050
}
5151

5252
// Prompt returns the prompt string in the input field.
53-
func (e *eventMultiColor) Prompt() string {
53+
func (*eventMultiColor) Prompt() string {
5454
return "multicolor:"
5555
}
5656

oviewer/input_normal.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@ func normal() *eventNormal {
1414
}
1515

1616
// Mode returns InputMode.
17-
func (e *eventNormal) Mode() InputMode {
17+
func (*eventNormal) Mode() InputMode {
1818
return Normal
1919
}
2020

2121
// Prompt returns the prompt string in the input field.
22-
func (e *eventNormal) Prompt() string {
22+
func (*eventNormal) Prompt() string {
2323
return ""
2424
}
2525

2626
// Confirm returns the event when the input is confirmed.
27-
func (e *eventNormal) Confirm(str string) tcell.Event {
27+
func (*eventNormal) Confirm(_ string) tcell.Event {
2828
return nil
2929
}
3030

3131
// Up returns strings when the up key is pressed during input.
32-
func (e *eventNormal) Up(str string) string {
32+
func (*eventNormal) Up(_ string) string {
3333
return ""
3434
}
3535

3636
// Down returns strings when the down key is pressed during input.
37-
func (e *eventNormal) Down(str string) string {
37+
func (*eventNormal) Down(_ string) string {
3838
return ""
3939
}

oviewer/input_savebuffer.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ func newSaveBufferEvent(clist *candidate) *eventSaveBuffer {
3939
}
4040

4141
// Mode returns InputMode.
42-
func (e *eventSaveBuffer) Mode() InputMode {
42+
func (*eventSaveBuffer) Mode() InputMode {
4343
return SaveBuffer
4444
}
4545

4646
// Prompt returns the prompt string in the input field.
47-
func (e *eventSaveBuffer) Prompt() string {
47+
func (*eventSaveBuffer) Prompt() string {
4848
return "(Save)file:"
4949
}
5050

@@ -56,11 +56,11 @@ func (e *eventSaveBuffer) Confirm(str string) tcell.Event {
5656
}
5757

5858
// Up returns strings when the up key is pressed during input.
59-
func (e *eventSaveBuffer) Up(str string) string {
59+
func (e *eventSaveBuffer) Up(_ string) string {
6060
return e.clist.up()
6161
}
6262

6363
// Down returns strings when the down key is pressed during input.
64-
func (e *eventSaveBuffer) Down(str string) string {
64+
func (e *eventSaveBuffer) Down(_ string) string {
6565
return e.clist.down()
6666
}

oviewer/input_search.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ func newSearchEvent(clist *candidate) *eventInputSearch {
4343
}
4444

4545
// Mode returns InputMode.
46-
func (e *eventInputSearch) Mode() InputMode {
46+
func (*eventInputSearch) Mode() InputMode {
4747
return Search
4848
}
4949

5050
// Prompt returns the prompt string in the input field.
51-
func (e *eventInputSearch) Prompt() string {
51+
func (*eventInputSearch) Prompt() string {
5252
return "/"
5353
}
5454

@@ -100,12 +100,12 @@ func newBackSearchEvent(clist *candidate) *eventInputBackSearch {
100100
}
101101

102102
// Mode returns InputMode.
103-
func (e *eventInputBackSearch) Mode() InputMode {
103+
func (*eventInputBackSearch) Mode() InputMode {
104104
return Backsearch
105105
}
106106

107107
// Prompt returns the prompt string in the input field.
108-
func (e *eventInputBackSearch) Prompt() string {
108+
func (*eventInputBackSearch) Prompt() string {
109109
return "?"
110110
}
111111

oviewer/input_section_delimiter.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ func newSectionDelimiterEvent(clist *candidate) *eventSectionDelimiter {
3939
}
4040

4141
// Mode returns InputMode.
42-
func (e *eventSectionDelimiter) Mode() InputMode {
42+
func (*eventSectionDelimiter) Mode() InputMode {
4343
return SectionDelimiter
4444
}
4545

4646
// Prompt returns the prompt string in the input field.
47-
func (e *eventSectionDelimiter) Prompt() string {
47+
func (*eventSectionDelimiter) Prompt() string {
4848
return "Section delimiter:"
4949
}
5050

@@ -57,11 +57,11 @@ func (e *eventSectionDelimiter) Confirm(str string) tcell.Event {
5757
}
5858

5959
// Up returns strings when the up key is pressed during input.
60-
func (e *eventSectionDelimiter) Up(str string) string {
60+
func (e *eventSectionDelimiter) Up(_ string) string {
6161
return e.clist.up()
6262
}
6363

6464
// Down returns strings when the down key is pressed during input.
65-
func (e *eventSectionDelimiter) Down(str string) string {
65+
func (e *eventSectionDelimiter) Down(_ string) string {
6666
return e.clist.down()
6767
}

oviewer/input_section_num.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ func newSectionNumEvent() *eventSectionNum {
2626
}
2727

2828
// Mode returns InputMode.
29-
func (e *eventSectionNum) Mode() InputMode {
29+
func (*eventSectionNum) Mode() InputMode {
3030
return SectionNum
3131
}
3232

3333
// Prompt returns the prompt string in the input field.
34-
func (e *eventSectionNum) Prompt() string {
34+
func (*eventSectionNum) Prompt() string {
3535
return "Section Num:"
3636
}
3737

@@ -43,7 +43,7 @@ func (e *eventSectionNum) Confirm(str string) tcell.Event {
4343
}
4444

4545
// Up returns strings when the up key is pressed during input.
46-
func (e *eventSectionNum) Up(str string) string {
46+
func (*eventSectionNum) Up(str string) string {
4747
n, err := strconv.Atoi(str)
4848
if err != nil {
4949
return "0"
@@ -52,7 +52,7 @@ func (e *eventSectionNum) Up(str string) string {
5252
}
5353

5454
// Down returns strings when the down key is pressed during input.
55-
func (e *eventSectionNum) Down(str string) string {
55+
func (*eventSectionNum) Down(str string) string {
5656
n, err := strconv.Atoi(str)
5757
if err != nil || n <= 0 {
5858
return "0"

oviewer/input_section_start.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ func newSectionStartEvent(clist *candidate) *eventSectionStart {
3434
}
3535

3636
// Mode returns InputMode.
37-
func (e *eventSectionStart) Mode() InputMode {
37+
func (*eventSectionStart) Mode() InputMode {
3838
return SectionStart
3939
}
4040

4141
// Prompt returns the prompt string in the input field.
42-
func (e *eventSectionStart) Prompt() string {
42+
func (*eventSectionStart) Prompt() string {
4343
return "Section start:"
4444
}
4545

@@ -52,11 +52,11 @@ func (e *eventSectionStart) Confirm(str string) tcell.Event {
5252
}
5353

5454
// Up returns strings when the up key is pressed during input.
55-
func (e *eventSectionStart) Up(str string) string {
55+
func (e *eventSectionStart) Up(_ string) string {
5656
return e.clist.up()
5757
}
5858

5959
// Down returns strings when the down key is pressed during input.
60-
func (e *eventSectionStart) Down(str string) string {
60+
func (e *eventSectionStart) Down(_ string) string {
6161
return e.clist.down()
6262
}

0 commit comments

Comments
 (0)