Drop another dependency
This commit is contained in:
parent
19ffbc6f3d
commit
10d11bc749
2
go.mod
2
go.mod
@ -3,7 +3,6 @@ module kitty
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/mattn/go-runewidth v0.0.13
|
||||
github.com/seancfoley/ipaddress-go v1.2.1
|
||||
github.com/spf13/cobra v1.5.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
@ -13,6 +12,5 @@ require (
|
||||
|
||||
require (
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/seancfoley/bintree v1.1.0 // indirect
|
||||
)
|
||||
|
||||
4
go.sum
4
go.sum
@ -1,10 +1,6 @@
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
|
||||
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/seancfoley/bintree v1.1.0 h1:6J0rj9hLNLIcWSsfYdZ4ZHkMHokaK/PHkak8qyBO/mc=
|
||||
github.com/seancfoley/bintree v1.1.0/go.mod h1:CtE6qO6/n9H3V2CAGEC0lpaYr6/OijhNaMG/dt7P70c=
|
||||
|
||||
@ -10,13 +10,13 @@ import (
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/mattn/go-runewidth"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"kitty"
|
||||
"kitty/tools/tty"
|
||||
"kitty/tools/tui"
|
||||
"kitty/tools/utils"
|
||||
)
|
||||
|
||||
@ -120,7 +120,7 @@ func format_line_with_indent(output io.Writer, text string, indent string, scree
|
||||
var escapes strings.Builder
|
||||
|
||||
print_word := func(r rune) {
|
||||
w := runewidth.StringWidth(current_word.String())
|
||||
w := tui.Wcswidth(current_word.String())
|
||||
if x+w > screen_width {
|
||||
fmt.Fprintln(output)
|
||||
fmt.Fprint(output, indent)
|
||||
|
||||
@ -4,8 +4,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/mattn/go-runewidth"
|
||||
)
|
||||
|
||||
type KilledBySignal struct {
|
||||
@ -25,9 +23,9 @@ func ReadPassword(prompt string, kill_if_signaled bool) (password string, err er
|
||||
}
|
||||
|
||||
loop.OnText = func(loop *Loop, text string, from_key_event bool, in_bracketed_paste bool) error {
|
||||
old_width := runewidth.StringWidth(password)
|
||||
old_width := Wcswidth(password)
|
||||
password += text
|
||||
new_width := runewidth.StringWidth(password)
|
||||
new_width := Wcswidth(password)
|
||||
if new_width > old_width {
|
||||
extra := strings.Repeat("*", new_width-old_width)
|
||||
loop.QueueWriteString(extra)
|
||||
@ -40,9 +38,9 @@ func ReadPassword(prompt string, kill_if_signaled bool) (password string, err er
|
||||
if event.MatchesPressOrRepeat("backscape") || event.MatchesPressOrRepeat("delete") {
|
||||
event.Handled = true
|
||||
if len(password) > 0 {
|
||||
old_width := runewidth.StringWidth(password)
|
||||
old_width := Wcswidth(password)
|
||||
password = password[:len(password)-1]
|
||||
new_width := runewidth.StringWidth(password)
|
||||
new_width := Wcswidth(password)
|
||||
delta := new_width - old_width
|
||||
if delta > 0 {
|
||||
if delta > len(shadow) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user