Блог пользователя diego_v1

Автор diego_v1, 10 лет назад, По-английски

I recently installed Linux with the latest version of Code::Blocks, and the way it auto formats and indents the code is HORRIBLE. I can't possibly code efficiently with an IDE like that. It worked perfectly under Windows, but its behaviour under Linux is disastrous. I tried tweaking all the options of the editor, and none of them fixes the issue.

The issue is like this...

Let's suppose I type if(k==0), press Enter, and then press the open brace key. Under Windows, it would auto format itself to this...

if(k==0)
{
    |
}

NOTE: character '|' marks the position of the cursor.

But under Linux, it auto formats into this useless thing...

if(k==0)
{|}

Which means I need to press Enter, then Up, then Right, then Enter, and finally Tab to format it correctly...

if(k==0)
{
    |
}

Basically, I have to press FIVE freaking keys after opening the braces to format the code correctly, whereas under Windows, I had to press NONE. And that's a lot of wasted time if you're in a contest.

If anyone knows how to correct Code::Blocks behaviour under Linux, please let me know. I'll greatly appreciate it.

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

»
10 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Looks like the Gnome of Downvoting is back to mischief...

»
10 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

i suggest u use Sublime Text editor instead of Code::Blocks. its formatting, indentation, and text auto-completion tools are very good, and it works very well on all (Windows, Linux, and Mac) platforms.
however, AFAIK it does not have options to compile/run ur code. but since u are working on Linux, u can always use the Terminal for this.

  • »
    »
    10 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I'm looking for an IDE that compiles the code and runs it. I always do little modifications and debug my code with print routines, so it's very slow if I compile and run from the terminal.

    Thanks for the info anyway :)

    • »
      »
      »
      9 лет назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      Sublime text has build systems so you only need to ctrl-b when you want to compile, and the ./myexec on the nearby console window (usually you don't need even that, just press up and enter). I personally find compiling and running faster on sublime than on codeblocks, because you don't need to use mouse.

    • »
      »
      »
      9 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      And Geany? Geany compiles and run. :)

  • »
    »
    10 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    however, AFAIK it does not have options to compile/run ur code

    it does: select tools Tools -> Build or just press F7.

    http://docs.sublimetext.info/en/latest/reference/build_systems.html

»
10 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Have you installed codeblocks-contrib package along with others? It's a contrib plugins package, and as far as I know, some indentation plugins are also put there.

  • »
    »
    10 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I haven't installed any plugins yet. I'll give it a try to that one you named and see if it helps. Thanks for the info.

    • »
      »
      »
      10 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      You see, indentation options that you may find in codeblocks settings like Smart Indent are in fact plugins themselves, and somewhen somewhere in my experience they wouldn't work without said package. However, I don't know whether this problem stays in current vertion of CB.

      • »
        »
        »
        »
        10 лет назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        I installed the contrib plugins, and that magically solved the indentation problem! I didn't have to do anything!

        Thanks a bunch!

  • »
    »
    9 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Faced the same problem. Solved in a flash. Thanks a lot.