Author Topic: Open file from command line BUG FIX PATCH  (Read 6882 times)

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Open file from command line BUG FIX PATCH
« on: May 24, 2012, 04:10:57 pm »
Hi All,

I've found a bug when opening a file and jumping to a line from command line. It occurs if the file is already open in C::B, but it's not the last file opened, so steps to reproduce it:

1- open C::B ;-)
2- open file A
3- open file B
4- run codeblocks.exe --file=file_A:20
5- file A has the focus, but the cursor of file B is at line 20 and not the one of file A

The bug is straightforward to see and it's corrected in the patch attached.

This patch also maximize the C::B window in case it's minimized, before raising it. (related to http://forums.codeblocks.org/index.php/topic,14517.0.html)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Open file from command line BUG FIX PATCH
« Reply #1 on: May 24, 2012, 07:43:59 pm »
The bug is confirmed, on linux, too...I'll test the patch in a minute

p.s. The general rule is to not mix unrelated changes in a single patch, thus it minimizes the work the people testing the patch have to do...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: Open file from command line BUG FIX PATCH
« Reply #2 on: May 24, 2012, 07:47:51 pm »
p.s. The general rule is to not mix unrelated changes in a single patch, thus it minimizes the work the people testing the patch have to do...
Sorry about that... :-)

I was so excited that I solved both "problems" that I wanted to share it asap...

Should I break the patch into two?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Open file from command line BUG FIX PATCH
« Reply #3 on: May 24, 2012, 08:01:38 pm »
No, I doubt that forcing the maximizing is the right thing to do, but you should provide a patch there, where the context is correct.

I'll commit your --file patch in a minute... Done...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Open file from command line BUG FIX PATCH
« Reply #4 on: May 24, 2012, 08:24:22 pm »
Btw: Instead of IsMaximized() you should check for !IsIconised() and issue a Show() then... IMHO that's the better option. Notice the Iconised, not Iconized... ;-)

But what was actually the bug here?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Open file from command line BUG FIX PATCH
« Reply #5 on: May 24, 2012, 08:36:21 pm »
Morten: See the link in the first post :) and post any comments there as this will make it less random and easier if someone searches for this problem...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Open file from command line BUG FIX PATCH
« Reply #6 on: May 24, 2012, 09:48:53 pm »
Morten: See the link in the first post :) and post any comments there as this will make it less random and easier if someone searches for this problem...
Oops - I missed that link. I thought its related to the primary issue. ::)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: Open file from command line BUG FIX PATCH
« Reply #7 on: May 25, 2012, 09:15:34 am »
No, I doubt that forcing the maximizing is the right thing to do, but you should provide a patch there, where the context is correct.

Continuing the discussion on the original thread, then, as suggested....  ;D