-1

This has constantly come under my notice that newbies, who copy paste their code (let's assume it is well indented, for when the indentation is wrong, some nice guy comes along and indents it properly in the post or asks the OP to do that) and have just learnt the use of lang-<language> tend to write the code the following way:

    int main() {
        std::cout << "OP has got nothing better to do";
        return 0;
    }

look closely at the extra tab at the start of the line

when in reality, it should have either been (umm... you might need to click on edit button to view the 2 different styles raw)
with code-block:

int main() {
    std::cout << "OP has got nothing better to do"
    return 0;
}

or
with tab:

int main() {
    std::cout << "OP has got nothing better to do";
    return 0;
}

I suggest we keep only one feature or at least when parsing the language when using code-blocks (```), remove one extra tab at the start of every line in the "edit mode" itself. Again, the assumption being that the code is well indented.

0

1 Answer 1

4

You can do this yourself easily by selecting the over-indented code and then clicking the {} button on the edit bar. This will move the code one tab to the left, but also insert an extra newline. Delete the inserted newline, and now it is done.

2
  • That is what I am currently doing, but I wanted to know if we can eliminate the human element from that task and automate it entirely. I mean, it's the OP's job, not mine Apr 12, 2021 at 5:38
  • 1
    Ctrl-K, as the keyboard shortcut for code formatting in the editor, will do the same thing (Still not an automated solution, but a minor time save I suppose).
    – zcoop98
    Apr 12, 2021 at 16:44

You must log in to answer this question.

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