News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Open file from command line BUG FIX PATCH

Started by daniloz, May 24, 2012, 04:10:57 PM

Previous topic - Next topic

daniloz

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.next.codeblocks.org/index.php/topic,14517.0.html)

oBFusCATed

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!]

daniloz

Quote from: oBFusCATed on May 24, 2012, 07:43:59 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?

oBFusCATed

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!]

MortenMacFly

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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

oBFusCATed

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!]

MortenMacFly

Quote from: 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...
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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

daniloz

Quote from: 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.

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