Skip to content
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

max-lines has no effect #300

Closed
YodaEmbedding opened this issue Jul 13, 2021 · 13 comments
Closed

max-lines has no effect #300

YodaEmbedding opened this issue Jul 13, 2021 · 13 comments
Labels
wontfix This will not be worked on

Comments

@YodaEmbedding
Copy link

YodaEmbedding commented Jul 13, 2021

  • zsh-autocomplete version: b164ae7
  • Zsh version: /bin/zsh zsh-5.8-0-g77d203f
  • Framework: none
  • Plugin manager: none
  • Operating system: Arch Linux

Steps to reproduce:

cd $(mktemp -d)
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
print 'PS1="%# " PS2="  " RPS2="< %^"; setopt transientrprompt
zstyle ":autocomplete:*" max-lines 50%
zstyle ":autocomplete:list-choices:*" max-lines 50%
source ~/zsh-autocomplete/zsh-autocomplete.plugin.zsh
zstyle ":autocomplete:*" max-lines 50%
zstyle ":autocomplete:list-choices:*" max-lines 50%
' > .zshrc
SHELL==zsh
exec -c zsh -fc "HOME=$PWD SHELL=$SHELL TERM=$TERM exec $SHELL -d"

Results:

For a terminal window of size height=8 and width=32,

% l
builtin command
let     limit   local   log
logout
external command
latexmk   libevdev-tweak-device
linguist  llvm-link
(MORE)

Expected:

%
%
%
%
% l
builtin command
let     limit   local   log
(MORE)
@YodaEmbedding YodaEmbedding added the bug Something isn't working label Jul 13, 2021
@marlonrichert
Copy link
Owner

That’s because I removed the max-lines setting some time ago. Please use the list-lines setting instead.

@marlonrichert marlonrichert added wontfix This will not be worked on and removed bug Something isn't working labels Jul 14, 2021
@vitaly
Copy link

vitaly commented Jul 14, 2021

Actually, list-lines still doesn't work:

  • zsh-autocomplete version: b164ae7
  • Zsh version: /usr/local/bin/zsh zsh-5.8-0-g77d203f
  • Framework: zim
  • Plugin manager: none
  • Operating system: darwin19.6.0
cd $(mktemp -d -t autest)
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
print "
PS1='%# ' PS2='  ' RPS2='< %^'; setopt transientrprompt
zstyle ':autocomplete:*' list-lines 2
source ~/zsh-autocomplete/zsh-autocomplete.plugin.zsh
" > .zshrc
exec env -i HOME=$PWD TERM=$TERM SHELL=$SHELL $SHELL -d     
% x
external command
x265             xar              xargs            xattr
xattr-2.7        xcode-select     xcodebuild       xcrun
xcscontrol       xcsdiagnose      xed              xgettext
xgettext.pl      xgettext5.18.pl  xgettext5.28.pl  xip
xjc              xminicom         xml2-config      xml2man
xmlcatalog       xmlif            xmllint          xmlto
xpath            xpath5.18        xpath5.28        xslt-config
xsltproc         xsubpp           xsubpp5.18       xsubpp5.28
xxd              xz               xzcat            xzcmp
xzdec            xzdiff           xzegrep          xzfgrep
xzgrep           xzless           xzmore

I have list-lines set to 8, but it frequently fills my whole screen with suggestions.

@vitaly
Copy link

vitaly commented Jul 14, 2021

I opened a new #302

@YodaEmbedding
Copy link
Author

Is there a way to ensure that completions use only a maximum number/percentage of lines, and without shifting the completion to the top of the terminal window?

Use case: I often want to look at the previous command's output when crafting my new command.

% cat fruits.txt
apples
bananas
oranges
% l
builtin command
let     limit   local   log
(MORE)

In the above example, max-terminal-lines-used=50%, so I can comfortably view the contents of fruits.txt while writing my command, ln -s apples oranges.

@marlonrichert
Copy link
Owner

I have list-lines set to 8, but it frequently fills my whole screen with suggestions.

Because your prompt is not at the bottom of the screen. If the space is already available, it will be filled.

@marlonrichert
Copy link
Owner

Is there a way to ensure that completions use only a maximum number/percentage of lines, and without shifting the completion to the top of the terminal window?

Yes, the list-lines setting. See here for examples.

@vitaly
Copy link

vitaly commented Jul 21, 2021

@marlonrichert Actually it frequently takes my prompt from the bottom of the screen to the top, completely wiping out the information above the command line.

@marlonrichert
Copy link
Owner

@vitaly How tall is your terminal? If it’s 16 lines or less, then that’s expect behavior. You can use list-lines to reduce this. If your terminal is more than 16 lines tall, then that’s a bug. If so, are you able to provide me with a reproducible test case?

@vitaly
Copy link

vitaly commented Jul 22, 2021

As I mentioned I have list-lines set to 8. I figured out what the problem is, or at least a direction to look. in short: tmux. Seems like terminal size detection fails inside tmux: https://www.loom.com/share/317c1da30aa54d7cb4b04bb156759aa8

@vitaly
Copy link

vitaly commented Jul 22, 2021

looks like _autocomplete__buffer_start_line is always 1 in side TMUX

@vitaly
Copy link

vitaly commented Jul 22, 2021

looks like there's no terminfo[u6] and terminfo[u7] inside TMUX

@marlonrichert
Copy link
Owner

Thanks! I will have to think of some kind of workaround for it. In the meantime, can you please open a new issue for this? 🙂

@vitaly
Copy link

vitaly commented Jul 22, 2021

#309

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants