-
-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cluttered completion when window is small #1282
Comments
I cannot reproduce this issue, even when I make the terminal window very narrow and small it still works fine. Maybe something triggered by your right-side prompt? I don't normally use one, and a simple one did not trigger the problem but maybe something to try. Maybe this is something specific to your terminal emulator - what are you using? As a side comment, there's no need to store the descriptions as a string and then do the |
Size of the window (shown lines) seems to be very important for this. Couldn't reproduce it at first in the docker container and had to alter the prompt to take as many lines as locally to cause the error. So it seems to be important where the text is "cut". |
Try mv -<TAB> |
Same in |
Sorry, still nothing. I tried with both Terminal.app and iTerm2 on macOS, with the prompt and sizes you suggested, and I still see the correct behavior. I still think this might be emulator-specific, or maybe something specific in Linux-based terminal emulators. |
Just tried to force the error in windows but so far couldn't reproduce it there as well. |
Same error in |
I, too, cannot reproduce using iTerm or Terminal on macOS. It's pretty unlikely to be "linux related". I initially thought it might be a bug in the VTE code but some of the terminal emulators you listed don't use the VTE library. So it's more likely to be a quirk of your environment. Such as how elvish and your terminal decide the width of a particular Unicode code point. @rsteube: Can you reproduce this problem inside a |
@krader1961 same with |
Same with xubuntu in virtualbox vm when resized to |
I can reproduce this on Linux with Konsole. Rather than this being caused by the various terminal implementations on Linux, it's more likely the other way around - the two terminal implementations on macOS happen to not have this particular problem. |
TL;DR: I was able to reproduce on macOS using iTerm.
What I don't understand is what "when the window is small" means given that you say you can reproduce the problem in a 80x25 terminal window. That is, more or less, the size of a classic hardware terminal (80x24 plus a status line). That is not a "small window". I created a iTerm window using my default size and manually resized it to 80x25 using my pointer. That resulted in some unexpected artifacts from rendering the left and right prompts. That may, or may not, be relevant. Using the This appears to be a classic "off by one" error. You can produce this by setting the terminal height to 26 lines and typing |
Note that if you change the |
Good to know about the relation to the amount of entries. I assume the width is at least insofar important that the entries need to be shown as one per line. Btw. during testing these other errors came up with an (unrealistic) small window: github.com/elves/elvish/pkg/cli/prompt/prompt.go:70 +0x165
runtime error: makeslice: cap out of range
created by github.m/elves/elvish/pkgli/prompt.New
github.com
lves/elvish/pkg/cl
prompt/prompt.go:7
+0x165
runtime error: integer divide by zero |
With one line prompt ( ~❱ mv - rsteube@mba
goroutine 1 [running]:
github.com/elves/elvish/pkg/sys.DumpStack(0xc00019ad50, 0x5572e0ffa320)
github.com/elves/elvish/pkg/sys/dumpstack.go:10 +0x9f
github.com/elves/elvish/pkg/shell.handlePanic()
github.com/elves/elvish/pkg/shell/interact.go:39 +0x8a
panic(0x5572e0ffa320, 0x5572e1262fe0)
runtime/panic.go:965 +0x1b9
github.com/elves/elvish/pkg/cli.getHorizontalWindow(0x5572e1070ea0, 0xc0004354a0, 0x0, 0x0, 0x0, 0x0,
0x66, 0x1, 0xc00019b038, 0x5572e0ab77c5)
github.com/elves/elvish/pkg/cli/listbox_window.go:119 +0x24e
github.com/elves/elvish/pkg/cli.(*listBox).renderHorizontal.func1(0xc0000603c8)
github.com/elves/elvish/pkg/cli/listbox.go:96 +0x154
github.com/elves/elvish/pkg/cli.(*listBox).mutate(0xc000060360, 0xc00019b198)
github.com/elves/elvish/pkg/cli/listbox.go:398 +0x72
github.com/elves/elvish/pkg/cli.(*listBox).renderHorizontal(0xc000060360, 0x66, 0x1, 0x16)
github.com/elves/elvish/pkg/cli/listbox.go:92 +0xd4
github.com/elves/elvish/pkg/cli.(*listBox).Render(0xc000060360, 0x66, 0x1, 0xc0002d9860)
github.com/elves/elvish/pkg/cli/listbox.go:83 +0x47
github.com/elves/elvish/pkg/cli.(*comboBox).Render(0xc0001a6d00, 0x66, 0x2, 0xc0002d97d0)
github.com/elves/elvish/pkg/cli/combobox.go:51 +0x9b
github.com/elves/elvish/pkg/cli.renderApp(0x7f0fded1dac8, 0xc000320000, 0x7f0fded3d980, 0xc0001a6d00,
0x66, 0x3, 0x5572e0ffa5c0)
github.com/elves/elvish/pkg/cli/app.go:241 +0xb8
github.com/elves/elvish/pkg/cli.(*app).redraw(0xc00031e000, 0x0)
github.com/elves/elvish/pkg/cli/app.go:216 +0x54c
github.com/elves/elvish/pkg/cli.(*loop).Run(0xc000072500, 0xc00002c101, 0xc0004ac540, 0xc00031e000, 0xc0004929c0)
github.com/elves/elvish/pkg/cli/loop.go:123 +0x5f
github.com/elves/elvish/pkg/cli.(*app).ReadCode(0xc00031e000, 0x0, 0x0, 0x0, 0x0)
github.com/elves/elvish/pkg/cli/app.go:334 +0x3f9
github.com/elves/elvish/pkg/edit.(*Editor).ReadCode(0xc0001a6100, 0xc0000ac010, 0xc0000ac008, 0xc0000ac010, 0xc00016dae0)
github.com/elves/elvish/pkg/edit/editor.go:99 +0x35
github.com/elves/elvish/pkg/shell.Interact(0xc0000ac000, 0xc0000ac008, 0xc0000ac010, 0xc00019bcb8)
github.com/elves/elvish/pkg/shell/interact.go:81 +0x3c2
github.com/elves/elvish/pkg/shell.program.Run(0xc0000ac000, 0xc0000ac008, 0xc0000ac010, 0xc00026d2d0,
0xc00009e1d0, 0x0, 0x0, 0x5572e12a0a60, 0xc00019bf68)
github.com/elves/elvish/pkg/shell/shell.go:40 +0x2de
github.com/elves/elvish/pkg/prog.Run(0xc0000ac000, 0xc0000ac008, 0xc0000ac010, 0xc00009e1d0, 0x1, 0x1, 0xc00019bf48, 0x3, 0x3, 0x0)
github.com/elves/elvish/pkg/prog/prog.go:136 +0x24b
main.main()
github.com/elves/elvish/main.go:17 +0x125
goroutine 33 [chan receive]:
github.com/elves/elvish/pkg/eval.getBlackholeChan.func1(0xc000246060)
github.com/elves/elvish/pkg/eval/port.go:67 +0x49
created by github.com/elves/elvish/pkg/eval.getBlackholeChan
github.com/elves/elvish/pkg/eval/port.go:66 +0x5a
goroutine 5 [syscall]:
os/signal.signal_recv(0x5572e1071350)
runtime/sigqueue.go:168 +0xa5
os/signal.loop()
os/signal/signal_unix.go:23 +0x25
created by os/signal.Notify.func1.1
os/signal/signal.go:151 +0x46
goroutine 49 [chan receive]:
github.com/elves/elvish/pkg/shell.setupShell.func1(0xc000062120, 0xc0000ac000, 0xc0000ac008, 0xc0000ac010)
github.com/elves/elvish/pkg/shell/shell.go:51 +0xa5
created by github.com/elves/elvish/pkg/shell.setupShell
github.com/elves/elvish/pkg/shell/shell.go:50 +0xf9
goroutine 7 [chan receive]:
github.com/elves/elvish/pkg/cli/prompt.(*Prompt).loop(0xc000076b60)
github.com/elves/elvish/pkg/cli/prompt/prompt.go:77 +0xca
created by github.com/elves/elvish/pkg/cli/prompt.New
github.com/elves/elvish/pkg/cli/prompt/prompt.go:70 +0x165
goroutine 8 [chan receive]:
github.com/elves/elvish/pkg/cli/prompt.(*Prompt).loop(0xc000076c40)
github.com/elves/elvish/pkg/cli/prompt/prompt.go:77 +0xca
created by github.com/elves/elvish/pkg/cli/prompt.New
github.com/elves/elvish/pkg/cli/prompt/prompt.go:70 +0x165
runtime error: integer divide by zero
Execing recovery shell /bin/sh
sh-5.1$ |
@rsteube: A terminal with just three lines is asking for trouble from any shell that is not compatible with a dumb terminal; such as the TI Silent 700 I used in 1977 as a high school student. 😄 Which is pretty much any shell newer than the KornShell. Nonetheless, kudos for realizing that unreasonable terminal characteristics are not handled in a reasonable fashion by elvish. |
True, but it shouldn't crash. Im using a tiling window manager and it is not uncommon for me to to have a terminal window open with only few lines visible just to enter build/test commands. |
@rsteube: Agreed that elvish shouldn't crash. The question is what should it do when asked to display completions when there is insufficient room to do so. Possibly the only reasonable course of action is to ignore the request and do nothing. Or possibly do nothing other than display a BEL character (which will cause most terminals to flash and/or provide audible feedback). |
I think this is already integrated as when the height is Given my current prompt style this seems to rather be the case that when there is exactly 1 additional line below the prompt the error occurs. |
The panic should be easy to fix, I'll try to do it soon. |
This is a bit weird as the other completers work and just this one gives problems (and only when the window is small, when it's larger it works).
Should be a side effect from one of the descriptions, but i can't see what is causing it at the moment.
The text was updated successfully, but these errors were encountered: