You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Adjust the solution to cut/copy/paste shortcuts #523
I know a similar issue has already been raised (#252), but I have a modified proposal.
I'd like to request to have the reverse option — i.e. Mintty would interpret Ctrl-C as copy and Ctrl-Shift-C as sending interrupt sequence instead of the opposite.
The second part I can partially do on my own (e.g. remap Ctrl-C to Ctrl-K through stty intr \^k
as I found out in this helpful post https://superuser.com/questions/160388/change-bash-shortcut-keys-such-as-ctrl-c. I'm still missing the part where I can insert Shift, but that may be impossible in stty)
However, I'm still missing the first — being able to use the now free Ctrl-C shortcut to actually copy&paste.
P.S.
Also, I think referring to an ancient
They were introduced by IBM's Common User Access (CUA) standard.
doesn't make any sense — we should consider the standard of actual user behavior, which is overwhelmingly Ctrl-C as a copy command across almost all of the apps (and doesn't require two hands to press).
I can press Ctrl+Shift+c with one hand...
What’s so bad about it?
What’s the quote about CUA? No idea what you are referring to.
About what’s standard, this is a matter of taste here. You are referring to a standard for GUI applications. While mintty is itself a GUI application, its purpose is to serve text-mode applications which do not share that standard. Many of them rather have quite different expectations, among which is the availability of the traditional control keys, whether they have a stty-related special function or not (which also many applications temporarily disable, just for the purpose of using those keys directly). For example, text editors may use Ctrl+C either for interrupt as well, or for page down.
For that reason it is not a good idea to map control keys to meta functions by a configurable option, so semi-statically. It would be acceptable to use a more dynamic solution, and that actually exists already half-way, see below.
There is Application control key mode which lets you redefine the control keys to escape sequences, and you could further redefine those (or maybe the original control key) in your application if it has that feature. That would not give you access to mintty’s own functions, though. Maybe it could somehow be extended towards the meta-functions.
Thank you for a prompt response.
Isn't this a variation of "there is an ancient tradition that we break but shouldn't really"
You already break the rule specified in #451 by NOT passing Ctrl-Shift-C "as they are precisely" (which is great! as it's one step closer to the shortcuts Windows users are familiar with). I mean, "traditionally" terminals aren't able to move cursor with the mouse. Yet you have this (another great!) option.
Why not go one step further? Even in the more detailed #399 I don't see any issue that could arise out of that. What would break if the ^C control sequence was sent via Control-Shift-C instead of Control-C universally? No need to do any application detection or anything. And it can be made an optional toggle anyway (just like the current one), so if someone insists on following the tradition let them.
I can press Ctrl+Shift+c with one hand... What’s so bad about it?
Because it's not standard (as in commonly used), so mistakes are common.
What’s the quote about CUA? No idea what you are referring to.
It's a quote from the ticket I referenced, just to point out that whatever someone thought in the days of CUA might not be relevant today.
About what’s standard, this is a matter of taste here.
Not really, it's a matter of widespread usage. If most ppl in Windows were using Ctrl-Insert then that would be standard (even if a bad one)
While mintty is itself a GUI application
Exactly why you expect it to behave like a GUI app (had the same surprise on a Mac when realized the terminals default to the uncommon behavior of ^C, but gladly it's much easier to change there
text-mode applications which do not share that standard.
Unless you rebind keys to make them share that standard. There is nothing sacred about the way old text-based apps behave, which dictates we should adapt our common habits of the GUI-based world to instead of adapting how those text-based apps behave.
Many of them rather have quite different expectations... For example, text editors may use Ctrl+C either for interrupt as well, or for page down
And let the users who feel it's important to to meet those expectations not enable this option. I don't see why I should care about those expectations rather than make them respect my expectations ;)
For that reason it is not a good idea to map control keys to meta functions by a configurable option, so semi-statically.
and I can't do that because copy&paste is not something the console is aware of, that's why I'd like the terminal to be able to map that
It would be acceptable to use a more dynamic solution, and that actually exists already half-way, see below
Sorry, I didn't understand — would this allow me to have Ctrl-C as copy in e.g. bash console?
You are mixing up things; handling Ctrl+Shift+C in some special way is not breaking anything because that key combination means nothing in a terminal application, so it just adds functionality. Remapping Ctrl+C would modify, or rather remove, existing functionality.
What would break if the ^C control sequence was sent via Control-Shift-C instead of Control-C universally?
A convention much older than Windows would break. You are one of a few people who want to impose modern GUI conventions on a terminal, as compared to a majority of people who want a terminal to be a terminal.
There is nothing sacred about the way old text-based apps behave...
Sure, you can design or change text-based apps as you like (and in fact my own text-mode editor provides modern interaction features) but that can only work if the environment they run in stays compatible. The point is: A terminal is not an "app" that you can redesign at your discretion. It is more comparable to a library or Windows API which cannot simply be changed either.
And let the users who feel it's important to to meet those expectations...
The first priority of a terminal is to meet the expectations of text-based applications; user expectations are important too but secondary.
I understand you try to defend your position but a constructive proposal to achieve an acceptable solution might help more than overwhelming sophistications.
Besides the semantics of new and modified functionalities, what difference does it make in this context? Also, nothing is removed, ^C stays, just remapped. And ONLY for those who want it. I mean there is literally 0 downside. If you don't like it, keep using the non-conventional Ctrl+Shift+C (and that's what this is breaking — the convention of which shortcut should copy and which — paste)
A convention much older than Windows would break
And why is convention based on what a lot of people actually do less important than what few people did way back?
a majority of people who want a terminal to be a terminal.
Leaving aside the "majority" point (how would you even test it if you don't provide an alternative?), who would prevent said majority from not enabling this option?
but that can only work if the environment they run in stays compatible.
Which is like almost all of he common ones? And for those hugely-important-but-yet-unmentioned there is already a fix — don't use the remapping!
A terminal is not an "app"
Except it is — you've already implemented a few features text-based "non-apps" don't do. Which is great. Which also makes the reference "not an app" invalid.
Windows API which cannot simply be changed either
Except that you can easily change the key remapping, so it's nothing like a Win API.
expectations of text-based applications; user expectations are important too but secondary.
Just wow. Who is this mighty application that has a mind and expectations of its own that trump the user?
a constructive proposal to achieve an acceptable solution
How is a simple key remapping request (that's already partially implemented) not constructive??? Especially in light of the fact that the only thing standing against it is some philosophical argument citing a 30-year old specification. And that all the mighty problems with breaking "the sacred standard" can be fixed with a simple checkmark in the settings.
And one more thing on that imaginary ironclad text-based expectations — in all my native terminals (obviously in Windows, but also in OS X AND in Ubuntu (and we should respect the *nix traditions, right?)) I'm able to remap ^C/^V sequence and have Ctrl-C copy and Ctrl-V paste. And on each I've tried like 3-4 terminal apps, most of them allowed such a feature. So here goes your "terminal is not an app, it shouldn't mess with text-based expectations" argument as well as the majority one since Win/Unix/Linux pretty much cover everyone.
Terminator, Konsole, Guake, iTerm, ConEmu, TakeCommander the ones I remember now.
Don't really understand your question re. how they do it — they just pass the ^C sequence when I press Ctrl-Shift-C (or whatever else you want to remap ^C to) and use Ctrl-C for copy. Some (I think Konsole) use the same button, but differentiate between line editing mode and command mode (so when you edit Ctrl-C copies, when you run a command Ctrl-C interrupts).
Besides that I don't know what you mean, despite all the lengthy discussion I haven't seen a good description of a use-case when a simple keyboard remapping and passing remapped keys to a console would be a problem.
But anyway, for this you'd better check out the apps themselves, a lot are open source so with your experience you're much better suited at finding the way all those other apps handle key remapping.
Well, konsole does in fact have a GUI configuration feature to assign shortcuts also to Control keys.
gnome-terminal does not support that.
It turns out that rxvt-unicode and xterm support remapping Control keys via resources.
I will open a fresh issue for a feature suggestion and close this one.
Activity
mintty commentedon Mar 7, 2016
I can press Ctrl+Shift+c with one hand...
What’s so bad about it?
What’s the quote about CUA? No idea what you are referring to.
About what’s standard, this is a matter of taste here. You are referring to a standard for GUI applications. While mintty is itself a GUI application, its purpose is to serve text-mode applications which do not share that standard. Many of them rather have quite different expectations, among which is the availability of the traditional control keys, whether they have a stty-related special function or not (which also many applications temporarily disable, just for the purpose of using those keys directly). For example, text editors may use
Ctrl+Ceither for interrupt as well, or for page down.For that reason it is not a good idea to map control keys to meta functions by a configurable option, so semi-statically. It would be acceptable to use a more dynamic solution, and that actually exists already half-way, see below.
There is Application control key mode which lets you redefine the control keys to escape sequences, and you could further redefine those (or maybe the original control key) in your application if it has that feature. That would not give you access to mintty’s own functions, though. Maybe it could somehow be extended towards the meta-functions.
mintty commentedon Mar 7, 2016
See also my similar responses in #399 and #451.
eugenesvk commentedon Mar 7, 2016
Thank you for a prompt response.
Isn't this a variation of "there is an ancient tradition that we break but shouldn't really"
You already break the rule specified in #451 by NOT passing
Ctrl-Shift-C"as they are precisely" (which is great! as it's one step closer to the shortcuts Windows users are familiar with). I mean, "traditionally" terminals aren't able to move cursor with the mouse. Yet you have this (another great!) option.Why not go one step further? Even in the more detailed #399 I don't see any issue that could arise out of that. What would break if the
^Ccontrol sequence was sent viaControl-Shift-Cinstead ofControl-Cuniversally? No need to do any application detection or anything. And it can be made an optional toggle anyway (just like the current one), so if someone insists on following the tradition let them.eugenesvk commentedon Mar 7, 2016
Because it's not standard (as in commonly used), so mistakes are common.
It's a quote from the ticket I referenced, just to point out that whatever someone thought in the days of CUA might not be relevant today.
Not really, it's a matter of widespread usage. If most ppl in Windows were using
Ctrl-Insertthen that would be standard (even if a bad one)Exactly why you expect it to behave like a GUI app (had the same surprise on a Mac when realized the terminals default to the uncommon behavior of ^C, but gladly it's much easier to change there
Unless you rebind keys to make them share that standard. There is nothing sacred about the way old text-based apps behave, which dictates we should adapt our common habits of the GUI-based world to instead of adapting how those text-based apps behave.
And let the users who feel it's important to to meet those expectations not enable this option. I don't see why I should care about those expectations rather than make them respect my expectations ;)
and I can't do that because copy&paste is not something the console is aware of, that's why I'd like the terminal to be able to map that
Sorry, I didn't understand — would this allow me to have
Ctrl-Cas copy in e.g. bash console?mintty commentedon Mar 7, 2016
You are mixing up things; handling
Ctrl+Shift+Cin some special way is not breaking anything because that key combination means nothing in a terminal application, so it just adds functionality. RemappingCtrl+Cwould modify, or rather remove, existing functionality.A convention much older than Windows would break. You are one of a few people who want to impose modern GUI conventions on a terminal, as compared to a majority of people who want a terminal to be a terminal.
Sure, you can design or change text-based apps as you like (and in fact my own text-mode editor provides modern interaction features) but that can only work if the environment they run in stays compatible. The point is: A terminal is not an "app" that you can redesign at your discretion. It is more comparable to a library or Windows API which cannot simply be changed either.
The first priority of a terminal is to meet the expectations of text-based applications; user expectations are important too but secondary.
I understand you try to defend your position but a constructive proposal to achieve an acceptable solution might help more than overwhelming sophistications.
eugenesvk commentedon Mar 8, 2016
Besides the semantics of new and modified functionalities, what difference does it make in this context? Also, nothing is removed, ^C stays, just remapped. And ONLY for those who want it. I mean there is literally 0 downside. If you don't like it, keep using the non-conventional
Ctrl+Shift+C(and that's what this is breaking — the convention of which shortcut should copy and which — paste)And why is convention based on what a lot of people actually do less important than what few people did way back?
Leaving aside the "majority" point (how would you even test it if you don't provide an alternative?), who would prevent said majority from not enabling this option?
Which is like almost all of he common ones? And for those hugely-important-but-yet-unmentioned there is already a fix — don't use the remapping!
Except it is — you've already implemented a few features text-based "non-apps" don't do. Which is great. Which also makes the reference "not an app" invalid.
Except that you can easily change the key remapping, so it's nothing like a Win API.
Just wow. Who is this mighty application that has a mind and expectations of its own that trump the user?
How is a simple key remapping request (that's already partially implemented) not constructive??? Especially in light of the fact that the only thing standing against it is some philosophical argument citing a 30-year old specification. And that all the mighty problems with breaking "the sacred standard" can be fixed with a simple checkmark in the settings.
eugenesvk commentedon Mar 8, 2016
And one more thing on that imaginary ironclad text-based expectations — in all my native terminals (obviously in Windows, but also in OS X AND in Ubuntu (and we should respect the *nix traditions, right?)) I'm able to remap ^C/^V sequence and have Ctrl-C copy and Ctrl-V paste. And on each I've tried like 3-4 terminal apps, most of them allowed such a feature. So here goes your "terminal is not an app, it shouldn't mess with text-based expectations" argument as well as the majority one since Win/Unix/Linux pretty much cover everyone.
mintty commentedon Mar 8, 2016
OK, the latter may be a point. Please provide a list of which terminals (not on which systems) provide such a feature and how they do it.
eugenesvk commentedon Mar 8, 2016
Terminator, Konsole, Guake, iTerm, ConEmu, TakeCommander the ones I remember now.
Don't really understand your question re. how they do it — they just pass the ^C sequence when I press Ctrl-Shift-C (or whatever else you want to remap ^C to) and use Ctrl-C for copy. Some (I think Konsole) use the same button, but differentiate between line editing mode and command mode (so when you edit Ctrl-C copies, when you run a command Ctrl-C interrupts).
Besides that I don't know what you mean, despite all the lengthy discussion I haven't seen a good description of a use-case when a simple keyboard remapping and passing remapped keys to a console would be a problem.
But anyway, for this you'd better check out the apps themselves, a lot are open source so with your experience you're much better suited at finding the way all those other apps handle key remapping.
mintty commentedon Mar 8, 2016
Well, konsole does in fact have a GUI configuration feature to assign shortcuts also to Control keys.
gnome-terminal does not support that.
It turns out that rxvt-unicode and xterm support remapping Control keys via resources.
I will open a fresh issue for a feature suggestion and close this one.
user-defined keypad keys (#705, #602, #645, #399, #252, ~#726, ~#524, ~…
user-defined shortcuts and function keys (mintty#705, mintty#602, min…
user-defined special keys (mintty#705, mintty#602, mintty#645, mintty…
mintty commentedon Sep 20, 2018
Released 2.9.1.
allow user-defined mappings for Ctrl/Alt/Super/Hyper-modified charact…
mintty commentedon Mar 25, 2022
Released 3.6.0.