12

We can insert inline code blocks in comment using ` character (and it's pretty common to insert small snippets in comments).

The problem is that ` is not present on most of non US (non UK) keyboards!!! What we have to do is copy & paste from somewhere else or to use ALT. Result? Most of comments from non US non UK writers don't use it.

What I suggest is to add a simple (terribly simple) icon with a dropdown to quickly insert useful snippets (like Visual Studio does in the search text dialog for regular expressions).

  • @RichardTingle I know, UK and US keyboards have that characters but many keyboards have not (for example my Italian keyboard...) – Adriano Repetti Nov 15 '13 at 11:59
  • @Adriano Applogies, I read your question the wrong way round. Not entirely sure why. Possibly the 2 negatives in the same sentence confused me even though they are not of the 2 negatives make a positive type – Richard Tingle Nov 15 '13 at 12:00
  • @Qantas94Heavy yes but it's a pity to add a button just for one function... :) – Adriano Repetti Nov 15 '13 at 12:00
  • You hate to go overboard on the formatting help for comments, but this one seems legit since it isn't a universal key on all keyboard layouts. – psubsee2003 Nov 15 '13 at 12:18
  • 1
    @psubsee2003 yes you can take it from help, with ALT+code or writing comment is answer box then paste it as comment (discarding draft answer) but it's TOO time consuming for just comment. It's impossible to change it now to something more universal but at least a shortcut would be very helpful. – Adriano Repetti Nov 15 '13 at 12:44
  • @Adriano I don't think changing it would be on the table anyway as I believe it is part of Markdown and the team has shown reluctance in the past to modify their implementation of Markdown. So some sort of shortcut would seem to be in order. I'm actually shocked this has never come up before. – psubsee2003 Nov 15 '13 at 12:52
  • Related: Alternative to backtick escapes for non-US keyboard? Though this request suggests a specific solution. – Bart Nov 15 '13 at 12:54
  • @Bart nice catch! Unfortunately I'm Italian so that solution doesn't work for me anyway the point is why it has to be so complicated??? As suggested even a shortcut may be helpful... – Adriano Repetti Nov 15 '13 at 13:28
  • BTW an out of the box question: today is my first time with the new look & feel for meta...well...does the top bar participate at the competion "are you able to do something less readable than VS2k12 icons?". Light gray on black??? Give me back the old color set with text only buttons!!! – Adriano Repetti Nov 15 '13 at 13:30
  • 1
    @psubsee2003 well Bart found a 3 years old question with same topic, good catch. Unfortunately nothing has been done... – Adriano Repetti Nov 15 '13 at 13:33
-1

I would’t really like a formatting button for comments; it would also be hard to draw the line there: Why just for code formatting? Why not for bold, italic? Instead I’m going to suggest a different solution for you:

Your own personal keyboard layout

If you are on Windows, you can use the Microsoft Keyboard Layout Creator (MKLC) to create your own custom keyboard layout.

Once you have installed MKLC, start it and choose “File / Load Existing Keyboard…”. A window appears with a list of all the built-in keyboard layouts. Choose the one you want to build upon, i.e. most likely your Italian keyboard layout. The layout should then appear on the displayed keyboard.

Next, you will have to find a key combination you want to use for the new character. On the left, you can choose different shift states to switch the keyboard layout. Usually, the “Alt+Gr” keyboard layout is rather empty, so you can use that shift state if you don t want to lose any character. Or you could overwrite a different key you never use.

Once you have decided where to place the character, just click on the key and enter the symbol in the opened window. Do this for every key you want to change.

Once you are done you can test the keyboard layout using “Project / Test Keyboard Layout…”. Once everything is alright, make sure to change the settings in “Project / Properties…”. You will need to set a unique name and description here; the description is what is being displayed later in Windows.

Next you will have to build the keyboard layout. Choose “Project / Build DLL and Setup Package”. This will create a installer package in your documents folder. Launch the setup.exe to install your keyboard layout. After installing it, it’s a good idea to restart your computer. It might work without, but didn’t for me. Make sure you don’t accidentally install the keyboard layout multiple times. That happened to me and it was difficult removing the first one; if you want to adjust your keyboard layout, it’s better to uninstall first and then install the new one.

Anyway, once you have installed the keyboard layout (and rebooted) it should already be available in the keyboard/language selector of Windows (otherwise add it in the language controls). Switch to it, and enjoy your new keyboard layout with support for new symbols!

As for other operating systems, I’m just going to refer to these two questions:

Why a custom keyboard layout is superior

