Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: fubo on February 13, 2013, 06:15:01 pm

Title: Column editing in C::B 12.11
Post by: fubo on February 13, 2013, 06:15:01 pm
Hi all,
I noticed that column editing in C::B 12.11 is totally broken, am I right?
Thanks.
Title: Re: Column editing in C::B 12.11
Post by: oBFusCATed on February 13, 2013, 06:31:03 pm
Explanation? Example?
Title: Re: Column editing in C::B 12.11
Post by: fubo on February 13, 2013, 06:35:13 pm
Example1: pressing ALT and drawing a vertical line, I want to write an all lines. It writes only on latest.
Example2: pressing ALT and drawing a vertical line, pressing TAB should indent the text to the right. Now it makes a lot of mess deleting pieces of text.
Title: Re: Column editing in C::B 12.11
Post by: Jenna on February 13, 2013, 06:59:31 pm
The first works if you set the options in "Settings -> Editor -> Margins and caret -> Selections" correctly.
The second does not work and might be a bug or a scintilla limitation ( I will see if I find the time to look into it deeper).
Title: Re: Column editing in C::B 12.11
Post by: fubo on February 13, 2013, 07:03:42 pm
Thanks, example 1 is now working.
Title: Re: Column editing in C::B 12.11
Post by: oBFusCATed on February 13, 2013, 08:43:32 pm
The second does not work and might be a bug or a scintilla limitation ( I will see if I find the time to look into it deeper).
It works in scite and I think our smart indenter messes things.
Title: Re: Column editing in C::B 12.11
Post by: Jenna on February 13, 2013, 09:23:08 pm
The second does not work and might be a bug or a scintilla limitation ( I will see if I find the time to look into it deeper).
It works in scite and I think our smart indenter messes things.
If all smartindent-plugins are switched off it still does not work.
But it works as expected, if I select several lines with Ctrl-key pressed.
So it might be an issue with rectangle-selection (with width 0 in this special case).
Title: Re: Column editing in C::B 12.11
Post by: oBFusCATed on February 13, 2013, 09:54:30 pm
If all smartindent-plugins are switched off it still does not work.
For me it works if I compile cb with cb, no contrib plugins. Gentoo linux, latest head.
Title: Re: Column editing in C::B 12.11
Post by: Jenna on February 14, 2013, 06:14:05 am
If all smartindent-plugins are switched off it still does not work.
For me it works if I compile cb with cb, no contrib plugins. Gentoo linux, latest head.
Good catch, I found the "evil" plugin, it's the spellchecker.

Thanks, example 1 is now working.
If you either disable the spellchecker-plugin completetely via "Plugins -> Manage plugins" or at least disable online spellchecking from "Settings -> Editor -> SpellChecker" the second example should work also.

Title: Re: Column editing in C::B 12.11
Post by: oBFusCATed on February 14, 2013, 08:15:50 am

Good catch, I found the "evil" plugin, it's the spellchecker.
Strange...
Title: Re: Column editing in C::B 12.11
Post by: fubo on February 14, 2013, 01:01:33 pm
If you either disable the spellchecker-plugin completetely via "Plugins -> Manage plugins" or at least disable online spellchecking from "Settings -> Editor -> SpellChecker" the second example should work also.
Thanks! I confirm it on Win7 x64. Now it works!
Title: Re: Column editing in C::B 12.11
Post by: danselmi on February 14, 2013, 06:20:37 pm
Good catch, I found the "evil" plugin, it's the spellchecker.
I will look into it
Title: Re: Column editing in C::B 12.11
Post by: danselmi on February 15, 2013, 11:34:27 am
I still don't know what the problem is:

Code
void OnlineSpellChecker::DoSetIndications(cbEditor* ctrl)const // called OnUpdate
...
    if(stc->SelectionIsRectangle() || (stcr && stcr->SelectionIsRectangle())) return; // workaround so Example2 is working
    stc->IndicatorSetStyle(GetIndicator(), wxSCI_INDIC_SQUIGGLE);
    // when we return here, after IndicatorSetStyle() the Example 2 is not working
...

Any ideas?

Title: Re: Column editing in C::B 12.11
Post by: Jenna on February 15, 2013, 02:11:32 pm
I still don't know what the problem is:

Code
void OnlineSpellChecker::DoSetIndications(cbEditor* ctrl)const // called OnUpdate
...
    if(stc->SelectionIsRectangle() || (stcr && stcr->SelectionIsRectangle())) return; // workaround so Example2 is working
    stc->IndicatorSetStyle(GetIndicator(), wxSCI_INDIC_SQUIGGLE);
    // when we return here, after IndicatorSetStyle() the Example 2 is not working
...

Any ideas?


I see if I find the time to look into it this weekend.
Title: Re: Column editing in C::B 12.11
Post by: Jenna on February 15, 2013, 10:56:36 pm
Please test the attached patch and give feedback.

It uses the already existing oldCtrl to ensure the calls to IndicatorSetStyle(), IndicatorSetForeground() and IndicatorSetUnder() are done only once for each control and not every time DoSetIndications() is called.

Ths will work unless another part of C::B will use (amd modify) the same indicator, what (most likely) works with the existing code, but would probably lead to other issues.
Title: Re: Column editing in C::B 12.11
Post by: danselmi on February 20, 2013, 05:51:17 pm
I have tested your patch. It is working.

For me, it looks like another workaround not a solution?
Title: Re: Column editing in C::B 12.11
Post by: Jenna on February 21, 2013, 09:41:36 am
Yes and no.

It works around the issue, but it still does the styling for the file (not just a return) so it's also a (hopefully) correct solution.
Title: Re: Column editing in C::B 12.11
Post by: danselmi on February 25, 2013, 02:29:52 pm
So please commit it. (Or I will do it.)

And thank a lot Jens!
Title: Re: Column editing in C::B 12.11
Post by: Jenna on February 26, 2013, 06:05:27 am
So please commit it. (Or I will do it.)

And thank s lot Jens!
Committed in svn r8857 .