Re: [MSH] Bug: cut & paste with tabs
- From: "Bruce Payette [MSFT]" <BrucePayetteMSFT@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 12 Oct 2005 17:37:08 -0700
msh.exe is a standalone application but it uses the Windows console
subsystem. All of the default command line editing stuff is (mostly)
implemented in Windows by a subsystem instead of in a user mode library like
the GNU readline() library. This means that every console application
automatically gets essentially the same command line editing behaviour.
As a consequence, the mechanism that is used to do tab completion in both
cmd.exe and tab.exe suffer from this pasting problem. The application can't
tell if the user typed a tab or if it was pasted. (As an aside - I've been
meaning to see if I could fix this using the old termcap trick of using
timeouts to distinguish between pasted characters (which arrive quickly) and
typed characters which arrive more slowly. This is the trick that vi uses to
deal with ANSI escape sequences. In vi hitting the escape key puts you in
command mode. Unfortunately keys like the arrow keys start they're sequence
by generating an escape which confuses vi. If you use timeouts you can
distinguish between user typed and generated sequences.)
It is possible to do your own command line editing and by-pass the subsystem
but we didn't have time to all the extra editing code done for V1. For V2,
we're planning to have a much better user experience. In the mean time, try
looking at jamsh - this is a (non-Microsoft) alternative msh host that does
use GNU readline so you get your choice of vi or emacs edit modes. Thomas Lee
mentioned it on his blog...
-bruce
--
Bruce Payette [MSFT]
Microsoft Command Shell Development
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jack Ukleja" wrote:
> So this means that MSH actually invokes the cmd.exe shell? I was thinking
> (hoping?) maybe it was an entirely standalone application (msh is run by
> running msh.exe after all, not a shortcut to cmd.exe + msh parameter).
>
> So, in terms of this ever getting "fixed", are we reliant on someone writing
> an MSH shell that works stand alone (not based on cmd.exe)?
>
> "Jeffrey Snover" wrote:
>
> > This is actually a CONSOLE issue (Verify this by pasting the same text into
> > a CMD.EXE window).
> >
> > --
> > Jeffrey Snover [MSFT]
> > Windows Command Shell Architect
> > Microsoft Corporation
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> >
> > "Jack Ukleja" <JackUkleja@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > news:D203A62E-8965-420B-B769-F657BA7268D7@xxxxxxxxxxxxxxxx
> > >I noticed that when you cut and paste some script, which contains a tab,
> > >into
> > > MSH, the tab is considered by MSH as if you are doing a tab completion and
> > > goes and inserts a file name!
> > >
> > > Now I can see why its doing this - its considering the pasted text as if
> > > it
> > > was being interactively entered, but of course its not! So I dont really
> > > think its suitable to do a tab completion.
> > >
> > > PS. Is there somewhere I should be officially submitting such bugs?
> > >
> > > ----------------
> > > This post is a suggestion for Microsoft, and Microsoft responds to the
> > > suggestions with the most votes. To vote for this suggestion, click the "I
> > > Agree" button in the message pane. If you do not see the button, follow
> > > this
> > > link to open the suggestion in the Microsoft Web-based Newsreader and then
> > > click "I Agree" in the message pane.
> > >
> > > http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?mid=d203a62e-8965-420b-b769-f657ba7268d7&dg=microsoft.public.windows.server.scripting
> >
> >
> >
.
- References:
- Re: [MSH] Bug: cut & paste with tabs
- From: Jeffrey Snover
- Re: [MSH] Bug: cut & paste with tabs
- Prev by Date: Re: Using MSH to parse Freeformat logs into a table
- Next by Date: Re: Find DNS Domain Name
- Previous by thread: Re: [MSH] Bug: cut & paste with tabs
- Next by thread: Re: Find DNS Domain Name
- Index(es):