mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
all: clean up code, upgrade to modern Go
Signed-off-by: ddkwork
This commit is contained in:
@@ -8,7 +8,6 @@ package app
|
||||
import (
|
||||
"errors"
|
||||
"runtime"
|
||||
|
||||
"unsafe"
|
||||
|
||||
"gioui.org/gpu"
|
||||
|
||||
@@ -40,6 +40,7 @@ static CFTypeRef newNSString(unichar *chars, NSUInteger length) {
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"sync"
|
||||
|
||||
+2
-3
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user