diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2023-02-19 16:38:26 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-02-19 16:38:26 +0900 |
| commit | b1459c79cfc004dd7944f4db3ffb5a4ae20569ca (patch) | |
| tree | 359340e3501353c63440e96c115a3cef91e4e11a /src | |
| parent | 352ea072269dfe2a3c429785a95a2f22887ccda3 (diff) | |
| download | fzf-b1459c79cfc004dd7944f4db3ffb5a4ae20569ca.tar.gz | |
Make sure that the query before the cursor is not hidden
Close #3176
Diffstat (limited to 'src')
| -rw-r--r-- | src/terminal.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/terminal.go b/src/terminal.go index 8ab5434c..ebb48887 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -1338,8 +1338,7 @@ func (t *Terminal) updatePromptOffset() ([]rune, []rune) { _, overflow := t.trimLeft(t.input[:t.cx], maxWidth) minOffset := int(overflow) - maxOffset := util.Min(util.Min(len(t.input), minOffset+maxWidth), t.cx) - + maxOffset := minOffset + (maxWidth-util.Max(0, maxWidth-t.cx))/2 t.xoffset = util.Constrain(t.xoffset, minOffset, maxOffset) before, _ := t.trimLeft(t.input[t.xoffset:t.cx], maxWidth) beforeLen := t.displayWidth(before) |
