zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: menu-select interactive mode
Date: Sun, 24 Apr 2011 11:38:37 -0700	[thread overview]
Message-ID: <110424113837.ZM30279@torch.brasslantern.com> (raw)
In-Reply-To: <a06240800c9d9a82e57f1@kba.biglobe.ne.jp>

On Apr 24,  7:40pm, Jun T. wrote:
}
} > .... (snip)
} >Now hit ESC-m to enter menu-selection.  I'm not even going to attempt
} >to copy-paste the result, it's a screenful of garbage memory contents.
} 
} I did some analysis on this problem.
} I think I found what is causing the problem, but do not know how to fix it.
} (The zsh is the latest CVS with ./configure --enable-zsh-debug).
} 
} ## domenuselect() uses origline, but it has been corrupted
} ## (it should be "ls "), and the command line will be broken soon.
} 
} During "menu completion", the execution of zsh returns to
} zlecore() after each TAB, and freeheap() is called at zle_main.c:1102.

The problem seems to be that the menuselect widget bypasses docomplete()
and jumps directly into domenuselect().  This misses out on some of the
setup performed by docomplete() -- normally domenuselect() is entered
from the after_complete() hook called at zle_tricky.c:869.

There's a code fragment at the top of domenuselect() that is partly
responsible for dealing with this situation:

    /*
     * Lots of the logic here doesn't really make sense if the
     * line isn't metafied, but the evidence was that it only used
     * to be metafied locally in a couple of places.
     * It's horrifically difficult to work out where the line
     * is metafied, so I've resorted to the following.
     * Unfortunately we need to unmetatfy in zrefresh() when
     * we want to display something.  Maybe this function can
     * be done better.
     */
    if (zlemetaline != NULL)
	wasmeta = 1;
    else {
	wasmeta = 0;
	metafy_line();
    }

In that else block I added code to populate origline/origcs/origll, as
happens in docomplete() right after metafy_line(), and that resolves
the memory issues -- but I'm not sure that menuselection is entered
in the correct state.  I think what *should* happen (from the user's
point of view) is that the line is restored back to just "ls " (the
starting point of menu completion) before selection begins.  That is
stored in the global struct "minfo" but I don't know the conditions
in which it's OK to access that and whether minfo.pos points into a
metafied or unmetafied line.


  reply	other threads:[~2011-04-24 18:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-09 14:56 Mikael Magnusson
2011-04-09 15:02 ` Mikael Magnusson
     [not found]   ` <BANLkTinRkfcNJWnYnooq SDWTYG2q1VrcZQ@mail.gmail.com>
2011-04-09 20:12   ` Bart Schaefer
2011-04-09 20:58     ` Mikael Magnusson
     [not found]       ` <110410074855.ZM9428@ torch.brasslantern.com>
2011-04-10 14:48       ` Bart Schaefer
2011-04-10 15:37         ` Mikael Magnusson
2011-04-10 18:50           ` Bart Schaefer
2011-04-10 19:19             ` Mikael Magnusson
2011-04-24 10:40             ` Jun T.
2011-04-24 18:38               ` Bart Schaefer [this message]
     [not found]                 ` <a06240800c9db5111c85e@kba.biglobe.ne.jp>
2011-04-26  0:55                   ` Bart Schaefer
2011-04-26 16:31                     ` Jun T.
2011-04-24 12:18         ` Jun T.
2011-04-24 19:13           ` Bart Schaefer
2011-04-26  0:06 Jun T.

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=110424113837.ZM30279@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).