mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-16 02:07:06 +00:00
Handle wide unicode characters in --prompt
This commit is contained in:
parent
f1cd0e2daf
commit
dbc854d5f4
@ -391,7 +391,7 @@ func (t *Terminal) move(y int, x int, clear bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) placeCursor() {
|
func (t *Terminal) placeCursor() {
|
||||||
t.move(0, len(t.prompt)+displayWidth(t.input[:t.cx]), false)
|
t.move(0, displayWidth([]rune(t.prompt))+displayWidth(t.input[:t.cx]), false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) printPrompt() {
|
func (t *Terminal) printPrompt() {
|
||||||
@ -402,7 +402,7 @@ func (t *Terminal) printPrompt() {
|
|||||||
|
|
||||||
func (t *Terminal) printInfo() {
|
func (t *Terminal) printInfo() {
|
||||||
if t.inlineInfo {
|
if t.inlineInfo {
|
||||||
t.move(0, len(t.prompt)+displayWidth(t.input)+1, true)
|
t.move(0, displayWidth([]rune(t.prompt))+displayWidth(t.input)+1, true)
|
||||||
if t.reading {
|
if t.reading {
|
||||||
C.CPrint(C.ColSpinner, true, " < ")
|
C.CPrint(C.ColSpinner, true, " < ")
|
||||||
} else {
|
} else {
|
||||||
@ -1023,7 +1023,7 @@ func (t *Terminal) Loop() {
|
|||||||
my >= t.marginInt[0] && my < C.MaxY()-t.marginInt[2] {
|
my >= t.marginInt[0] && my < C.MaxY()-t.marginInt[2] {
|
||||||
mx -= t.marginInt[3]
|
mx -= t.marginInt[3]
|
||||||
my -= t.marginInt[0]
|
my -= t.marginInt[0]
|
||||||
mx = util.Constrain(mx-len(t.prompt), 0, len(t.input))
|
mx = util.Constrain(mx-displayWidth([]rune(t.prompt)), 0, len(t.input))
|
||||||
if !t.reverse {
|
if !t.reverse {
|
||||||
my = t.maxHeight() - my - 1
|
my = t.maxHeight() - my - 1
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user