mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
+3
-3
@@ -427,11 +427,11 @@ func (w *window) addEventListeners() {
|
|||||||
// Safari sends "insertReplacementText" for autocorrect, but the cursor is at the end of the word, so we need to find the word start.
|
// Safari sends "insertReplacementText" for autocorrect, but the cursor is at the end of the word, so we need to find the word start.
|
||||||
insertLen := utf8.RuneCountInString(data)
|
insertLen := utf8.RuneCountInString(data)
|
||||||
wordStart := absStart
|
wordStart := absStart
|
||||||
|
|
||||||
if absStart > snippetStart {
|
if absStart > snippetStart {
|
||||||
relPos := absStart - snippetStart
|
relPos := absStart - snippetStart
|
||||||
snippetRunes := []rune(st.Snippet.Text)
|
snippetRunes := []rune(st.Snippet.Text)
|
||||||
|
|
||||||
for i := relPos - 1; i >= 0; i-- {
|
for i := relPos - 1; i >= 0; i-- {
|
||||||
if i >= len(snippetRunes) {
|
if i >= len(snippetRunes) {
|
||||||
continue
|
continue
|
||||||
@@ -443,7 +443,7 @@ func (w *window) addEventListeners() {
|
|||||||
wordStart = snippetStart + i
|
wordStart = snippetStart + i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
replaceRange := key.Range{Start: wordStart, End: absStart}
|
replaceRange := key.Range{Start: wordStart, End: absStart}
|
||||||
w.w.EditorReplace(replaceRange, data)
|
w.w.EditorReplace(replaceRange, data)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
//go:build !darwin && !js
|
//go:build !darwin && !js
|
||||||
|
|
||||||
package key
|
package key
|
||||||
|
|
||||||
// ModShortcut is the platform's shortcut modifier, usually the ctrl
|
// ModShortcut is the platform's shortcut modifier, usually the ctrl
|
||||||
|
|||||||
Reference in New Issue
Block a user