Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: daniloz on May 24, 2012, 04:10:57 pm

Title: Open file from command line BUG FIX PATCH
Post by: daniloz 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 (http://forums.codeblocks.org/index.php/topic,14517.0.html))
Title: Re: Open file from command line BUG FIX PATCH
Post by: oBFusCATed 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...
Title: Re: Open file from command line BUG FIX PATCH
Post by: daniloz 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?
Title: Re: Open file from command line BUG FIX PATCH
Post by: oBFusCATed 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...
Title: Re: Open file from command line BUG FIX PATCH
Post by: MortenMacFly 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?
Title: Re: Open file from command line BUG FIX PATCH
Post by: oBFusCATed 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...
Title: Re: Open file from command line BUG FIX PATCH
Post by: MortenMacFly 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. ::)
Title: Re: Open file from command line BUG FIX PATCH
Post by: daniloz 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