Skip to content

Commit 966a1c5

Browse files
committed
go fmt
1 parent 06ce0a7 commit 966a1c5

21 files changed

+568
-586
lines changed

editor/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ type statusLineConfig struct {
8787
}
8888

8989
type tabLineConfig struct {
90-
Visible bool
91-
ShowIcon bool
90+
Visible bool
91+
ShowIcon bool
9292
}
9393

9494
type popupMenuConfig struct {

editor/editor.go

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var editor *Editor
2525

2626
const (
2727
GONEOVIMVERSION = "v0.4.7"
28-
WORKSPACELEN = 10
28+
WORKSPACELEN = 10
2929
)
3030

3131
// ColorPalette is
@@ -99,9 +99,9 @@ type Editor struct {
9999
sysTray *widgets.QSystemTrayIcon
100100
chanVisible chan bool
101101

102-
width int
103-
height int
104-
iconSize int
102+
width int
103+
height int
104+
iconSize int
105105

106106
stop chan struct{}
107107
stopOnce sync.Once
@@ -170,15 +170,15 @@ func InitEditor() {
170170
}
171171

172172
editor = &Editor{
173-
version: GONEOVIMVERSION,
174-
signal: NewEditorSignal(nil),
175-
notify: make(chan *Notify, 10),
176-
stop: make(chan struct{}),
177-
guiInit: make(chan bool, 1),
178-
config: newGonvimConfig(home),
179-
homeDir: home,
180-
args: args,
181-
opts: opts,
173+
version: GONEOVIMVERSION,
174+
signal: NewEditorSignal(nil),
175+
notify: make(chan *Notify, 10),
176+
stop: make(chan struct{}),
177+
guiInit: make(chan bool, 1),
178+
config: newGonvimConfig(home),
179+
homeDir: home,
180+
args: args,
181+
opts: opts,
182182
chanVisible: make(chan bool, 2),
183183
}
184184
e := editor
@@ -755,6 +755,7 @@ func (e *Editor) convertKey(event *gui.QKeyEvent) string {
755755

756756
c := ""
757757
if text == "" {
758+
758759
if key == int(core.Qt__Key_Alt ) ||
759760
key == int(core.Qt__Key_AltGr ) ||
760761
key == int(core.Qt__Key_CapsLock) ||
@@ -789,7 +790,7 @@ func (e *Editor) convertKey(event *gui.QKeyEvent) string {
789790

790791
if runtime.GOOS == "darwin" {
791792
// Remove ALT/OPTION
792-
if (char.Unicode() >= 0x80 && char.IsPrint()) {
793+
if char.Unicode() >= 0x80 && char.IsPrint() {
793794
mod &= ^core.Qt__AltModifier
794795
}
795796
}
@@ -870,13 +871,11 @@ func (e *Editor) initSpecialKeys() {
870871
e.specialKeys[core.Qt__Key_End] = "End"
871872
e.specialKeys[core.Qt__Key_PageUp] = "PageUp"
872873
e.specialKeys[core.Qt__Key_PageDown] = "PageDown"
873-
874874
e.specialKeys[core.Qt__Key_Return] = "Enter"
875875
e.specialKeys[core.Qt__Key_Enter] = "Enter"
876876
e.specialKeys[core.Qt__Key_Tab] = "Tab"
877877
e.specialKeys[core.Qt__Key_Backtab] = "Tab"
878878
e.specialKeys[core.Qt__Key_Escape] = "Esc"
879-
880879
e.specialKeys[core.Qt__Key_Backslash] = "Bslash"
881880
e.specialKeys[core.Qt__Key_Space] = "Space"
882881

editor/editor_linux_test.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,35 @@ import (
1212

1313
func TestLinuxEditor_convertKey(t *testing.T) {
1414
tests := []struct {
15-
name string
16-
args *gui.QKeyEvent
17-
want string
15+
name string
16+
args *gui.QKeyEvent
17+
want string
1818
}{
1919
{
2020
`convertKey() Linux LessThan modifier keys 1`,
21-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__ControlModifier, "<", false, 1),
21+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__ControlModifier, "<", false, 1),
2222
"<C-lt>",
2323
},
2424
{
2525
`convertKey() Linux LessThan modifier keys 2`,
26-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__AltModifier, "<", false, 1),
26+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__AltModifier, "<", false, 1),
2727
"<A-lt>",
2828
},
2929
{
3030
`convertKey() Linux LessThan modifier keys 3`,
31-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__MetaModifier, "<", false, 1),
31+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__MetaModifier, "<", false, 1),
3232
"<D-lt>",
3333
},
34-
3534
}
3635
e := &Editor{}
3736
e.InitSpecialKeys()
3837
for key, value := range e.specialKeys {
3938
tests = append(
4039
tests,
4140
[]struct {
42-
name string
43-
args *gui.QKeyEvent
44-
want string
41+
name string
42+
args *gui.QKeyEvent
43+
want string
4544
}{
4645
{
4746
`convertKey() Linux special keys`,

editor/editor_mac_test.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212

1313
func TestDarwinEditor_convertKey(t *testing.T) {
1414
tests := []struct {
15-
name string
16-
args *gui.QKeyEvent
17-
want string
15+
name string
16+
args *gui.QKeyEvent
17+
want string
1818
}{
1919
{
2020
`convertKey() MacOS Alt special key input å`,
@@ -23,27 +23,27 @@ func TestDarwinEditor_convertKey(t *testing.T) {
2323
},
2424
{
2525
`convertKey() MacOS Alt special key input Å`,
26-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__ShiftModifier | core.Qt__AltModifier, "Å", false, 1),
26+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__ShiftModifier|core.Qt__AltModifier, "Å", false, 1),
2727
"Å",
2828
},
2929
{
3030
`convertKey() MacOS Alt special key input Ò`,
31-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_L), core.Qt__ShiftModifier | core.Qt__AltModifier, "Ò", false, 1),
31+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_L), core.Qt__ShiftModifier|core.Qt__AltModifier, "Ò", false, 1),
3232
"Ò",
3333
},
3434
{
3535
`convertKey() MacOS LessThan modifier keys 1`,
36-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__ControlModifier, "<", false, 1),
36+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__ControlModifier, "<", false, 1),
3737
"<D-lt>",
3838
},
3939
{
4040
`convertKey() MacOS LessThan modifier keys 2`,
41-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__AltModifier, "<", false, 1),
41+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__AltModifier, "<", false, 1),
4242
"<A-lt>",
4343
},
4444
{
4545
`convertKey() MacOS LessThan modifier keys 3`,
46-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__MetaModifier, "<", false, 1),
46+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__MetaModifier, "<", false, 1),
4747
"<C-lt>",
4848
},
4949
{
@@ -53,20 +53,19 @@ func TestDarwinEditor_convertKey(t *testing.T) {
5353
},
5454
{
5555
`convertKey() MacOS keyboardlayout unicode hex input 2`,
56-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__AltModifier | core.Qt__ShiftModifier, "", false, 1),
56+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__AltModifier|core.Qt__ShiftModifier, "", false, 1),
5757
"<A-A>",
5858
},
5959
{
6060
`convertKey() MacOS keyboardlayout unicode hex input 3`,
61-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__MetaModifier | core.Qt__AltModifier, "", false, 1),
61+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__MetaModifier|core.Qt__AltModifier, "", false, 1),
6262
"<C-A-a>",
6363
},
6464
{
6565
`convertKey() MacOS keyboardlayout unicode hex input 4`,
66-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__MetaModifier | core.Qt__AltModifier | core.Qt__ShiftModifier, "", false, 1),
66+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__MetaModifier|core.Qt__AltModifier|core.Qt__ShiftModifier, "", false, 1),
6767
"<C-A-A>",
6868
},
69-
7069
}
7170
e := &Editor{}
7271
e.InitSpecialKeys()
@@ -77,9 +76,9 @@ func TestDarwinEditor_convertKey(t *testing.T) {
7776
tests = append(
7877
tests,
7978
[]struct {
80-
name string
81-
args *gui.QKeyEvent
82-
want string
79+
name string
80+
args *gui.QKeyEvent
81+
want string
8382
}{
8483
{
8584
`convertKey() MacOS special keys`,

editor/editor_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99

1010
func TestEditor_convertKey(t *testing.T) {
1111
tests := []struct {
12-
name string
13-
args *gui.QKeyEvent
14-
want string
12+
name string
13+
args *gui.QKeyEvent
14+
want string
1515
}{
1616
{
1717
`convertKey() Shift is implied with "<", send "<lt>" instead`,
@@ -98,7 +98,6 @@ func TestEditor_convertKey(t *testing.T) {
9898
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_CapsLock), core.Qt__ControlModifier, "", false, 1),
9999
"",
100100
},
101-
102101
}
103102
for _, tt := range tests {
104103
tt := tt

editor/editor_win_test.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,35 @@ import (
1212

1313
func TestLinuxEditor_convertKey(t *testing.T) {
1414
tests := []struct {
15-
name string
16-
args *gui.QKeyEvent
17-
want string
15+
name string
16+
args *gui.QKeyEvent
17+
want string
1818
}{
1919
{
2020
`convertKey() Linux LessThan modifier keys 1`,
21-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__ControlModifier, "<", false, 1),
21+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__ControlModifier, "<", false, 1),
2222
"<C-lt>",
2323
},
2424
{
2525
`convertKey() Linux LessThan modifier keys 2`,
26-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__AltModifier, "<", false, 1),
26+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__AltModifier, "<", false, 1),
2727
"<A-lt>",
2828
},
2929
{
3030
`convertKey() Linux LessThan modifier keys 3`,
31-
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__MetaModifier, "<", false, 1),
31+
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__MetaModifier, "<", false, 1),
3232
"<lt>",
3333
},
34-
3534
}
3635
e := &Editor{}
3736
e.InitSpecialKeys()
3837
for key, value := range e.specialKeys {
3938
tests = append(
4039
tests,
4140
[]struct {
42-
name string
43-
args *gui.QKeyEvent
44-
want string
41+
name string
42+
args *gui.QKeyEvent
43+
want string
4544
}{
4645
{
4746
`convertKey() Linux special keys`,

editor/export_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ package editor
33
func (e *Editor) InitSpecialKeys() {
44
e.initSpecialKeys()
55
}
6-

editor/font.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ func (f *Font) change(family string, size float64, weight gui.QFont__Weight, str
100100
f.ws.screen.purgeTextCacheForWins()
101101
}
102102

103-
104103
func (f *Font) changeLineSpace(lineSpace int) {
105104
f.lineSpace = lineSpace
106105
f.lineHeight = f.height + lineSpace

editor/markdown.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import (
99

1010
"github.com/akiyosi/goneovim/util"
1111
"github.com/alecthomas/chroma/formatters/html"
12-
"github.com/yuin/goldmark"
13-
highlighting "github.com/yuin/goldmark-highlighting"
1412
"github.com/therecipe/qt/core"
1513
"github.com/therecipe/qt/gui"
1614
"github.com/therecipe/qt/webchannel"
1715
"github.com/therecipe/qt/webengine"
1816
"github.com/therecipe/qt/widgets"
17+
"github.com/yuin/goldmark"
18+
highlighting "github.com/yuin/goldmark-highlighting"
1919
)
2020

2121
//
@@ -62,14 +62,14 @@ func newMarkdown(workspace *Workspace) *Markdown {
6262
var err error
6363
go func() {
6464
basePath, err = m.ws.nvim.CommandOutput(`echo expand('%:p:h')`)
65-
done <-err
65+
done <- err
6666
}()
6767
select {
6868
case <-done:
6969
case <-time.After(40 * time.Millisecond):
7070
}
7171
// Create bae url
72-
baseUrl := `file://`+ basePath +`/`
72+
baseUrl := `file://` + basePath + `/`
7373
if !m.htmlSet {
7474
m.htmlSet = true
7575
m.webpage.SetHtml(m.getHTML(content), core.NewQUrl3(baseUrl, 0))

editor/palette.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"math"
66
"runtime"
77

8-
"github.com/akiyosi/goneovim/util"
98
"github.com/akiyosi/goneovim/fuzzy"
9+
"github.com/akiyosi/goneovim/util"
1010
"github.com/therecipe/qt/core"
1111
"github.com/therecipe/qt/gui"
1212
"github.com/therecipe/qt/svg"

0 commit comments

Comments
 (0)