public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Copy, paste and deleting characters in the openssh screen.
@ 2011-11-09 14:38 gabier
  2011-11-09 16:31 ` Jeremy Bopp
  0 siblings, 1 reply; 3+ messages in thread
From: gabier @ 2011-11-09 14:38 UTC (permalink / raw)
  To: cygwin


Hi,
I am experiencing daily frustration because I do not know how to get the
following features to my fingertips while controlling my Freenas/FreeBSD
server from my openssh console on a remote Windows computer.
1) copy from windows document or browser and paste in the openssh console
2) copy from the openssh console and paste either on another line of the
console or on a windows document
3) correct my openssh commands by deleting characters with the "backwards"
stroke. Sometimes it works, sometimes not, it seems to depend on the type of
login! The local user (Cygwin) seems to work, the root user on the freebsd
server seems also to work, but another user on the freebsd server does not
work : if I hit the "backward stroke" it prints a triangle (meaning I
suppose unknown character) and there is no way to correct this but to send
the wrong command and retype the whole command. With long commands it can be
very frustrating.

For 2) I have found the trick to redirect the output of the command to a
file and then I read the file with an editor, and I can copy and paste it.
But it works only for the output of the command, and not for the command
itself.

I guess the solution is fairly easy. This the newbie condition ;-)

:) Gabier
-- 
View this message in context: http://old.nabble.com/Copy%2C-paste-and-deleting-characters-in-the-openssh-screen.-tp32811323p32811323.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Copy, paste and deleting characters in the openssh screen.
  2011-11-09 14:38 Copy, paste and deleting characters in the openssh screen gabier
@ 2011-11-09 16:31 ` Jeremy Bopp
  2011-11-10  6:43   ` Andy Koppe
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Bopp @ 2011-11-09 16:31 UTC (permalink / raw)
  To: cygwin

On 11/9/2011 08:38, gabier wrote:
>
> Hi,
> I am experiencing daily frustration because I do not know how to get the
> following features to my fingertips while controlling my Freenas/FreeBSD
> server from my openssh console on a remote Windows computer.
> 1) copy from windows document or browser and paste in the openssh console
> 2) copy from the openssh console and paste either on another line of the
> console or on a windows document

While you can get this to work with the default Cygwin terminal 
(cmd.exe), you would be better off installing the mintty package and 
using that for your terminal instead.  You can configure it to behave 
like a typical xterm with respect to copying and pasting, so you may 
find that much more familiar.

To copy and paste from a regular Windows program, highlight the text and 
press CRTL-C to copy as usual.  Then go to your mintty window and paste 
using the method you configured for it in its configuration dialog.  I 
think pressing SHIFT-INS should work by default, but there are other 
options available, including middle clicking (not the default IIRC).

To copy and paste from the mintty window, highlight the text and then 
copy using the method you configured for mintty.  I have my mintty 
configured to copy automatically when text is highlighted, but that's 
not the default as I recall.  Once the text is copied, paste into a 
Windows program as usual with CRTL-V or paste back into the mintty 
window as discussed previously.

> 3) correct my openssh commands by deleting characters with the "backwards"
> stroke. Sometimes it works, sometimes not, it seems to depend on the type of
> login! The local user (Cygwin) seems to work, the root user on the freebsd
> server seems also to work, but another user on the freebsd server does not
> work : if I hit the "backward stroke" it prints a triangle (meaning I
> suppose unknown character) and there is no way to correct this but to send
> the wrong command and retype the whole command. With long commands it can be
> very frustrating.

This may get corrected automatically by using mintty as your terminal, 
but it's really not a Cygwin-specific issue.  I've had similar problems 
in the past and was able to work around them by pressing either CTRL-H 
or CTRL-BACKSPACE.

My vague understanding of the problem is that the terminal sends a 
particular character in response to the backspace key, which is 
configurable in many terminals.  Mintty is one such terminal, but the 
cmd terminal is not.  Without the ability to change the character sent 
by the terminal program, you would need to be able to configure the 
remote applications to do the right thing with whatever character *is* 
sent, but that can be a tall order due to the different ways you may 
have to configure each application.

As I said, that is only my vague understanding of the problem, so it 
could be subtly or glaringly inaccurate.  In any case, however, you will 
likely avoid the problem by using mintty. :-)

-Jeremy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Copy, paste and deleting characters in the openssh screen.
  2011-11-09 16:31 ` Jeremy Bopp
