mirror of
https://github.com/akiyosi/goneovim.git
synced 2025-08-29 22:19:33 +02:00
go fmt
This commit is contained in:
parent
06ce0a7f9f
commit
966a1c5513
21 changed files with 568 additions and 586 deletions
|
@ -87,8 +87,8 @@ type statusLineConfig struct {
|
|||
}
|
||||
|
||||
type tabLineConfig struct {
|
||||
Visible bool
|
||||
ShowIcon bool
|
||||
Visible bool
|
||||
ShowIcon bool
|
||||
}
|
||||
|
||||
type popupMenuConfig struct {
|
||||
|
|
|
@ -25,7 +25,7 @@ var editor *Editor
|
|||
|
||||
const (
|
||||
GONEOVIMVERSION = "v0.4.7"
|
||||
WORKSPACELEN = 10
|
||||
WORKSPACELEN = 10
|
||||
)
|
||||
|
||||
// ColorPalette is
|
||||
|
@ -99,9 +99,9 @@ type Editor struct {
|
|||
sysTray *widgets.QSystemTrayIcon
|
||||
chanVisible chan bool
|
||||
|
||||
width int
|
||||
height int
|
||||
iconSize int
|
||||
width int
|
||||
height int
|
||||
iconSize int
|
||||
|
||||
stop chan struct{}
|
||||
stopOnce sync.Once
|
||||
|
@ -170,15 +170,15 @@ func InitEditor() {
|
|||
}
|
||||
|
||||
editor = &Editor{
|
||||
version: GONEOVIMVERSION,
|
||||
signal: NewEditorSignal(nil),
|
||||
notify: make(chan *Notify, 10),
|
||||
stop: make(chan struct{}),
|
||||
guiInit: make(chan bool, 1),
|
||||
config: newGonvimConfig(home),
|
||||
homeDir: home,
|
||||
args: args,
|
||||
opts: opts,
|
||||
version: GONEOVIMVERSION,
|
||||
signal: NewEditorSignal(nil),
|
||||
notify: make(chan *Notify, 10),
|
||||
stop: make(chan struct{}),
|
||||
guiInit: make(chan bool, 1),
|
||||
config: newGonvimConfig(home),
|
||||
homeDir: home,
|
||||
args: args,
|
||||
opts: opts,
|
||||
chanVisible: make(chan bool, 2),
|
||||
}
|
||||
e := editor
|
||||
|
@ -755,6 +755,7 @@ func (e *Editor) convertKey(event *gui.QKeyEvent) string {
|
|||
|
||||
c := ""
|
||||
if text == "" {
|
||||
|
||||
if key == int(core.Qt__Key_Alt ) ||
|
||||
key == int(core.Qt__Key_AltGr ) ||
|
||||
key == int(core.Qt__Key_CapsLock) ||
|
||||
|
@ -789,7 +790,7 @@ func (e *Editor) convertKey(event *gui.QKeyEvent) string {
|
|||
|
||||
if runtime.GOOS == "darwin" {
|
||||
// Remove ALT/OPTION
|
||||
if (char.Unicode() >= 0x80 && char.IsPrint()) {
|
||||
if char.Unicode() >= 0x80 && char.IsPrint() {
|
||||
mod &= ^core.Qt__AltModifier
|
||||
}
|
||||
}
|
||||
|
@ -870,13 +871,11 @@ func (e *Editor) initSpecialKeys() {
|
|||
e.specialKeys[core.Qt__Key_End] = "End"
|
||||
e.specialKeys[core.Qt__Key_PageUp] = "PageUp"
|
||||
e.specialKeys[core.Qt__Key_PageDown] = "PageDown"
|
||||
|
||||
e.specialKeys[core.Qt__Key_Return] = "Enter"
|
||||
e.specialKeys[core.Qt__Key_Enter] = "Enter"
|
||||
e.specialKeys[core.Qt__Key_Tab] = "Tab"
|
||||
e.specialKeys[core.Qt__Key_Backtab] = "Tab"
|
||||
e.specialKeys[core.Qt__Key_Escape] = "Esc"
|
||||
|
||||
e.specialKeys[core.Qt__Key_Backslash] = "Bslash"
|
||||
e.specialKeys[core.Qt__Key_Space] = "Space"
|
||||
|
||||
|
|
|
@ -12,26 +12,25 @@ import (
|
|||
|
||||
func TestLinuxEditor_convertKey(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
}{
|
||||
{
|
||||
`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>",
|
||||
},
|
||||
{
|
||||
`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>",
|
||||
},
|
||||
{
|
||||
`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>",
|
||||
},
|
||||
|
||||
}
|
||||
e := &Editor{}
|
||||
e.InitSpecialKeys()
|
||||
|
@ -39,9 +38,9 @@ func TestLinuxEditor_convertKey(t *testing.T) {
|
|||
tests = append(
|
||||
tests,
|
||||
[]struct {
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
}{
|
||||
{
|
||||
`convertKey() Linux special keys`,
|
||||
|
|
|
@ -12,9 +12,9 @@ import (
|
|||
|
||||
func TestDarwinEditor_convertKey(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
}{
|
||||
{
|
||||
`convertKey() MacOS Alt special key input å`,
|
||||
|
@ -23,27 +23,27 @@ func TestDarwinEditor_convertKey(t *testing.T) {
|
|||
},
|
||||
{
|
||||
`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 Ò`,
|
||||
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`,
|
||||
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>",
|
||||
},
|
||||
{
|
||||
`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>",
|
||||
},
|
||||
{
|
||||
`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>",
|
||||
},
|
||||
{
|
||||
|
@ -53,20 +53,19 @@ func TestDarwinEditor_convertKey(t *testing.T) {
|
|||
},
|
||||
{
|
||||
`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>",
|
||||
},
|
||||
{
|
||||
`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>",
|
||||
},
|
||||
{
|
||||
`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>",
|
||||
},
|
||||
|
||||
}
|
||||
e := &Editor{}
|
||||
e.InitSpecialKeys()
|
||||
|
@ -77,9 +76,9 @@ func TestDarwinEditor_convertKey(t *testing.T) {
|
|||
tests = append(
|
||||
tests,
|
||||
[]struct {
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
}{
|
||||
{
|
||||
`convertKey() MacOS special keys`,
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
|
||||
func TestEditor_convertKey(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
}{
|
||||
{
|
||||
`convertKey() Shift is implied with "<", send "<lt>" instead`,
|
||||
|
@ -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),
|
||||
"",
|
||||
},
|
||||
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
|
|
|
@ -12,26 +12,25 @@ import (
|
|||
|
||||
func TestLinuxEditor_convertKey(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
}{
|
||||
{
|
||||
`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>",
|
||||
},
|
||||
{
|
||||
`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>",
|
||||
},
|
||||
{
|
||||
`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>",
|
||||
},
|
||||
|
||||
}
|
||||
e := &Editor{}
|
||||
e.InitSpecialKeys()
|
||||
|
@ -39,9 +38,9 @@ func TestLinuxEditor_convertKey(t *testing.T) {
|
|||
tests = append(
|
||||
tests,
|
||||
[]struct {
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
name string
|
||||
args *gui.QKeyEvent
|
||||
want string
|
||||
}{
|
||||
{
|
||||
`convertKey() Linux special keys`,
|
||||
|
|
|
@ -3,4 +3,3 @@ package editor
|
|||
func (e *Editor) InitSpecialKeys() {
|
||||
e.initSpecialKeys()
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,6 @@ func (f *Font) change(family string, size float64, weight gui.QFont__Weight, str
|
|||
f.ws.screen.purgeTextCacheForWins()
|
||||
}
|
||||
|
||||
|
||||
func (f *Font) changeLineSpace(lineSpace int) {
|
||||
f.lineSpace = lineSpace
|
||||
f.lineHeight = f.height + lineSpace
|
||||
|
|
|
@ -9,13 +9,13 @@ import (
|
|||
|
||||
"github.com/akiyosi/goneovim/util"
|
||||
"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/gui"
|
||||
"github.com/therecipe/qt/webchannel"
|
||||
"github.com/therecipe/qt/webengine"
|
||||
"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
|
||||
go func() {
|
||||
basePath, err = m.ws.nvim.CommandOutput(`echo expand('%:p:h')`)
|
||||
done <-err
|
||||
done <- err
|
||||
}()
|
||||
select {
|
||||
case <-done:
|
||||
case <-time.After(40 * time.Millisecond):
|
||||
}
|
||||
// Create bae url
|
||||
baseUrl := `file://`+ basePath +`/`
|
||||
baseUrl := `file://` + basePath + `/`
|
||||
if !m.htmlSet {
|
||||
m.htmlSet = true
|
||||
m.webpage.SetHtml(m.getHTML(content), core.NewQUrl3(baseUrl, 0))
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"math"
|
||||
"runtime"
|
||||
|
||||
"github.com/akiyosi/goneovim/util"
|
||||
"github.com/akiyosi/goneovim/fuzzy"
|
||||
"github.com/akiyosi/goneovim/util"
|
||||
"github.com/therecipe/qt/core"
|
||||
"github.com/therecipe/qt/gui"
|
||||
"github.com/therecipe/qt/svg"
|
||||
|
|
|
@ -43,7 +43,7 @@ type PopupItem struct {
|
|||
wordRequest string
|
||||
|
||||
kindwidget *widgets.QWidget
|
||||
kindIcon *svg.QSvgWidget
|
||||
kindIcon *svg.QSvgWidget
|
||||
|
||||
menuLabel *widgets.QLabel
|
||||
menu string
|
||||
|
@ -56,7 +56,7 @@ type PopupItem struct {
|
|||
selected bool
|
||||
selectedRequest bool
|
||||
|
||||
hidden bool
|
||||
hidden bool
|
||||
|
||||
detailText string
|
||||
}
|
||||
|
@ -131,12 +131,12 @@ func initPopupmenuNew() *PopupMenu {
|
|||
itemLayout.AddWidget2(info, i, 3, core.Qt__AlignLeft)
|
||||
|
||||
popupItem := &PopupItem{
|
||||
p: popup,
|
||||
kindIcon: kindIcon,
|
||||
kindwidget: iconwidget,
|
||||
wordLabel: word,
|
||||
menuLabel: menu,
|
||||
infoLabel: info,
|
||||
p: popup,
|
||||
kindIcon: kindIcon,
|
||||
kindwidget: iconwidget,
|
||||
wordLabel: word,
|
||||
menuLabel: menu,
|
||||
infoLabel: info,
|
||||
}
|
||||
popupItems = append(popupItems, popupItem)
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ func (p *PopupMenu) updateFont(font *Font) {
|
|||
popupItem.menuLabel.SetFont(font.fontNew)
|
||||
popupItem.infoLabel.SetFont(font.fontNew)
|
||||
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("")
|
||||
|
||||
popupItems := p.items
|
||||
itemHeight := (lineHeight)+(editor.config.Editor.Linespace+4)
|
||||
itemHeight := (lineHeight) + (editor.config.Editor.Linespace + 4)
|
||||
|
||||
// Calc the maximum completion items
|
||||
// where,
|
||||
|
@ -242,7 +242,7 @@ func (p *PopupMenu) showItems(args []interface{}) {
|
|||
// `p.ws.screen.height` is the entire screen height
|
||||
heightLeft := 0
|
||||
if isCursorBelowTheCenter {
|
||||
heightLeft = row*lineHeight
|
||||
heightLeft = row * lineHeight
|
||||
} else {
|
||||
heightLeft = p.ws.screen.height - (row+1)*lineHeight
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ func (p *PopupMenu) showItems(args []interface{}) {
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -574,47 +574,47 @@ func (p *PopupItem) setKind(kind string, selected bool) {
|
|||
|
||||
icon := ""
|
||||
switch formattedKind {
|
||||
case "text" :
|
||||
case "text":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||
case "method", "function", "constructor" :
|
||||
case "method", "function", "constructor":
|
||||
icon = editor.getSvg("lsp_function", colorOfFunc)
|
||||
case "field", "variable", "property" :
|
||||
case "field", "variable", "property":
|
||||
icon = editor.getSvg("lsp_variable", colorOfFunc)
|
||||
case "class" :
|
||||
case "class":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfFunc)
|
||||
case "interface" :
|
||||
case "interface":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfFunc)
|
||||
case "module" :
|
||||
case "module":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||
case "unit" :
|
||||
case "unit":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfStatement)
|
||||
case "value" :
|
||||
case "value":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||
case "enum" :
|
||||
case "enum":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
||||
case "keyword" :
|
||||
case "keyword":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||
case "snippet" :
|
||||
case "snippet":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||
case "color" :
|
||||
case "color":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||
case "file" :
|
||||
case "file":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
||||
case "reference" :
|
||||
case "reference":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
||||
case "folder" :
|
||||
case "folder":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
||||
case "enummember" :
|
||||
case "enummember":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||
case "constant" :
|
||||
case "constant":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfKeyword)
|
||||
case "struct" :
|
||||
case "struct":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfStatement)
|
||||
case "event" :
|
||||
case "event":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfStatement)
|
||||
case "operato" :
|
||||
case "operato":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfStatement)
|
||||
case "typeparameter" :
|
||||
case "typeparameter":
|
||||
icon = editor.getSvg("lsp_"+formattedKind, colorOfType)
|
||||
default:
|
||||
iconColor := warpColor(editor.colors.fg, -45)
|
||||
|
@ -644,32 +644,32 @@ func (p *PopupItem) setKind(kind string, selected bool) {
|
|||
}
|
||||
|
||||
func normalizeKind(kind string) string {
|
||||
// Completion kinds is
|
||||
// Text
|
||||
// Method
|
||||
// Function
|
||||
// Constructor
|
||||
// Field
|
||||
// Variable
|
||||
// Class
|
||||
// Interface
|
||||
// Module
|
||||
// Property
|
||||
// Unit
|
||||
// Value
|
||||
// Enum
|
||||
// Keyword
|
||||
// Snippet
|
||||
// Color
|
||||
// File
|
||||
// Reference
|
||||
// Folder
|
||||
// EnumMember
|
||||
// Constant
|
||||
// Struct
|
||||
// Event
|
||||
// Operator
|
||||
// TypeParameter
|
||||
// Completion kinds is
|
||||
// Text
|
||||
// Method
|
||||
// Function
|
||||
// Constructor
|
||||
// Field
|
||||
// Variable
|
||||
// Class
|
||||
// Interface
|
||||
// Module
|
||||
// Property
|
||||
// Unit
|
||||
// Value
|
||||
// Enum
|
||||
// Keyword
|
||||
// Snippet
|
||||
// Color
|
||||
// File
|
||||
// Reference
|
||||
// Folder
|
||||
// EnumMember
|
||||
// Constant
|
||||
// Struct
|
||||
// Event
|
||||
// Operator
|
||||
// TypeParameter
|
||||
if len(kind) == 1 {
|
||||
switch kind {
|
||||
case "v":
|
||||
|
@ -677,7 +677,7 @@ func normalizeKind(kind string) string {
|
|||
case "f":
|
||||
return "function" // equate with "method", "constructor"
|
||||
case "m":
|
||||
return "field" // equate with "property", "enumMember"
|
||||
return "field" // equate with "property", "enumMember"
|
||||
case "C":
|
||||
return "class"
|
||||
case "I":
|
||||
|
@ -687,13 +687,13 @@ func normalizeKind(kind string) string {
|
|||
case "U":
|
||||
return "unit"
|
||||
case "E":
|
||||
return "enum" // equate with "event"??
|
||||
return "enum" // equate with "event"??
|
||||
case "k":
|
||||
return "keyword"
|
||||
case "S":
|
||||
return "snippet" // equate with "struct"??
|
||||
return "snippet" // equate with "struct"??
|
||||
case "F":
|
||||
return "file" // equate with "folder"
|
||||
return "file" // equate with "folder"
|
||||
case "r":
|
||||
return "reference"
|
||||
case "O":
|
||||
|
@ -705,7 +705,7 @@ func normalizeKind(kind string) string {
|
|||
|
||||
lowerKindText := strings.ToLower(kind)
|
||||
switch lowerKindText {
|
||||
case "func", "instance" :
|
||||
case "func", "instance":
|
||||
return "function"
|
||||
case "var", "statement", "param", "const":
|
||||
return "variable"
|
||||
|
|
|
@ -186,7 +186,6 @@ func newRGBA(r int, g int, b int, a float64) *RGBA {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
func (rgba *RGBA) XYZ() *XYZ {
|
||||
r := float64(rgba.R) / 255.0
|
||||
g := float64(rgba.G) / 255.0
|
||||
|
|
|
@ -445,8 +445,8 @@ func (s *Screen) gridFont(update interface{}) {
|
|||
s.ws.cursor.updateFont(font)
|
||||
|
||||
if win.isExternal {
|
||||
width := int(float64(newCols) * win.font.truewidth) + EXTWINBORDERSIZE*2
|
||||
height := newRows * win.font.lineHeight + EXTWINBORDERSIZE*2
|
||||
width := int(float64(newCols)*win.font.truewidth) + EXTWINBORDERSIZE*2
|
||||
height := newRows*win.font.lineHeight + EXTWINBORDERSIZE*2
|
||||
win.extwin.Resize2(width, height)
|
||||
}
|
||||
}
|
||||
|
@ -827,10 +827,9 @@ func (w *Window) drawFloatWindowBorder(p *gui.QPainter) {
|
|||
width := float64(w.widget.Width())
|
||||
height := float64(w.widget.Height())
|
||||
|
||||
|
||||
left := core.NewQRectF4( 0, 0, 1, height)
|
||||
top := core.NewQRectF4( 0, 0, width, 1)
|
||||
right := core.NewQRectF4(width-1, 0, 1, height)
|
||||
left := core.NewQRectF4( 0, 0, 1, height)
|
||||
top := core.NewQRectF4( 0, 0, width, 1)
|
||||
right := core.NewQRectF4(width-1, 0, 1, height)
|
||||
bottom := core.NewQRectF4( 0, height-1, width, 1)
|
||||
|
||||
p.FillRect4(
|
||||
|
@ -934,17 +933,17 @@ func (w *Window) drawWindowSeparator(p *gui.QPainter, gwinrows int) {
|
|||
if w.s.ws.showtabline == 2 && drawTabline && numOfTabs == 1 {
|
||||
tablineNum = -1
|
||||
}
|
||||
shift := font.lineHeight/2
|
||||
shift := font.lineHeight / 2
|
||||
if w.rows+w.s.ws.showtabline+tablineNum+1 == gwinrows {
|
||||
winHeight = w.rows * font.lineHeight
|
||||
shift = 0
|
||||
} else {
|
||||
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
|
||||
}
|
||||
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,11 +1896,11 @@ func (s *Screen) updateGridContent(arg []interface{}) {
|
|||
if s.name != "minimap" {
|
||||
|
||||
// Draw bottom statusline
|
||||
if row == win.rows - 2 {
|
||||
if row == win.rows-2 {
|
||||
isSkipDraw = false
|
||||
}
|
||||
// Draw tabline
|
||||
if row == 0 {
|
||||
if row == 0 {
|
||||
isSkipDraw = false
|
||||
}
|
||||
|
||||
|
@ -2001,8 +2000,8 @@ func (w *Window) updateLine(col, row int, cells []interface{}) {
|
|||
}
|
||||
|
||||
if line[col].highlight.uiName == "Pmenu" ||
|
||||
line[col].highlight.uiName == "PmenuSel" ||
|
||||
line[col].highlight.uiName == "PmenuSbar" {
|
||||
line[col].highlight.uiName == "PmenuSel" ||
|
||||
line[col].highlight.uiName == "PmenuSbar" {
|
||||
w.isPopupmenu = true
|
||||
}
|
||||
|
||||
|
@ -2838,11 +2837,11 @@ func (w *Window) getFillpatternAndTransparent(hl *Highlight) (core.Qt__BrushStyl
|
|||
t := 255
|
||||
// if pumblend > 0
|
||||
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 !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 {
|
||||
t = int(editor.config.Message.Transparent * 255.0)
|
||||
|
@ -2971,14 +2970,13 @@ func (win *Window) getWinblend() {
|
|||
wb := 0
|
||||
go func() {
|
||||
err := win.s.ws.nvim.WindowOption(win.id, "winblend", &wb)
|
||||
errCh <-err
|
||||
errCh <- err
|
||||
}()
|
||||
select {
|
||||
case <-errCh:
|
||||
case <-time.After(40 * time.Millisecond):
|
||||
}
|
||||
|
||||
|
||||
if wb > 0 {
|
||||
win.widget.SetAutoFillBackground(false)
|
||||
} else {
|
||||
|
@ -3070,7 +3068,7 @@ func (s *Screen) windowFloatPosition(args []interface{}) {
|
|||
|
||||
row := 0
|
||||
contextLine := 0
|
||||
if anchorwin.rows - s.cursor[0] >= 2 {
|
||||
if anchorwin.rows-s.cursor[0] >= 2 {
|
||||
contextLine = 2
|
||||
} else {
|
||||
contextLine = anchorwin.rows - s.cursor[0]
|
||||
|
|
|
@ -7,11 +7,10 @@ import (
|
|||
func createExternalWin() *ExternalWin {
|
||||
extwin := NewExternalWin(nil, 0)
|
||||
|
||||
extwin.SetWindowFlag(core.Qt__WindowMaximizeButtonHint, false)
|
||||
extwin.SetWindowFlag(core.Qt__WindowMinimizeButtonHint, false)
|
||||
extwin.SetWindowFlag(core.Qt__WindowCloseButtonHint, false)
|
||||
extwin.SetWindowFlag(core.Qt__WindowMaximizeButtonHint, false)
|
||||
extwin.SetWindowFlag(core.Qt__WindowMinimizeButtonHint, false)
|
||||
extwin.SetWindowFlag(core.Qt__WindowCloseButtonHint, false)
|
||||
extwin.SetWindowFlag(core.Qt__WindowContextHelpButtonHint, false)
|
||||
|
||||
return extwin
|
||||
}
|
||||
|
||||
|
|
|
@ -98,35 +98,35 @@ func TestHighlight_fg(t *testing.T) {
|
|||
|
||||
func TestWindow_updateLine(t *testing.T) {
|
||||
type fields struct {
|
||||
// rwMutex sync.RWMutex
|
||||
// paintMutex sync.Mutex
|
||||
// redrawMutex sync.Mutex
|
||||
s *Screen
|
||||
content [][]*Cell
|
||||
// lenLine []int
|
||||
// lenContent []int
|
||||
// lenOldContent []int
|
||||
grid gridId
|
||||
// isGridDirty bool
|
||||
// id nvim.Window
|
||||
// bufName string
|
||||
// pos [2]int
|
||||
// anchor string
|
||||
cols int
|
||||
rows int
|
||||
// isMsgGrid bool
|
||||
// isFloatWin bool
|
||||
// widget *widgets.QWidget
|
||||
// shown bool
|
||||
// queueRedrawArea [4]int
|
||||
// scrollRegion []int
|
||||
// devicePixelRatio float64
|
||||
// textCache gcache.Cache
|
||||
// font *Font
|
||||
// fobackground *RGBA
|
||||
// width float64
|
||||
// height int
|
||||
// localWindows *[4]localWindow
|
||||
// rwMutex sync.RWMutex
|
||||
// paintMutex sync.Mutex
|
||||
// redrawMutex sync.Mutex
|
||||
s *Screen
|
||||
content [][]*Cell
|
||||
// lenLine []int
|
||||
// lenContent []int
|
||||
// lenOldContent []int
|
||||
grid gridId
|
||||
// isGridDirty bool
|
||||
// id nvim.Window
|
||||
// bufName string
|
||||
// pos [2]int
|
||||
// anchor string
|
||||
cols int
|
||||
rows int
|
||||
// isMsgGrid bool
|
||||
// isFloatWin bool
|
||||
// widget *widgets.QWidget
|
||||
// shown bool
|
||||
// queueRedrawArea [4]int
|
||||
// scrollRegion []int
|
||||
// devicePixelRatio float64
|
||||
// textCache gcache.Cache
|
||||
// font *Font
|
||||
// fobackground *RGBA
|
||||
// width float64
|
||||
// height int
|
||||
// localWindows *[4]localWindow
|
||||
}
|
||||
type args struct {
|
||||
col int
|
||||
|
@ -205,107 +205,103 @@ func TestWindow_updateLine(t *testing.T) {
|
|||
{
|
||||
"test_updateline() 1",
|
||||
fields{
|
||||
s: &Screen{hlAttrDef: hldef},
|
||||
s: &Screen{hlAttrDef: hldef},
|
||||
content: content,
|
||||
grid: gridid,
|
||||
cols: cols,
|
||||
rows: rows,
|
||||
grid: gridid,
|
||||
cols: cols,
|
||||
rows: rows,
|
||||
},
|
||||
args{
|
||||
col: 0,
|
||||
row: row,
|
||||
cells: []interface{}{
|
||||
[]interface{}{"~", 7},
|
||||
[]interface{}{" ", 7, 4},
|
||||
},
|
||||
[]interface{}{"~", 7},
|
||||
[]interface{}{" ", 7, 4},
|
||||
},
|
||||
},
|
||||
[]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",
|
||||
fields{
|
||||
s: &Screen{hlAttrDef: hldef},
|
||||
s: &Screen{hlAttrDef: hldef},
|
||||
content: content,
|
||||
grid: 6,
|
||||
cols: cols,
|
||||
rows: rows,
|
||||
grid: 6,
|
||||
cols: cols,
|
||||
rows: rows,
|
||||
},
|
||||
args{
|
||||
col: 3,
|
||||
row: row,
|
||||
cells: []interface{}{
|
||||
[]interface{}{"*", 6, 2},
|
||||
},
|
||||
[]interface{}{"*", 6, 2},
|
||||
},
|
||||
},
|
||||
[]Cell{
|
||||
Cell{ true, "~", hldef[7] },
|
||||
Cell{ true, " ", hldef[7] },
|
||||
Cell{ true, " ", hldef[7] },
|
||||
Cell{ true, "*", hldef[6] },
|
||||
Cell{ true, "*", hldef[6] },
|
||||
Cell{true, "~", hldef[7]},
|
||||
Cell{true, " ", hldef[7]},
|
||||
Cell{true, " ", hldef[7]},
|
||||
Cell{true, "*", hldef[6]},
|
||||
Cell{true, "*", hldef[6]},
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
"test_updateline() 3",
|
||||
fields{
|
||||
s: &Screen{hlAttrDef: hldef},
|
||||
s: &Screen{hlAttrDef: hldef},
|
||||
content: content,
|
||||
grid: 6,
|
||||
cols: cols,
|
||||
rows: rows,
|
||||
grid: 6,
|
||||
cols: cols,
|
||||
rows: rows,
|
||||
},
|
||||
args{
|
||||
col: 1,
|
||||
row: row,
|
||||
cells: []interface{}{
|
||||
[]interface{}{"@", 6},
|
||||
[]interface{}{"v"},
|
||||
[]interface{}{"i"},
|
||||
[]interface{}{"m"},
|
||||
},
|
||||
[]interface{}{"@", 6},
|
||||
[]interface{}{"v"},
|
||||
[]interface{}{"i"},
|
||||
[]interface{}{"m"},
|
||||
},
|
||||
},
|
||||
[]Cell{
|
||||
Cell{ true, "~", hldef[7] },
|
||||
Cell{ true, "@", hldef[6] },
|
||||
Cell{ true, "v", hldef[6] },
|
||||
Cell{ true, "i", hldef[6] },
|
||||
Cell{ true, "m", hldef[6] },
|
||||
Cell{true, "~", hldef[7]},
|
||||
Cell{true, "@", hldef[6]},
|
||||
Cell{true, "v", hldef[6]},
|
||||
Cell{true, "i", hldef[6]},
|
||||
Cell{true, "m", hldef[6]},
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
"test_updateline() 4",
|
||||
fields{
|
||||
s: &Screen{hlAttrDef: hldef},
|
||||
s: &Screen{hlAttrDef: hldef},
|
||||
content: content,
|
||||
grid: 6,
|
||||
cols: cols,
|
||||
rows: rows,
|
||||
grid: 6,
|
||||
cols: cols,
|
||||
rows: rows,
|
||||
},
|
||||
args{
|
||||
col: 0,
|
||||
row: row,
|
||||
cells: []interface{}{
|
||||
[]interface{}{" ", 7, 2},
|
||||
[]interface{}{"J"},
|
||||
},
|
||||
[]interface{}{" ", 7, 2},
|
||||
[]interface{}{"J"},
|
||||
},
|
||||
},
|
||||
[]Cell{
|
||||
Cell{ true, " ", hldef[7] },
|
||||
Cell{ true, " ", hldef[7] },
|
||||
Cell{ true, "J", hldef[7] },
|
||||
Cell{ true, "i", hldef[6] },
|
||||
Cell{ true, "m", hldef[6] },
|
||||
Cell{true, " ", hldef[7]},
|
||||
Cell{true, " ", hldef[7]},
|
||||
Cell{true, "J", hldef[7]},
|
||||
Cell{true, "i", hldef[6]},
|
||||
Cell{true, "m", hldef[6]},
|
||||
},
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -314,15 +310,15 @@ func TestWindow_updateLine(t *testing.T) {
|
|||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
w := &Window{
|
||||
s: tt.fields.s,
|
||||
content: tt.fields.content,
|
||||
grid: tt.fields.grid,
|
||||
cols: tt.fields.cols,
|
||||
rows: tt.fields.rows,
|
||||
s: tt.fields.s,
|
||||
content: tt.fields.content,
|
||||
grid: tt.fields.grid,
|
||||
cols: tt.fields.cols,
|
||||
rows: tt.fields.rows,
|
||||
}
|
||||
w.updateLine(tt.args.col, tt.args.row, tt.args.cells)
|
||||
|
||||
got := w.content[row];
|
||||
got := w.content[row]
|
||||
for i, cell := range got {
|
||||
if cell == nil {
|
||||
continue
|
||||
|
|
|
@ -7,9 +7,9 @@ import (
|
|||
func createExternalWin() *ExternalWin {
|
||||
extwin := NewExternalWin(nil, 0)
|
||||
|
||||
extwin.SetWindowFlag(core.Qt__WindowMaximizeButtonHint, false)
|
||||
extwin.SetWindowFlag(core.Qt__WindowMinimizeButtonHint, false)
|
||||
extwin.SetWindowFlag(core.Qt__WindowCloseButtonHint, false)
|
||||
extwin.SetWindowFlag(core.Qt__WindowMaximizeButtonHint, false)
|
||||
extwin.SetWindowFlag(core.Qt__WindowMinimizeButtonHint, false)
|
||||
extwin.SetWindowFlag(core.Qt__WindowCloseButtonHint, false)
|
||||
extwin.SetWindowFlag(core.Qt__WindowContextHelpButtonHint, false)
|
||||
|
||||
return extwin
|
||||
|
|
|
@ -6,14 +6,14 @@ import (
|
|||
"sync"
|
||||
|
||||
"github.com/akiyosi/goneovim/util"
|
||||
"github.com/therecipe/qt/widgets"
|
||||
"github.com/therecipe/qt/core"
|
||||
"github.com/therecipe/qt/gui"
|
||||
"github.com/therecipe/qt/widgets"
|
||||
)
|
||||
|
||||
// ScrollBar is
|
||||
type ScrollBar struct {
|
||||
mu sync.Mutex
|
||||
mu sync.Mutex
|
||||
|
||||
ws *Workspace
|
||||
widget *widgets.QWidget
|
||||
|
@ -36,7 +36,7 @@ func newScrollBar() *ScrollBar {
|
|||
thumb: thumb,
|
||||
}
|
||||
|
||||
scrollBar.thumb.ConnectMousePressEvent(scrollBar. thumbPress)
|
||||
scrollBar.thumb.ConnectMousePressEvent(scrollBar.thumbPress)
|
||||
scrollBar.thumb.ConnectMouseMoveEvent(scrollBar.thumbScroll)
|
||||
scrollBar.thumb.ConnectMouseReleaseEvent(scrollBar.thumbRelease)
|
||||
scrollBar.thumb.ConnectEnterEvent(scrollBar.thumbEnter)
|
||||
|
@ -79,7 +79,7 @@ func (s *ScrollBar) thumbScroll(e *gui.QMouseEvent) {
|
|||
if s.height < 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()
|
||||
if v == 0 {
|
||||
return
|
||||
|
|
|
@ -22,10 +22,10 @@ import (
|
|||
// Statusline is
|
||||
type Statusline struct {
|
||||
ws *Workspace
|
||||
hl *Highlight
|
||||
hl *Highlight
|
||||
widget *widgets.QWidget
|
||||
|
||||
height int
|
||||
height int
|
||||
|
||||
left *LeftStatusItem
|
||||
|
||||
|
@ -121,10 +121,10 @@ type StatuslineMode struct {
|
|||
|
||||
// StatuslineGit is
|
||||
type StatuslineGit struct {
|
||||
s *Statusline
|
||||
branch string
|
||||
file string
|
||||
c *StatuslineComponent
|
||||
s *Statusline
|
||||
branch string
|
||||
file string
|
||||
c *StatuslineComponent
|
||||
}
|
||||
|
||||
// StatuslineEncoding is
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
||||
func (s *Statusline) getColor() {
|
||||
if s.ws.screen.highlightGroup == nil || s.ws.screen.hlAttrDef == nil {
|
||||
return
|
||||
|
|
592
editor/svg.go
592
editor/svg.go
File diff suppressed because one or more lines are too long
|
@ -170,9 +170,9 @@ func newTab() *Tab {
|
|||
l.AddWidget(closeIcon, 0, 0)
|
||||
w.SetLayout(l)
|
||||
tab := &Tab{
|
||||
widget: w,
|
||||
layout: l,
|
||||
file: file,
|
||||
widget: w,
|
||||
layout: l,
|
||||
file: file,
|
||||
closeIcon: closeIcon,
|
||||
}
|
||||
if editor.config.Tabline.ShowIcon {
|
||||
|
@ -387,7 +387,6 @@ func (t *Tabline) update(args []interface{}) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
func getFileType(text string) string {
|
||||
if strings.HasPrefix(text, "term://") {
|
||||
return "terminal"
|
||||
|
|
|
@ -513,7 +513,7 @@ func (w *Workspace) initGonvim() {
|
|||
command! GonvimVersion echo "%s"`, editor.version)
|
||||
if !w.uiRemoteAttached {
|
||||
if !editor.config.MiniMap.Disable {
|
||||
gonvimCommands = gonvimCommands + `
|
||||
gonvimCommands = gonvimCommands + `
|
||||
command! GonvimMiniMap call rpcnotify(0, "Gui", "gonvim_minimap_toggle")
|
||||
`
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ func (w *Workspace) getColorscheme() {
|
|||
colorscheme := ""
|
||||
go func() {
|
||||
w.nvim.Var("colors_name", &colorscheme)
|
||||
done <-true
|
||||
done <- true
|
||||
}()
|
||||
select {
|
||||
case <-done:
|
||||
|
@ -579,7 +579,7 @@ func (w *Workspace) getTS() {
|
|||
ts := 8
|
||||
go func() {
|
||||
w.nvim.Option("ts", &ts)
|
||||
done <-true
|
||||
done <- true
|
||||
}()
|
||||
select {
|
||||
case <-done:
|
||||
|
@ -593,7 +593,7 @@ func (w *Workspace) getBG() {
|
|||
screenbg := "dark"
|
||||
go func() {
|
||||
w.nvim.Option("background", &screenbg)
|
||||
done <-true
|
||||
done <- true
|
||||
}()
|
||||
select {
|
||||
case <-done:
|
||||
|
@ -635,7 +635,7 @@ func (w *Workspace) getKeymaps() {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
done <-true
|
||||
done <- true
|
||||
}()
|
||||
select {
|
||||
case <-done:
|
||||
|
@ -666,7 +666,7 @@ func (w *Workspace) getKeymaps() {
|
|||
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
|
||||
}
|
||||
// Count user def alt/meta key mappings
|
||||
|
@ -692,7 +692,7 @@ func (w *Workspace) getNumOfTabs() int {
|
|||
num := 0
|
||||
go func() {
|
||||
w.nvim.Eval("tabpagenr('$')", &num)
|
||||
done <-true
|
||||
done <- true
|
||||
}()
|
||||
select {
|
||||
case <-done:
|
||||
|
@ -719,23 +719,23 @@ func (w *Workspace) nvimEval(s string) (interface{}, error) {
|
|||
}
|
||||
|
||||
func (w *Workspace) handleChangeCwd(cwdinfo map[string]interface{}) {
|
||||
scope, ok := cwdinfo["scope"]
|
||||
if !ok {
|
||||
scope = "global"
|
||||
}
|
||||
cwdITF, ok := cwdinfo["cwd"]
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
cwd := cwdITF.(string)
|
||||
switch scope {
|
||||
case "global" :
|
||||
w.setCwd(cwd)
|
||||
case "tab" :
|
||||
w.setCwdInTab(cwd)
|
||||
case "window" :
|
||||
w.setCwdInWin(cwd)
|
||||
}
|
||||
scope, ok := cwdinfo["scope"]
|
||||
if !ok {
|
||||
scope = "global"
|
||||
}
|
||||
cwdITF, ok := cwdinfo["cwd"]
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
cwd := cwdITF.(string)
|
||||
switch scope {
|
||||
case "global":
|
||||
w.setCwd(cwd)
|
||||
case "tab":
|
||||
w.setCwdInTab(cwd)
|
||||
case "window":
|
||||
w.setCwdInWin(cwd)
|
||||
}
|
||||
}
|
||||
|
||||
func (w *Workspace) setCwd(cwd string) {
|
||||
|
@ -1368,8 +1368,8 @@ func (w *Workspace) getPos() {
|
|||
}
|
||||
|
||||
w.curPosMutex.Lock()
|
||||
w.curLine = curPos[1]
|
||||
w.curColm = curPos[2]
|
||||
w.curLine = curPos[1]
|
||||
w.curColm = curPos[2]
|
||||
w.curPosMutex.Unlock()
|
||||
}
|
||||
|
||||
|
@ -1482,7 +1482,7 @@ func (w *Workspace) handleRPCGui(updates []interface{}) {
|
|||
case "gonvim_workspace_switch":
|
||||
editor.workspaceSwitch(util.ReflectToInt(updates[1]))
|
||||
case "gonvim_workspace_cwd":
|
||||
cwdinfo :=updates[1].(map[string]interface{})
|
||||
cwdinfo := updates[1].(map[string]interface{})
|
||||
w.handleChangeCwd(cwdinfo)
|
||||
case "gonvim_workspace_filepath":
|
||||
w.minimap.mu.Lock()
|
||||
|
@ -1688,7 +1688,7 @@ func getFontFamilyAndHeightAndWeightAndStretch(s string) (string, float64, gui.Q
|
|||
|
||||
if height <= 1.0 && width <= 0 {
|
||||
height = 12
|
||||
width = 6
|
||||
width = 6
|
||||
} else if height > 1.0 && width == -1.0 {
|
||||
width = height / 2.0
|
||||
} else if height <= 1.0 && width >= 1.0 {
|
||||
|
@ -1825,7 +1825,7 @@ func (w *Workspace) getPumHeight() {
|
|||
errCh := make(chan error, 60)
|
||||
go func() {
|
||||
err := w.nvim.Option("pumheight", &ph)
|
||||
errCh <-err
|
||||
errCh <- err
|
||||
}()
|
||||
select {
|
||||
case <-errCh:
|
||||
|
@ -1882,7 +1882,6 @@ func (w *Workspace) getFileType(args []interface{}) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
func (w *Workspace) getWinblendAll() {
|
||||
w.screen.windows.Range(func(_, winITF interface{}) bool {
|
||||
win := winITF.(*Window)
|
||||
|
@ -1966,7 +1965,7 @@ type WorkspaceSide struct {
|
|||
header *widgets.QLabel
|
||||
items []*WorkspaceSideItem
|
||||
|
||||
isShown bool
|
||||
isShown bool
|
||||
isInitResize bool
|
||||
}
|
||||
|
||||
|
@ -2054,7 +2053,7 @@ func (side *WorkspaceSide) show() {
|
|||
if !side.isInitResize {
|
||||
editor.splitter.SetSizes(
|
||||
[]int{editor.config.SideBar.Width,
|
||||
editor.width - editor.config.SideBar.Width},
|
||||
editor.width - editor.config.SideBar.Width},
|
||||
)
|
||||
side.isInitResize = true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue