The "0" is too risky, as I constantly risk sending 30 merits to a random post from my mobile (80% of my posting here on the forum).
I know. I know. That "0" is a flippin' hazard, IMO.

I have a patch that removes the "0", and also adds mouse wheel support:
(*) I saw a post by vapourminer (
here) saying that it would be nice if he could sometimes stay in mouse-mode for longer, and that
needing the keyboard to send merit is kind of a bummer. I don't like the suggestion that he (and others) made about pre-populating the input with a 1 instead of a 0, because that will, I think, skew the statistics towards single-merit-sends. So, what I did was make it so that you can now use the mouse wheel (on that input) to raise or lower the amount (clamped between 1 and 50). It actually works really well, and because of the clamping, an initial wheel event in either direction (up or down) sets the value to 1 (and from that point, wheel
up makes the value increase, and wheel
down makes it decrease).
But, it's written in a new/different way compared to my other patches, and I'm still trying to figure out with theymos if he'll let me work in this new way.
(Concerning your specific suggestion of user-settable default values: I've got some ideas for that, but I'd first like to see the above-mentioned patch get accepted before pursuing more elaborate merit-sending tweaks.)
I don't know if this is considered a minor problem that can be easily solved, but I find the lack of this function I describe below quite inconvenient. (...)
Yup, I know what you mean.

While it won't address your suggestion exactly as you've stated it, I am working on something that I think will help you with the problem you've described:
(In an upcoming patch, I'm considering making those face-containing icons clickable: The idea would be that when you click on it, it would open the topic, but with just your posts visible, so that you can easily see the things you've already said in that topic. Seems like an odd feature on its own, but, it's part of a bigger patch to allow quickly seeing only the posts within a topic by a specific author.)
Hi @PowerGlove.
Hi.

I don't know if this has been suggested before, but I will go ahead and do it. If it's a repeated request/suggestion, it should be ignored.
It's probably been suggested before, if not in this thread then in some other Meta topic. (I don't mind repeated suggestions; if I notice that something has been suggested over and over, then I just think more and more about some way to implement it.)
It's nothing major, but I think this can bring some convenience for writing posts. So, I suggest that there should be keyboard shortcuts for some of the writing patterns or styling elements, such as Bold, Italic, Underscore, etc.
I could see something like that being useful. (I write my posts in Sublime Text, so it wouldn't be very useful to me personally, but, I've noticed that I usually need to make changes to my posts after I've previewed them, and when doing that I tend to use the forum's BBCode editor.)
For example, if I'm writing a post, and I have a line or maybe a word that I want to have in bold letters, I would select it, and press CTRL+B and it should add an opening and closing tag for the bold element on both sides of the text selected. The same can be done for other styling elements as well. We can also do it for the alignment elements as well.
Hmm... I don't think I like the idea of overriding the browser's built-in keyboard shortcuts (for example, in Firefox, Ctrl+B normally toggles the bookmarks sidebar).
But, your suggestion does give me an idea: If you think about it, you could make single-key shortcuts work if they were only "in effect" while something was selected. That is, normally
b just means "b", but you could make it mean something else in the context of a selection. As in, you would select some text and then just hit
b to make it bold (and if the selection were preserved, you could then even hit it a second time to make it
unbold).
It's tough to explain what I mean, so lemme do my warm-up stretches real quick (
who farted?), crack my knuckles (not really), and then try to write some example code...
2 cappuccinos later:
(function () {
const allShortcuts = [
{ key: 'b', open: '[b]', close: '[/b]' },
{ key: 'i', open: '[i]', close: '[/i]' },
{ key: 'u', open: '[u]', close: '[/u]' },
{ key: 's', open: '[s]', close: '[/s]' },
{ key: 't', open: '[tt]', close: '[/tt]' },
{ key: 'q', open: '[quote]', close: '[/quote]' },
{ key: 'c', open: '['+'code]', close: '[/'+'code]' },
{ key: 'g', open: '[color=gray]', close: '[/color]' },
{ key: 'y', open: '[glow=yellow,2]', close: '[/glow]' },
{ key: '[', open: '[left]', close: '[/left]' },
{ key: ']', open: '[right]', close: '[/right]' },
{ key: '\\', open: '[center]', close: '[/center]' },
];
const allEditors = document.querySelectorAll('textarea.editor');
for (const editor of allEditors) {
editor.onkeydown = (keyEvent) => {
const normalKeyPress = !keyEvent.altKey && !keyEvent.ctrlKey && !keyEvent.metaKey;
if (editor.selectionEnd > editor.selectionStart && normalKeyPress) {
for (const shortcut of allShortcuts) {
if (keyEvent.key.toLowerCase() == shortcut.key) {
keyEvent.preventDefault();
while (/\s/.test(editor.value[editor.selectionStart]) && editor.selectionEnd > editor.selectionStart) {
editor.selectionStart += 1;
}
while (/\s/.test(editor.value[editor.selectionEnd - 1]) && editor.selectionEnd > editor.selectionStart) {
editor.selectionEnd -= 1;
}
if (editor.selectionEnd > editor.selectionStart) {
const selectedText = editor.value.substring(editor.selectionStart, editor.selectionEnd);
if (selectedText.startsWith(shortcut.open) && selectedText.endsWith(shortcut.close)) {
editor.setRangeText(selectedText.substring(shortcut.open.length, selectedText.length - shortcut.close.length));
} else {
editor.setRangeText(shortcut.open + selectedText + shortcut.close);
}
}
}
}
}
};
}
})();
You can try this by going to any Bitcointalk page that contains a BBCode editor, and then opening up the developer tools in your browser (Ctrl+Shift+I for me) and pasting the above code into the "Console" and then hitting Enter (probably it'll bug you to type in a confirmation phrase like "allow pasting" before permitting you to do so). That should then give you (temporarily; just for that tab) the following selection-shortcuts:
b for bold,
i for italicize,
u for underline,
s for strikethough,
t for teletype,
q for quote,
c for code,
g for gray (lowlight; Loyce knows what I mean), and
y for yellow (highlight). Also
[,
], and
\ for left-align, right-align, and center-align, respectively.
I've got to say, it feels quite natural to me. With a mouse it feels natural for me to just double-click on a word and then hit
b to make it bold, for example. And for people like Loyce who say that they prefer not to involve the mouse too much while writing posts, it's still quite pleasant to make selections with the keyboard (either character-by-character with Shift+Right/Shift+Left, or chunk-by-chunk with Ctrl+Shift+Right/Ctrl+Shift+Left, or by selecting stretches with Shift+End/Shift+Home). Also, even though it wasn't what I set out to do, I suspect that this might all work out pretty nicely on mobile, too.
Actually, a script for BBcode would be nice, as I don't have 100% use of my left hand.
Let me know how you find the single-key-shortcuts idea from above.