mirror of
https://github.com/akiyosi/goneovim.git
synced 2025-08-29 14:18:15 +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 := ""
|
||||
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"
|
||||
|
||||
|
|
|
@ -18,20 +18,19 @@ func TestLinuxEditor_convertKey(t *testing.T) {
|
|||
}{
|
||||
{
|
||||
`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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -18,20 +18,19 @@ func TestLinuxEditor_convertKey(t *testing.T) {
|
|||
}{
|
||||
{
|
||||
`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()
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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":
|
||||
|
@ -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,7 +827,6 @@ 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)
|
||||
|
@ -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,7 +1896,7 @@ 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
|
||||
|
@ -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]
|
||||
|
|
|
@ -14,4 +14,3 @@ func createExternalWin() *ExternalWin {
|
|||
|
||||
return extwin
|
||||
}
|
||||
|
||||
|
|
|
@ -220,13 +220,12 @@ func TestWindow_updateLine(t *testing.T) {
|
|||
},
|
||||
},
|
||||
[]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",
|
||||
|
@ -245,13 +244,12 @@ func TestWindow_updateLine(t *testing.T) {
|
|||
},
|
||||
},
|
||||
[]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",
|
||||
|
@ -273,13 +271,12 @@ func TestWindow_updateLine(t *testing.T) {
|
|||
},
|
||||
},
|
||||
[]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",
|
||||
|
@ -299,13 +296,12 @@ func TestWindow_updateLine(t *testing.T) {
|
|||
},
|
||||
},
|
||||
[]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]},
|
||||
},
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -322,7 +318,7 @@ func TestWindow_updateLine(t *testing.T) {
|
|||
}
|
||||
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
|
||||
|
|
|
@ -6,9 +6,9 @@ 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
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -387,7 +387,6 @@ func (t *Tabline) update(args []interface{}) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
func getFileType(text string) string {
|
||||
if strings.HasPrefix(text, "term://") {
|
||||
return "terminal"
|
||||
|
|
|
@ -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:
|
||||
|
@ -729,11 +729,11 @@ func (w *Workspace) handleChangeCwd(cwdinfo map[string]interface{}) {
|
|||
}
|
||||
cwd := cwdITF.(string)
|
||||
switch scope {
|
||||
case "global" :
|
||||
case "global":
|
||||
w.setCwd(cwd)
|
||||
case "tab" :
|
||||
case "tab":
|
||||
w.setCwdInTab(cwd)
|
||||
case "window" :
|
||||
case "window":
|
||||
w.setCwdInWin(cwd)
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue