chore!: change to use v3 of Tcell (#2286)
* Remove SGR 8 * Remove `<backspace2>` * Migrate to v3 of Tcell * Refactor key handling functionality * Bump Tcell version * Replace `SetContent` API with `Put` API * bump dependencies * Use new color package * Fix cursor position for grapheme clusters * Some editing fixes to support grapheme clusters * Ignore carriage return when printing * Move grapheme cluster handling into misc.go * Fix length of filenames containing emoji * Use slices.Concat * Use `string` instead of `[]rune` for `win.print` * Add note about modifier limitations * Update `CHANGELOG.md`
This commit is contained in:
1 parent
a446855e76
commit
6ec60cf9d8
21 files changed
+558
-463
No files matched your search
@@ -14,7 +14,7 @@ import (
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/gdamore/tcell/v3"
|
||||
)
|
||||
|
||||
func applyBoolOpt(opt *bool, e *setExpr) error {
|
||||
@@ -1565,7 +1565,7 @@ func (e *callExpr) eval(app *app, _ []string) {
|
||||
}
|
||||
log.Println("pushing keys", e.args[0])
|
||||
for _, val := range splitKeys(e.args[0]) {
|
||||
app.ui.keyChan <- val
|
||||
app.ui.evChan <- parseKey(val)
|
||||
}
|
||||
case "addcustominfo":
|
||||
var k, v string
|
||||
@@ -1913,14 +1913,16 @@ func (e *callExpr) eval(app *app, _ []string) {
|
||||
if len(app.ui.cmdAccLeft) == 0 {
|
||||
return
|
||||
}
|
||||
app.ui.cmdAccRight = append([]rune{app.ui.cmdAccLeft[len(app.ui.cmdAccLeft)-1]}, app.ui.cmdAccRight...)
|
||||
app.ui.cmdAccLeft = app.ui.cmdAccLeft[:len(app.ui.cmdAccLeft)-1]
|
||||
last := lastGraphemeCluster(app.ui.cmdAccLeft)
|
||||
app.ui.cmdAccRight = slices.Concat(app.ui.cmdAccLeft[len(app.ui.cmdAccLeft)-len(last):], app.ui.cmdAccRight)
|
||||
app.ui.cmdAccLeft = app.ui.cmdAccLeft[:len(app.ui.cmdAccLeft)-len(last)]
|
||||
case "cmd-right":
|
||||
if len(app.ui.cmdAccRight) == 0 {
|
||||
return
|
||||
}
|
||||
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, app.ui.cmdAccRight[0])
|
||||
app.ui.cmdAccRight = app.ui.cmdAccRight[1:]
|
||||
first := firstGraphemeCluster(app.ui.cmdAccRight)
|
||||
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, app.ui.cmdAccRight[:len(first)]...)
|
||||
app.ui.cmdAccRight = app.ui.cmdAccRight[len(first):]
|
||||
case "cmd-home":
|
||||
app.ui.cmdAccRight = append(app.ui.cmdAccLeft, app.ui.cmdAccRight...)
|
||||
app.ui.cmdAccLeft = nil
|
||||
@@ -1931,7 +1933,8 @@ func (e *callExpr) eval(app *app, _ []string) {
|
||||
if len(app.ui.cmdAccRight) == 0 {
|
||||
return
|
||||
}
|
||||
app.ui.cmdAccRight = app.ui.cmdAccRight[1:]
|
||||
first := firstGraphemeCluster(app.ui.cmdAccRight)
|
||||
app.ui.cmdAccRight = app.ui.cmdAccRight[len(first):]
|
||||
update(app)
|
||||
case "cmd-delete-back":
|
||||
if len(app.ui.cmdAccLeft) == 0 {
|
||||
@@ -1949,7 +1952,8 @@ func (e *callExpr) eval(app *app, _ []string) {
|
||||
}
|
||||
return
|
||||
}
|
||||
app.ui.cmdAccLeft = app.ui.cmdAccLeft[:len(app.ui.cmdAccLeft)-1]
|
||||
last := lastGraphemeCluster(app.ui.cmdAccLeft)
|
||||
app.ui.cmdAccLeft = app.ui.cmdAccLeft[:len(app.ui.cmdAccLeft)-len(last)]
|
||||
update(app)
|
||||
case "cmd-delete-home":
|
||||
if len(app.ui.cmdAccLeft) == 0 {
|
||||
|
||||
Reference in new issue
Block a user