all: clean up code, upgrade to modern Go

Signed-off-by: ddkwork
This commit is contained in:
Admin
2025-05-05 23:27:04 +08:00
committed by Elias Naur
parent 86668e8b45
commit f73287be87
58 changed files with 413 additions and 241 deletions
-1
View File
@@ -8,7 +8,6 @@ package app
import (
"errors"
"runtime"
"unsafe"
"gioui.org/gpu"
+1
View File
@@ -40,6 +40,7 @@ static CFTypeRef newNSString(unichar *chars, NSUInteger length) {
}
*/
import "C"
import (
"errors"
"sync"
+2 -3
View File
@@ -26,6 +26,7 @@ package app
*/
import "C"
import (
"errors"
"fmt"
@@ -751,9 +752,7 @@ func (h *x11EventHandler) handleEvents() bool {
return redraw
}
var (
x11Threads sync.Once
)
var x11Threads sync.Once
func init() {
x11Driver = newX11Window
+1 -4
View File
@@ -444,10 +444,7 @@ func (c *callbacks) SetComposingRegion(r key.Range) {
func (c *callbacks) EditorInsert(text string) {
sel := c.w.imeState.Selection.Range
c.EditorReplace(sel, text)
start := sel.Start
if sel.End < start {
start = sel.End
}
start := min(sel.End, sel.Start)
sel.Start = start + utf8.RuneCountInString(text)
sel.End = sel.Start
c.SetEditorSelection(sel)