This commit is contained in:
akiyosi 2020-09-26 12:04:36 +09:00
parent 06ce0a7f9f
commit 966a1c5513
21 changed files with 568 additions and 586 deletions

View file

@ -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"

View file

@ -31,7 +31,6 @@ func TestLinuxEditor_convertKey(t *testing.T) {
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()

View file

@ -66,7 +66,6 @@ func TestDarwinEditor_convertKey(t *testing.T) {
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()

View file

@ -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

View file

@ -31,7 +31,6 @@ func TestLinuxEditor_convertKey(t *testing.T) {
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()

View file

@ -3,4 +3,3 @@ package editor
func (e *Editor) InitSpecialKeys() { func (e *Editor) InitSpecialKeys() {
e.initSpecialKeys() e.initSpecialKeys()
} }

View file

@ -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

View file

@ -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"
) )
// //

View file

@ -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"

View file

@ -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

View file

@ -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)
@ -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)
@ -2978,7 +2977,6 @@ func (win *Window) getWinblend() {
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 {

View file

@ -14,4 +14,3 @@ func createExternalWin() *ExternalWin {
return extwin return extwin
} }

View file

@ -226,7 +226,6 @@ func TestWindow_updateLine(t *testing.T) {
Cell{true, " ", hldef[7]}, Cell{true, " ", hldef[7]},
Cell{true, " ", hldef[7]}, Cell{true, " ", hldef[7]},
}, },
}, },
{ {
"test_updateline() 2", "test_updateline() 2",
@ -251,7 +250,6 @@ func TestWindow_updateLine(t *testing.T) {
Cell{true, "*", hldef[6]}, Cell{true, "*", hldef[6]},
Cell{true, "*", hldef[6]}, Cell{true, "*", hldef[6]},
}, },
}, },
{ {
"test_updateline() 3", "test_updateline() 3",
@ -279,7 +277,6 @@ func TestWindow_updateLine(t *testing.T) {
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",
@ -305,7 +302,6 @@ func TestWindow_updateLine(t *testing.T) {
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

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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)