diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2015-11-09 22:01:40 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-11-09 22:01:40 +0900 |
| commit | dbc854d5f470d6a995401b3e6386687e7663cddd (patch) | |
| tree | 02e598e961e164cdce0d595df4f231ed6f12ff9b /src | |
| parent | f1cd0e2daf4b0ba8fbe94b334a321c9c287414ad (diff) | |
| download | fzf-dbc854d5f470d6a995401b3e6386687e7663cddd.tar.gz | |
Handle wide unicode characters in --prompt
Diffstat (limited to 'src')
| -rw-r--r-- | src/terminal.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/terminal.go b/src/terminal.go index ed79728d..eb82bd85 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -391,7 +391,7 @@ func (t *Terminal) move(y int, x int, clear bool) { } 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() { @@ -402,7 +402,7 @@ func (t *Terminal) printPrompt() { func (t *Terminal) printInfo() { 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 { C.CPrint(C.ColSpinner, true, " < ") } else { @@ -1023,7 +1023,7 @@ func (t *Terminal) Loop() { my >= t.marginInt[0] && my < C.MaxY()-t.marginInt[2] { mx -= t.marginInt[3] 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 { my = t.maxHeight() - my - 1 } |
