zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: segfault in tab-completion menu if terminal is only one line tall
Date: Sat, 18 Jan 2014 12:20:25 -0800	[thread overview]
Message-ID: <140118122025.ZM9203@torch.brasslantern.com> (raw)
In-Reply-To: <20140118003701.GZ27889@sym.noone.org>

On Jan 18,  1:37am, Axel Beckert wrote:
}
} 1. Open terminal emulator
} 
} 2. Resize window so that there's only one line for the shell (i.e.
} where the prompt also is).
} 
} 3. Enter: ls <tab><tab> (that is, begin typing the 'ls' command, then
} press tabulator twice to tab complete.)

I was able to reproduce if I start zsh in an 80x1 terminal emulator, but
not after resizing a larger terminal where zsh is already running down
to 1 line.  Possibly something is getting initialized differently in the
two cases.

Other strange things happen if I size the window down to 1 line, try a
completion, and then stretch back to a larger size again; e.g., repainting
the prompt above the select menu doesn't work properly.

} zstyle ':completion:*' menu select=long-list select=0
} zstyle ':completion:*' select-prompt '%SScrolling active - %l%s'

Yes, those are necessary (or at least the first one is) because the crash
occurs in the zsh/complist module which is used for "menu select=long".

The following patch stops the crash I was able to reproduce, but there
may be other ways to tickle it in different circumstances.  This might
also fix the prompt redisplay problem I mentioned above, but I'm not
confident of my steps to reproduce that one.


diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index bcf3561..b852ee9 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -2500,7 +2500,7 @@ domenuselect(Hookdef dummy, Chdata dat)
 		mlbeg--;
 	    }
 	}
-	if ((space = zterm_lines - pl - mhasstat))
+	if ((space = zterm_lines - pl - mhasstat) > 0)
 	    while (mline >= mlbeg + space)
 		if ((mlbeg += step) + space > mlines)
 		    mlbeg = mlines - space;

-- 
Barton E. Schaefer


      reply	other threads:[~2014-01-18 20:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-18  0:37 Axel Beckert
2014-01-18 20:20 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=140118122025.ZM9203@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).