@ 2011-11-10  6:43   ` Andy Koppe
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Koppe @ 2011-11-10  6:43 UTC (permalink / raw)
  To: cygwin

On 9 November 2011 16:31, Jeremy Bopp wrote:
> On 11/9/2011 08:38, gabier wrote:
>>
>> Hi,
>> I am experiencing daily frustration because I do not know how to get the
>> following features to my fingertips while controlling my Freenas/FreeBSD
>> server from my openssh console on a remote Windows computer.
>> 1) copy from windows document or browser and paste in the openssh console
>> 2) copy from the openssh console and paste either on another line of the
>> console or on a windows document
>
> While you can get this to work with the default Cygwin terminal (cmd.exe),

<pedantry>
Cmd.exe and the console window (as used by Cygwin) are separate
things. Windows automatically creates a console window when a console
program is invoked from Explorer. Cmd.exe is just one such console
program; Cygwin's bash.exe is another.
</pedantry>

> you would be better off installing the mintty package and using that for
> your terminal instead.  You can configure it to behave like a typical xterm
> with respect to copying and pasting, so you may find that much more
> familiar.
>
> To copy and paste from a regular Windows program, highlight the text and
> press CRTL-C to copy as usual.  Then go to your mintty window and paste
> using the method you configured for it in its configuration dialog.  I think
> pressing SHIFT-INS should work by default, but there are other options
> available, including middle clicking (not the default IIRC).

Paste by middle-click is enabled by default too.

> To copy and paste from the mintty window, highlight the text and then copy
> using the method you configured for mintty.  I have my mintty configured to
> copy automatically when text is highlighted, but that's not the default as I
> recall.

It wasn't on by default originally, but it has been for a little while
now. Other ways include the Copy command in the right-click menu and
its Ctrl+Ins shortcut.

> Once the text is copied, paste into a Windows program as usual with
> CRTL-V or paste back into the mintty window as discussed previously.

Note besides: Ctrl+Ins for copy and Shift+Ins for paste are standard
Windows shortcuts too. Ctrl+C and Ctrl+V can't reasonably be used as
shortcuts by a terminal because they're used by many terminal
applications. However, there's an option on the Keys page of mintty's
options dialog that allows Ctrl+Shift+C and Ctrl+Shift+V to be used
for copy/paste.

>> 3) correct my openssh commands by deleting characters with the "backwards"
>> stroke. Sometimes it works, sometimes not, it seems to depend on the type
>> of
>> login! The local user (Cygwin) seems to work, the root user on the freebsd
>> server seems also to work, but another user on the freebsd server does not
>> work : if I hit the "backward stroke" it prints a triangle (meaning I
>> suppose unknown character) and there is no way to correct this but to send
>> the wrong command and retype the whole command. With long commands it can
>> be very frustrating.

What sort of server is it?

> This may get corrected automatically by using mintty as your terminal, but
> it's really not a Cygwin-specific issue.  I've had similar problems in the
> past and was able to work around them by pressing either CTRL-H or
> CTRL-BACKSPACE.
>
> My vague understanding of the problem is that the terminal sends a
> particular character in response to the backspace key, which is configurable
> in many terminals.

Yep. Ye olde and ever-exciting ^? vs ^H issue.

> Mintty is one such terminal, but the cmd terminal is not.

Actually the Cygwin console's backspace character can be changed too,
but only through a control sequence:

For ^H: echo -ne '\e[?67h'
For ^?: echo -ne '\e[?67l'

Both the console and mintty use ^? by default. Linux terminals also
usually default to ^?, but BSDs might well default to ^H.

> Without the ability to change the character sent by the terminal
> program, you would need to be able to configure the remote applications to
> do the right thing with whatever character *is* sent, but that can be a tall
> order due to the different ways you may have to configure each application.

You could try the following command on the remote system to tell it
that the backspace key sends ^?:

stty erase '^?'

(Many ssh servers set that automatically in accordance with the
setting on the client side, but apparently some don't.)

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-10  6:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-09 14:38 Copy, paste and deleting characters in the openssh screen gabier
2011-11-09 16:31 ` Jeremy Bopp
2011-11-10  6:43   ` Andy Koppe

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 read-only IMAP folder(s) and NNTP newsgroup(s).