Let me give you some reasons, why I believe that a custom keyboard layout is far more superior than a button:

  • Markdown: These days, Markdown is easily the most used formatting markup language on the internet. Every other website uses it or one of its derivates. It even starts to appear on some desktop applications. Despite it not being a standardized language, it’s pretty much the standard for easily readable markup today. And as much as you might hate it, the backtick is a standard character for displaying inline code.

    So even if you get StackExchange to add a button there, not every other website you might use in the future will do that. Yes, some editing forms may have a button for it (like here in the question/answer editor); but others simply won’t.

    By having an actual key on the keyboard to produce the symbol, you just avoid any problems you might run into then. Instead of requiring everyone to add a button, you can just use your key.

  • Other uses: Even outside of Markdown, the backtick is used for quite a few things. It has a special meaning in some programming languages like Perl, Ruby, or PHP to execute shell commands. In Haskell it’s a character used to use functions as binary operators. In PowerShell it’s the escape character. Some SQL dialects use it to escape table and column names.

    None of these things will offer you a button to enter the backtick, but will instead require you to type it on your keyboard.

  • Typing flow: I don’t know how you are typing, but when I’m typing, both of my hands are on the keyboard. Having to stop in between to move one hand to the mouse to click a button that inserts a character would be terrible. It disrupts the flow and I couldn’t just keep typing. Maintaining a flow without having to move your hands while typing is very important; that’s why some editors like vim allow you to move the cursor using the keys hjkl so you don’t have to reposition your hands on the arrow keys first and the move back. It sounds ridiculous, but it makes a great difference.

  • Occasion: When you are modifying your keyboard layout, it’s the best occasion to do some further improvements for it. There are always these minor things that you might miss on your keyboards. For example I’m quite addicted with typography, and I want to use typographically correct symbols when writing. Most if not all keyboards do not come with proper apostrophes or quotation marks; so when I modified my keyboard layout, I changed it so that I can simply type those.

  • Easiest solution: In all honesty, changing your keyboard layout would be the easiest solution for everyone. It might require some effort for you to create and install the keyboard layout, but that will take at most 10 minutes of your time. It’s really simple to do it and once you have it, you don’t need to do it again forever. You can just keep on using the layout and use the keys where you placed them. There is no need for others to think of a good solution to include a button next to a textfield when there is actually no real room for it and when ~95% of the users will never need to use the button anyway.

    And as you mentioned in a comment above: “Bart found a 3 years old question with same topic, good catch. Unfortunately nothing has been done”. So three years later, nothing has been done, and it’s rather unlikely that such a button will just appear right now. But having your own key on your keyboard will just instantly fix this.

  • 2
    -1. I'm completely with @Adriano on this one, that is way too much work for a user to have to do in order to make a site accessible to an international community. – MikeTheLiar Nov 15 '13 at 15:33
  • “Way too much work”? This takes approximately 10 minutes of your time, which is way less than you spent waiting for responses already. I have edited my answer on why I think this is a way superior solution for your personal problem. — “I use my keyboard 99.999% for something else” I don’t think 0.0001% justifies adding a button for just a single rather arbitrary part of the formatting which a very major part of the community will never have to use. – poke Nov 15 '13 at 16:34
  • @Adriano I don’t really understand why you are responding to a honest suggestion to fix this problem for yourself with that much hostility. It’s not really encouraging to try to help you any further. – poke Nov 15 '13 at 16:38
  • 1
    @poke oh, I'm sorry if I did sound so hostile!!! I'm not native speaker and I can't really feel tone of sentences. I just wanted to say if you'd adopt that solution just to use inline code blocks in SO comments. I wouldn't switch my keyboard layout (remap keys I use everyday for something else) just for this task. An international site should be aware (and handle) culture specific issues instead of its users. – Adriano Repetti Nov 15 '13 at 17:11
  • BTW it's not my personal problem but a problem for all international users that does not have a backtip on their keyboard (on a site with international audience). About other uses for it...I may not be interested on execute shell commands, for example, in that way. Even C { braces can be escaped... – Adriano Repetti Nov 15 '13 at 17:29
  • 2
    Let me do an example. You sell gloves for car drivers. They're made to improve grip on shift lever. We both drive on the left so we need a right glove. What do you suggest to English drivers? To learn to drive on the left or to learn how to change using right hand because it may be useful, in case they'll live in another country, or for some other benefit? One more. You expect to insert numbers and dates in any decent application using your own format, right? Even if you're used to type "." to enter decimals when you program. It's the same... – Adriano Repetti Nov 15 '13 at 17:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .