mirror of
https://github.com/akiyosi/goneovim.git
synced 2025-08-30 14:39:23 +02:00
go fmt
This commit is contained in:
parent
06ce0a7f9f
commit
966a1c5513
21 changed files with 568 additions and 586 deletions
|
@ -755,6 +755,7 @@ func (e *Editor) convertKey(event *gui.QKeyEvent) string {
|
||||||
|
|
||||||
c := ""
|
c := ""
|
||||||
if text == "" {
|
if text == "" {
|
||||||
|
|
||||||
if key == int(core.Qt__Key_Alt ) ||
|
if key == int(core.Qt__Key_Alt ) ||
|
||||||
key == int(core.Qt__Key_AltGr ) ||
|
key == int(core.Qt__Key_AltGr ) ||
|
||||||
key == int(core.Qt__Key_CapsLock) ||
|
key == int(core.Qt__Key_CapsLock) ||
|
||||||
|
@ -789,7 +790,7 @@ func (e *Editor) convertKey(event *gui.QKeyEvent) string {
|
||||||
|
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
// Remove ALT/OPTION
|
// Remove ALT/OPTION
|
||||||
if (char.Unicode() >= 0x80 && char.IsPrint()) {
|
if char.Unicode() >= 0x80 && char.IsPrint() {
|
||||||
mod &= ^core.Qt__AltModifier
|
mod &= ^core.Qt__AltModifier
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -870,13 +871,11 @@ func (e *Editor) initSpecialKeys() {
|
||||||
e.specialKeys[core.Qt__Key_End] = "End"
|
e.specialKeys[core.Qt__Key_End] = "End"
|
||||||
e.specialKeys[core.Qt__Key_PageUp] = "PageUp"
|
e.specialKeys[core.Qt__Key_PageUp] = "PageUp"
|
||||||
e.specialKeys[core.Qt__Key_PageDown] = "PageDown"
|
e.specialKeys[core.Qt__Key_PageDown] = "PageDown"
|
||||||
|
|
||||||
e.specialKeys[core.Qt__Key_Return] = "Enter"
|
e.specialKeys[core.Qt__Key_Return] = "Enter"
|
||||||
e.specialKeys[core.Qt__Key_Enter] = "Enter"
|
e.specialKeys[core.Qt__Key_Enter] = "Enter"
|
||||||
e.specialKeys[core.Qt__Key_Tab] = "Tab"
|
e.specialKeys[core.Qt__Key_Tab] = "Tab"
|
||||||
e.specialKeys[core.Qt__Key_Backtab] = "Tab"
|
e.specialKeys[core.Qt__Key_Backtab] = "Tab"
|
||||||
e.specialKeys[core.Qt__Key_Escape] = "Esc"
|
e.specialKeys[core.Qt__Key_Escape] = "Esc"
|
||||||
|
|
||||||
e.specialKeys[core.Qt__Key_Backslash] = "Bslash"
|
e.specialKeys[core.Qt__Key_Backslash] = "Bslash"
|
||||||
e.specialKeys[core.Qt__Key_Space] = "Space"
|
e.specialKeys[core.Qt__Key_Space] = "Space"
|
||||||
|
|
||||||
|
|
|
@ -18,20 +18,19 @@ func TestLinuxEditor_convertKey(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
`convertKey() Linux LessThan modifier keys 1`,
|
`convertKey() Linux LessThan modifier keys 1`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__ControlModifier, "<", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__ControlModifier, "<", false, 1),
|
||||||
"<C-lt>",
|
"<C-lt>",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`convertKey() Linux LessThan modifier keys 2`,
|
`convertKey() Linux LessThan modifier keys 2`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__AltModifier, "<", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__AltModifier, "<", false, 1),
|
||||||
"<A-lt>",
|
"<A-lt>",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`convertKey() Linux LessThan modifier keys 3`,
|
`convertKey() Linux LessThan modifier keys 3`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__MetaModifier, "<", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__MetaModifier, "<", false, 1),
|
||||||
"<D-lt>",
|
"<D-lt>",
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
e := &Editor{}
|
e := &Editor{}
|
||||||
e.InitSpecialKeys()
|
e.InitSpecialKeys()
|
||||||
|
|
|
@ -23,27 +23,27 @@ func TestDarwinEditor_convertKey(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`convertKey() MacOS Alt special key input Å`,
|
`convertKey() MacOS Alt special key input Å`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__ShiftModifier | core.Qt__AltModifier, "Å", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__ShiftModifier|core.Qt__AltModifier, "Å", false, 1),
|
||||||
"Å",
|
"Å",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`convertKey() MacOS Alt special key input Ò`,
|
`convertKey() MacOS Alt special key input Ò`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_L), core.Qt__ShiftModifier | core.Qt__AltModifier, "Ò", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_L), core.Qt__ShiftModifier|core.Qt__AltModifier, "Ò", false, 1),
|
||||||
"Ò",
|
"Ò",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`convertKey() MacOS LessThan modifier keys 1`,
|
`convertKey() MacOS LessThan modifier keys 1`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__ControlModifier, "<", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__ControlModifier, "<", false, 1),
|
||||||
"<D-lt>",
|
"<D-lt>",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`convertKey() MacOS LessThan modifier keys 2`,
|
`convertKey() MacOS LessThan modifier keys 2`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__AltModifier, "<", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__AltModifier, "<", false, 1),
|
||||||
"<A-lt>",
|
"<A-lt>",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`convertKey() MacOS LessThan modifier keys 3`,
|
`convertKey() MacOS LessThan modifier keys 3`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__MetaModifier, "<", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__MetaModifier, "<", false, 1),
|
||||||
"<C-lt>",
|
"<C-lt>",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -53,20 +53,19 @@ func TestDarwinEditor_convertKey(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`convertKey() MacOS keyboardlayout unicode hex input 2`,
|
`convertKey() MacOS keyboardlayout unicode hex input 2`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__AltModifier | core.Qt__ShiftModifier, "", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__AltModifier|core.Qt__ShiftModifier, "", false, 1),
|
||||||
"<A-A>",
|
"<A-A>",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`convertKey() MacOS keyboardlayout unicode hex input 3`,
|
`convertKey() MacOS keyboardlayout unicode hex input 3`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__MetaModifier | core.Qt__AltModifier, "", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__MetaModifier|core.Qt__AltModifier, "", false, 1),
|
||||||
"<C-A-a>",
|
"<C-A-a>",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`convertKey() MacOS keyboardlayout unicode hex input 4`,
|
`convertKey() MacOS keyboardlayout unicode hex input 4`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__MetaModifier | core.Qt__AltModifier | core.Qt__ShiftModifier, "", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_A), core.Qt__MetaModifier|core.Qt__AltModifier|core.Qt__ShiftModifier, "", false, 1),
|
||||||
"<C-A-A>",
|
"<C-A-A>",
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
e := &Editor{}
|
e := &Editor{}
|
||||||
e.InitSpecialKeys()
|
e.InitSpecialKeys()
|
||||||
|
|
|
@ -98,7 +98,6 @@ func TestEditor_convertKey(t *testing.T) {
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_CapsLock), core.Qt__ControlModifier, "", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_CapsLock), core.Qt__ControlModifier, "", false, 1),
|
||||||
"",
|
"",
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
tt := tt
|
||||||
|
|
|
@ -18,20 +18,19 @@ func TestLinuxEditor_convertKey(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
`convertKey() Linux LessThan modifier keys 1`,
|
`convertKey() Linux LessThan modifier keys 1`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__ControlModifier, "<", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__ControlModifier, "<", false, 1),
|
||||||
"<C-lt>",
|
"<C-lt>",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`convertKey() Linux LessThan modifier keys 2`,
|
`convertKey() Linux LessThan modifier keys 2`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__AltModifier, "<", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__AltModifier, "<", false, 1),
|
||||||
"<A-lt>",
|
"<A-lt>",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`convertKey() Linux LessThan modifier keys 3`,
|
`convertKey() Linux LessThan modifier keys 3`,
|
||||||
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier | core.Qt__MetaModifier, "<", false, 1),
|
gui.NewQKeyEvent(core.QEvent__KeyPress, int(core.Qt__Key_Less), core.Qt__ShiftModifier|core.Qt__MetaModifier, "<", false, 1),
|
||||||
"<lt>",
|
"<lt>",
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
e := &Editor{}
|
e := &Editor{}
|
||||||
e.InitSpecialKeys()
|
e.InitSpecialKeys()
|
||||||
|
|
|
@ -3,4 +3,3 @@ package editor
|
||||||
func (e *Editor) InitSpecialKeys() {
|
func (e *Editor) InitSpecialKeys() {
|
||||||
e.initSpecialKeys()
|
e.initSpecialKeys()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,6 @@ func (f *Font) change(family string, size float64, weight gui.QFont__Weight, str
|
||||||
f.ws.screen.purgeTextCacheForWins()
|
f.ws.screen.purgeTextCacheForWins()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (f *Font) changeLineSpace(lineSpace int) {
|
func (f *Font) changeLineSpace(lineSpace int) {
|
||||||
f.lineSpace = lineSpace
|
f.lineSpace = lineSpace
|
||||||
f.lineHeight = f.height + lineSpace
|
f.lineHeight = f.height + lineSpace
|
||||||
|
|
|
@ -9,13 +9,13 @@ import (
|
||||||
|
|
||||||
"github.com/akiyosi/goneovim/util"
|
"github.com/akiyosi/goneovim/util"
|
||||||
"github.com/alecthomas/chroma/formatters/html"
|
"github.com/alecthomas/chroma/formatters/html"
|
||||||
"github.com/yuin/goldmark"
|
|
||||||
highlighting "github.com/yuin/goldmark-highlighting"
|
|
||||||
"github.com/therecipe/qt/core"
|
"github.com/therecipe/qt/core"
|
||||||
"github.com/therecipe/qt/gui"
|
"github.com/therecipe/qt/gui"
|
||||||
"github.com/therecipe/qt/webchannel"
|
"github.com/therecipe/qt/webchannel"
|
||||||
"github.com/therecipe/qt/webengine"
|
"github.com/therecipe/qt/webengine"
|
||||||
"github.com/therecipe/qt/widgets"
|
"github.com/therecipe/qt/widgets"
|
||||||
|
"github.com/yuin/goldmark"
|
||||||
|
highlighting "github.com/yuin/goldmark-highlighting"
|
||||||
)
|
)
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -62,14 +62,14 @@ func newMarkdown(workspace *Workspace) *Markdown {
|
||||||
var err error
|
var err error
|
||||||
go func() {
|
go func() {
|
||||||
basePath, err = m.ws.nvim.CommandOutput(`echo expand('%:p:h')`)
|
basePath, err = m.ws.nvim.CommandOutput(`echo expand('%:p:h')`)
|
||||||
done <-err
|
done <- err
|
||||||
}()
|
}()
|
||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
case <-time.After(40 * time.Millisecond):
|
case <-time.After(40 * time.Millisecond):
|
||||||
}
|
}
|
||||||
// Create bae url
|
// Create bae url
|
||||||
baseUrl := `file://`+ basePath +`/`
|
baseUrl := `file://` + basePath + `/`
|
||||||
if !m.htmlSet {
|
if !m.htmlSet {
|
||||||
m.htmlSet = true
|
m.htmlSet = true
|
||||||
m.webpage.SetHtml(m.getHTML(content), core.NewQUrl3(baseUrl, 0))
|
m.webpage.SetHtml(m.getHTML(content), core.NewQUrl3(baseUrl, 0))
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/akiyosi/goneovim/util"
|
|
||||||
"github.com/akiyosi/goneovim/fuzzy"
|
"github.com/akiyosi/goneovim/fuzzy"
|
||||||
|
"github.com/akiyosi/goneovim/util"
|
||||||
"github.com/therecipe/qt/core"
|
"github.com/therecipe/qt/core"
|
||||||
"github.com/therecipe/qt/gui"
|
"github.com/therecipe/qt/gui"
|
||||||
"github.com/therecipe/qt/svg"
|
"github.com/therecipe/qt/svg"
|
||||||
|
|
|
@ -155,7 +155,7 @@ func (p *PopupMenu) updateFont(font *Font) {
|
||||||
popupItem.menuLabel.SetFont(font.fontNew)
|
popupItem.menuLabel.SetFont(font.fontNew)
|
||||||
popupItem.infoLabel.SetFont(font.fontNew)
|
popupItem.infoLabel.SetFont(font.fontNew)
|
||||||
popupItem.kindIcon.SetFixedSize2(font.lineHeight, font.lineHeight)
|
popupItem.kindIcon.SetFixedSize2(font.lineHeight, font.lineHeight)
|
||||||
popupItem.kindwidget.SetFixedWidth(font.lineHeight+editor.config.Editor.Linespace*2)
|
popupItem.kindwidget.SetFixedWidth(font.lineHeight + editor.config.Editor.Linespace*2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ func (p *PopupMenu) showItems(args []interface{}) {
|
||||||
p.detailLabel.SetText("")
|
p.detailLabel.SetText("")
|
||||||
|
|
||||||
popupItems := p.items
|
popupItems := p.items
|
||||||
itemHeight := (lineHeight)+(editor.config.Editor.Linespace+4)
|
itemHeight := (lineHeight) + (editor.config.Editor.Linespace + 4)
|
||||||
|
|
||||||
// Calc the maximum completion items
|
// Calc the maximum completion items
|
||||||
// where,
|
// where,
|
||||||
|
@ -242,7 +242,7 @@ func (p *PopupMenu) showItems(args []interface{}) {
|
||||||
// `p.ws.screen.height` is the entire screen height
|
// `p.ws.screen.height` is the entire screen height
|
||||||
heightLeft := 0
|
heightLeft := 0
|
||||||
if isCursorBelowTheCenter {
|
if isCursorBelowTheCenter {
|
||||||
heightLeft = row*lineHeight
|
heightLeft = row * lineHeight
|
||||||
} else {
|
} else {
|
||||||
heightLeft = p.ws.screen.height - (row+1)*lineHeight
|
heightLeft = p.ws.screen.height - (row+1)*lineHeight
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ func (p *PopupMenu) showItems(args []interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
startNum := 0
|
startNum := 0
|
||||||
if selected >= len(items) - p.showTotal && len(items) > p.total {
|
if selected >= len(items)-p.showTotal && len(items) > p.total {
|
||||||
startNum = len(items) - p.showTotal
|
startNum = len(items) - p.showTotal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,47 +574,47 @@ func (p *PopupItem) setKind(kind string, selected bool) {
|
||||||
|
|
||||||
icon := ""
|
icon := ""
|
||||||
switch formattedKind {
|
switch formattedKind {
|
||||||
case "text" :
|
case "text":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||||
case "method", "function", "constructor" :
|
case "method", "function", "constructor":
|
||||||
icon = editor.getSvg("lsp_function", colorOfFunc)
|
icon = editor.getSvg("lsp_function", colorOfFunc)
|
||||||
case "field", "variable", "property" :
|
case "field", "variable", "property":
|
||||||
icon = editor.getSvg("lsp_variable", colorOfFunc)
|
icon = editor.getSvg("lsp_variable", colorOfFunc)
|
||||||
case "class" :
|
case "class":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfFunc)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfFunc)
|
||||||
case "interface" :
|
case "interface":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfFunc)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfFunc)
|
||||||
case "module" :
|
case "module":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||||
case "unit" :
|
case "unit":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfStatement)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfStatement)
|
||||||
case "value" :
|
case "value":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||||
case "enum" :
|
case "enum":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
||||||
case "keyword" :
|
case "keyword":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||||
case "snippet" :
|
case "snippet":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||||
case "color" :
|
case "color":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||||
case "file" :
|
case "file":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
||||||
case "reference" :
|
case "reference":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
||||||
case "folder" :
|
case "folder":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
||||||
case "enummember" :
|
case "enummember":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||||
case "constant" :
|
case "constant":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||||
case "struct" :
|
case "struct":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfStatement)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfStatement)
|
||||||
case "event" :
|
case "event":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfStatement)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfStatement)
|
||||||
case "operato" :
|
case "operato":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfStatement)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfStatement)
|
||||||
case "typeparameter" :
|
case "typeparameter":
|
||||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
||||||
default:
|
default:
|
||||||
iconColor := warpColor(editor.colors.fg, -45)
|
iconColor := warpColor(editor.colors.fg, -45)
|
||||||
|
@ -644,32 +644,32 @@ func (p *PopupItem) setKind(kind string, selected bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func normalizeKind(kind string) string {
|
func normalizeKind(kind string) string {
|
||||||
// Completion kinds is
|
// Completion kinds is
|
||||||
// Text
|
// Text
|
||||||
// Method
|
// Method
|
||||||
// Function
|
// Function
|
||||||
// Constructor
|
// Constructor
|
||||||
// Field
|
// Field
|
||||||
// Variable
|
// Variable
|
||||||
// Class
|
// Class
|
||||||
// Interface
|
// Interface
|
||||||
// Module
|
// Module
|
||||||
// Property
|
// Property
|
||||||
// Unit
|
// Unit
|
||||||
// Value
|
// Value
|
||||||
// Enum
|
// Enum
|
||||||
// Keyword
|
// Keyword
|
||||||
// Snippet
|
// Snippet
|
||||||
// Color
|
// Color
|
||||||
// File
|
// File
|
||||||
// Reference
|
// Reference
|
||||||
// Folder
|
// Folder
|
||||||
// EnumMember
|
// EnumMember
|
||||||
// Constant
|
// Constant
|
||||||
// Struct
|
// Struct
|
||||||
// Event
|
// Event
|
||||||
// Operator
|
// Operator
|
||||||
// TypeParameter
|
// TypeParameter
|
||||||
if len(kind) == 1 {
|
if len(kind) == 1 {
|
||||||
switch kind {
|
switch kind {
|
||||||
case "v":
|
case "v":
|
||||||
|
@ -705,7 +705,7 @@ func normalizeKind(kind string) string {
|
||||||
|
|
||||||
lowerKindText := strings.ToLower(kind)
|
lowerKindText := strings.ToLower(kind)
|
||||||
switch lowerKindText {
|
switch lowerKindText {
|
||||||
case "func", "instance" :
|
case "func", "instance":
|
||||||
return "function"
|
return "function"
|
||||||
case "var", "statement", "param", "const":
|
case "var", "statement", "param", "const":
|
||||||
return "variable"
|
return "variable"
|
||||||
|
|
|
@ -186,7 +186,6 @@ func newRGBA(r int, g int, b int, a float64) *RGBA {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (rgba *RGBA) XYZ() *XYZ {
|
func (rgba *RGBA) XYZ() *XYZ {
|
||||||
r := float64(rgba.R) / 255.0
|
r := float64(rgba.R) / 255.0
|
||||||
g := float64(rgba.G) / 255.0
|
g := float64(rgba.G) / 255.0
|
||||||
|
|
|
@ -445,8 +445,8 @@ func (s *Screen) gridFont(update interface{}) {
|
||||||
s.ws.cursor.updateFont(font)
|
s.ws.cursor.updateFont(font)
|
||||||
|
|
||||||
if win.isExternal {
|
if win.isExternal {
|
||||||
width := int(float64(newCols) * win.font.truewidth) + EXTWINBORDERSIZE*2
|
width := int(float64(newCols)*win.font.truewidth) + EXTWINBORDERSIZE*2
|
||||||
height := newRows * win.font.lineHeight + EXTWINBORDERSIZE*2
|
height := newRows*win.font.lineHeight + EXTWINBORDERSIZE*2
|
||||||
win.extwin.Resize2(width, height)
|
win.extwin.Resize2(width, height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -827,7 +827,6 @@ func (w *Window) drawFloatWindowBorder(p *gui.QPainter) {
|
||||||
width := float64(w.widget.Width())
|
width := float64(w.widget.Width())
|
||||||
height := float64(w.widget.Height())
|
height := float64(w.widget.Height())
|
||||||
|
|
||||||
|
|
||||||
left := core.NewQRectF4( 0, 0, 1, height)
|
left := core.NewQRectF4( 0, 0, 1, height)
|
||||||
top := core.NewQRectF4( 0, 0, width, 1)
|
top := core.NewQRectF4( 0, 0, width, 1)
|
||||||
right := core.NewQRectF4(width-1, 0, 1, height)
|
right := core.NewQRectF4(width-1, 0, 1, height)
|
||||||
|
@ -934,17 +933,17 @@ func (w *Window) drawWindowSeparator(p *gui.QPainter, gwinrows int) {
|
||||||
if w.s.ws.showtabline == 2 && drawTabline && numOfTabs == 1 {
|
if w.s.ws.showtabline == 2 && drawTabline && numOfTabs == 1 {
|
||||||
tablineNum = -1
|
tablineNum = -1
|
||||||
}
|
}
|
||||||
shift := font.lineHeight/2
|
shift := font.lineHeight / 2
|
||||||
if w.rows+w.s.ws.showtabline+tablineNum+1 == gwinrows {
|
if w.rows+w.s.ws.showtabline+tablineNum+1 == gwinrows {
|
||||||
winHeight = w.rows * font.lineHeight
|
winHeight = w.rows * font.lineHeight
|
||||||
shift = 0
|
shift = 0
|
||||||
} else {
|
} else {
|
||||||
if w.pos[1] == tablineNum {
|
if w.pos[1] == tablineNum {
|
||||||
winHeight = w.rows * font.lineHeight + int(float64(font.lineHeight)/2.0)
|
winHeight = w.rows*font.lineHeight + int(float64(font.lineHeight)/2.0)
|
||||||
shift = 0
|
shift = 0
|
||||||
}
|
}
|
||||||
if w.pos[1]+w.rows == gwinrows-2 {
|
if w.pos[1]+w.rows == gwinrows-2 {
|
||||||
winHeight = w.rows * font.lineHeight + int(float64(font.lineHeight)/2.0)
|
winHeight = w.rows*font.lineHeight + int(float64(font.lineHeight)/2.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1897,7 +1896,7 @@ func (s *Screen) updateGridContent(arg []interface{}) {
|
||||||
if s.name != "minimap" {
|
if s.name != "minimap" {
|
||||||
|
|
||||||
// Draw bottom statusline
|
// Draw bottom statusline
|
||||||
if row == win.rows - 2 {
|
if row == win.rows-2 {
|
||||||
isSkipDraw = false
|
isSkipDraw = false
|
||||||
}
|
}
|
||||||
// Draw tabline
|
// Draw tabline
|
||||||
|
@ -2838,11 +2837,11 @@ func (w *Window) getFillpatternAndTransparent(hl *Highlight) (core.Qt__BrushStyl
|
||||||
t := 255
|
t := 255
|
||||||
// if pumblend > 0
|
// if pumblend > 0
|
||||||
if w.isPopupmenu {
|
if w.isPopupmenu {
|
||||||
t = int(((transparent() * 255.0)) * ((100.0 - float64(w.s.ws.pb)) / 100.0))
|
t = int((transparent() * 255.0) * ((100.0 - float64(w.s.ws.pb)) / 100.0))
|
||||||
}
|
}
|
||||||
// if winblend > 0
|
// if winblend > 0
|
||||||
if !w.isPopupmenu && w.wb > 0 {
|
if !w.isPopupmenu && w.wb > 0 {
|
||||||
t = int(((transparent() * 255.0)) * ((100.0 - float64(w.wb)) / 100.0))
|
t = int((transparent() * 255.0) * ((100.0 - float64(w.wb)) / 100.0))
|
||||||
}
|
}
|
||||||
if w.isMsgGrid && editor.config.Message.Transparent < 1.0 {
|
if w.isMsgGrid && editor.config.Message.Transparent < 1.0 {
|
||||||
t = int(editor.config.Message.Transparent * 255.0)
|
t = int(editor.config.Message.Transparent * 255.0)
|
||||||
|
@ -2971,14 +2970,13 @@ func (win *Window) getWinblend() {
|
||||||
wb := 0
|
wb := 0
|
||||||
go func() {
|
go func() {
|
||||||
err := win.s.ws.nvim.WindowOption(win.id, "winblend", &wb)
|
err := win.s.ws.nvim.WindowOption(win.id, "winblend", &wb)
|
||||||
errCh <-err
|
errCh <- err
|
||||||
}()
|
}()
|
||||||
select {
|
select {
|
||||||
case <-errCh:
|
case <-errCh:
|
||||||
case <-time.After(40 * time.Millisecond):
|
case <-time.After(40 * time.Millisecond):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if wb > 0 {
|
if wb > 0 {
|
||||||
win.widget.SetAutoFillBackground(false)
|
win.widget.SetAutoFillBackground(false)
|
||||||
} else {
|
} else {
|
||||||
|
@ -3070,7 +3068,7 @@ func (s *Screen) windowFloatPosition(args []interface{}) {
|
||||||
|
|
||||||
row := 0
|
row := 0
|
||||||
contextLine := 0
|
contextLine := 0
|
||||||
if anchorwin.rows - s.cursor[0] >= 2 {
|
if anchorwin.rows-s.cursor[0] >= 2 {
|
||||||
contextLine = 2
|
contextLine = 2
|
||||||
} else {
|
} else {
|
||||||
contextLine = anchorwin.rows - s.cursor[0]
|
contextLine = anchorwin.rows - s.cursor[0]
|
||||||
|
|
|
@ -14,4 +14,3 @@ func createExternalWin() *ExternalWin {
|
||||||
|
|
||||||
return extwin
|
return extwin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,13 +220,12 @@ func TestWindow_updateLine(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[]Cell{
|
[]Cell{
|
||||||
Cell{ true, "~", hldef[7] },
|
Cell{true, "~", hldef[7]},
|
||||||
Cell{ true, " ", hldef[7] },
|
Cell{true, " ", hldef[7]},
|
||||||
Cell{ true, " ", hldef[7] },
|
Cell{true, " ", hldef[7]},
|
||||||
Cell{ true, " ", hldef[7] },
|
Cell{true, " ", hldef[7]},
|
||||||
Cell{ true, " ", hldef[7] },
|
Cell{true, " ", hldef[7]},
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"test_updateline() 2",
|
"test_updateline() 2",
|
||||||
|
@ -245,13 +244,12 @@ func TestWindow_updateLine(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[]Cell{
|
[]Cell{
|
||||||
Cell{ true, "~", hldef[7] },
|
Cell{true, "~", hldef[7]},
|
||||||
Cell{ true, " ", hldef[7] },
|
Cell{true, " ", hldef[7]},
|
||||||
Cell{ true, " ", hldef[7] },
|
Cell{true, " ", hldef[7]},
|
||||||
Cell{ true, "*", hldef[6] },
|
Cell{true, "*", hldef[6]},
|
||||||
Cell{ true, "*", hldef[6] },
|
Cell{true, "*", hldef[6]},
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"test_updateline() 3",
|
"test_updateline() 3",
|
||||||
|
@ -273,13 +271,12 @@ func TestWindow_updateLine(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[]Cell{
|
[]Cell{
|
||||||
Cell{ true, "~", hldef[7] },
|
Cell{true, "~", hldef[7]},
|
||||||
Cell{ true, "@", hldef[6] },
|
Cell{true, "@", hldef[6]},
|
||||||
Cell{ true, "v", hldef[6] },
|
Cell{true, "v", hldef[6]},
|
||||||
Cell{ true, "i", hldef[6] },
|
Cell{true, "i", hldef[6]},
|
||||||
Cell{ true, "m", hldef[6] },
|
Cell{true, "m", hldef[6]},
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"test_updateline() 4",
|
"test_updateline() 4",
|
||||||
|
@ -299,13 +296,12 @@ func TestWindow_updateLine(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[]Cell{
|
[]Cell{
|
||||||
Cell{ true, " ", hldef[7] },
|
Cell{true, " ", hldef[7]},
|
||||||
Cell{ true, " ", hldef[7] },
|
Cell{true, " ", hldef[7]},
|
||||||
Cell{ true, "J", hldef[7] },
|
Cell{true, "J", hldef[7]},
|
||||||
Cell{ true, "i", hldef[6] },
|
Cell{true, "i", hldef[6]},
|
||||||
Cell{ true, "m", hldef[6] },
|
Cell{true, "m", hldef[6]},
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +318,7 @@ func TestWindow_updateLine(t *testing.T) {
|
||||||
}
|
}
|
||||||
w.updateLine(tt.args.col, tt.args.row, tt.args.cells)
|
w.updateLine(tt.args.col, tt.args.row, tt.args.cells)
|
||||||
|
|
||||||
got := w.content[row];
|
got := w.content[row]
|
||||||
for i, cell := range got {
|
for i, cell := range got {
|
||||||
if cell == nil {
|
if cell == nil {
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/akiyosi/goneovim/util"
|
"github.com/akiyosi/goneovim/util"
|
||||||
"github.com/therecipe/qt/widgets"
|
|
||||||
"github.com/therecipe/qt/core"
|
"github.com/therecipe/qt/core"
|
||||||
"github.com/therecipe/qt/gui"
|
"github.com/therecipe/qt/gui"
|
||||||
|
"github.com/therecipe/qt/widgets"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ScrollBar is
|
// ScrollBar is
|
||||||
|
@ -36,7 +36,7 @@ func newScrollBar() *ScrollBar {
|
||||||
thumb: thumb,
|
thumb: thumb,
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollBar.thumb.ConnectMousePressEvent(scrollBar. thumbPress)
|
scrollBar.thumb.ConnectMousePressEvent(scrollBar.thumbPress)
|
||||||
scrollBar.thumb.ConnectMouseMoveEvent(scrollBar.thumbScroll)
|
scrollBar.thumb.ConnectMouseMoveEvent(scrollBar.thumbScroll)
|
||||||
scrollBar.thumb.ConnectMouseReleaseEvent(scrollBar.thumbRelease)
|
scrollBar.thumb.ConnectMouseReleaseEvent(scrollBar.thumbRelease)
|
||||||
scrollBar.thumb.ConnectEnterEvent(scrollBar.thumbEnter)
|
scrollBar.thumb.ConnectEnterEvent(scrollBar.thumbEnter)
|
||||||
|
@ -79,7 +79,7 @@ func (s *ScrollBar) thumbScroll(e *gui.QMouseEvent) {
|
||||||
if s.height < 20 {
|
if s.height < 20 {
|
||||||
thumbHeight = 20
|
thumbHeight = 20
|
||||||
}
|
}
|
||||||
ratio := float64((s.ws.maxLine * font.lineHeight) + thumbHeight) / float64(s.widget.Height())
|
ratio := float64((s.ws.maxLine*font.lineHeight)+thumbHeight) / float64(s.widget.Height())
|
||||||
v := s.beginPosY - e.GlobalPos().Y()
|
v := s.beginPosY - e.GlobalPos().Y()
|
||||||
if v == 0 {
|
if v == 0 {
|
||||||
return
|
return
|
||||||
|
|
|
@ -443,7 +443,6 @@ func (s *Statusline) setContentsMarginsForWidgets(l int, u int, r int, d int) {
|
||||||
s.lint.c.widget.SetContentsMargins(l, u, r, d)
|
s.lint.c.widget.SetContentsMargins(l, u, r, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (s *Statusline) getColor() {
|
func (s *Statusline) getColor() {
|
||||||
if s.ws.screen.highlightGroup == nil || s.ws.screen.hlAttrDef == nil {
|
if s.ws.screen.highlightGroup == nil || s.ws.screen.hlAttrDef == nil {
|
||||||
return
|
return
|
||||||
|
|
|
@ -387,7 +387,6 @@ func (t *Tabline) update(args []interface{}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func getFileType(text string) string {
|
func getFileType(text string) string {
|
||||||
if strings.HasPrefix(text, "term://") {
|
if strings.HasPrefix(text, "term://") {
|
||||||
return "terminal"
|
return "terminal"
|
||||||
|
|
|
@ -565,7 +565,7 @@ func (w *Workspace) getColorscheme() {
|
||||||
colorscheme := ""
|
colorscheme := ""
|
||||||
go func() {
|
go func() {
|
||||||
w.nvim.Var("colors_name", &colorscheme)
|
w.nvim.Var("colors_name", &colorscheme)
|
||||||
done <-true
|
done <- true
|
||||||
}()
|
}()
|
||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
|
@ -579,7 +579,7 @@ func (w *Workspace) getTS() {
|
||||||
ts := 8
|
ts := 8
|
||||||
go func() {
|
go func() {
|
||||||
w.nvim.Option("ts", &ts)
|
w.nvim.Option("ts", &ts)
|
||||||
done <-true
|
done <- true
|
||||||
}()
|
}()
|
||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
|
@ -593,7 +593,7 @@ func (w *Workspace) getBG() {
|
||||||
screenbg := "dark"
|
screenbg := "dark"
|
||||||
go func() {
|
go func() {
|
||||||
w.nvim.Option("background", &screenbg)
|
w.nvim.Option("background", &screenbg)
|
||||||
done <-true
|
done <- true
|
||||||
}()
|
}()
|
||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
|
@ -635,7 +635,7 @@ func (w *Workspace) getKeymaps() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
done <-true
|
done <- true
|
||||||
}()
|
}()
|
||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
|
@ -666,7 +666,7 @@ func (w *Workspace) getKeymaps() {
|
||||||
w.escKeyInNormal = mapping.LHS
|
w.escKeyInNormal = mapping.LHS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if strings.EqualFold(mapping.LHS, "<C-y>") || strings.EqualFold(mapping.LHS, "<C-e>"){
|
if strings.EqualFold(mapping.LHS, "<C-y>") || strings.EqualFold(mapping.LHS, "<C-e>") {
|
||||||
w.isMappingScrollKey = true
|
w.isMappingScrollKey = true
|
||||||
}
|
}
|
||||||
// Count user def alt/meta key mappings
|
// Count user def alt/meta key mappings
|
||||||
|
@ -692,7 +692,7 @@ func (w *Workspace) getNumOfTabs() int {
|
||||||
num := 0
|
num := 0
|
||||||
go func() {
|
go func() {
|
||||||
w.nvim.Eval("tabpagenr('$')", &num)
|
w.nvim.Eval("tabpagenr('$')", &num)
|
||||||
done <-true
|
done <- true
|
||||||
}()
|
}()
|
||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
|
@ -729,11 +729,11 @@ func (w *Workspace) handleChangeCwd(cwdinfo map[string]interface{}) {
|
||||||
}
|
}
|
||||||
cwd := cwdITF.(string)
|
cwd := cwdITF.(string)
|
||||||
switch scope {
|
switch scope {
|
||||||
case "global" :
|
case "global":
|
||||||
w.setCwd(cwd)
|
w.setCwd(cwd)
|
||||||
case "tab" :
|
case "tab":
|
||||||
w.setCwdInTab(cwd)
|
w.setCwdInTab(cwd)
|
||||||
case "window" :
|
case "window":
|
||||||
w.setCwdInWin(cwd)
|
w.setCwdInWin(cwd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1482,7 +1482,7 @@ func (w *Workspace) handleRPCGui(updates []interface{}) {
|
||||||
case "gonvim_workspace_switch":
|
case "gonvim_workspace_switch":
|
||||||
editor.workspaceSwitch(util.ReflectToInt(updates[1]))
|
editor.workspaceSwitch(util.ReflectToInt(updates[1]))
|
||||||
case "gonvim_workspace_cwd":
|
case "gonvim_workspace_cwd":
|
||||||
cwdinfo :=updates[1].(map[string]interface{})
|
cwdinfo := updates[1].(map[string]interface{})
|
||||||
w.handleChangeCwd(cwdinfo)
|
w.handleChangeCwd(cwdinfo)
|
||||||
case "gonvim_workspace_filepath":
|
case "gonvim_workspace_filepath":
|
||||||
w.minimap.mu.Lock()
|
w.minimap.mu.Lock()
|
||||||
|
@ -1825,7 +1825,7 @@ func (w *Workspace) getPumHeight() {
|
||||||
errCh := make(chan error, 60)
|
errCh := make(chan error, 60)
|
||||||
go func() {
|
go func() {
|
||||||
err := w.nvim.Option("pumheight", &ph)
|
err := w.nvim.Option("pumheight", &ph)
|
||||||
errCh <-err
|
errCh <- err
|
||||||
}()
|
}()
|
||||||
select {
|
select {
|
||||||
case <-errCh:
|
case <-errCh:
|
||||||
|
@ -1882,7 +1882,6 @@ func (w *Workspace) getFileType(args []interface{}) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (w *Workspace) getWinblendAll() {
|
func (w *Workspace) getWinblendAll() {
|
||||||
w.screen.windows.Range(func(_, winITF interface{}) bool {
|
w.screen.windows.Range(func(_, winITF interface{}) bool {
|
||||||
win := winITF.(*Window)
|
win := winITF.(*Window)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue