Indentation cleanup, added smart_brackets and smart_insertions, and more #284
Conversation
…ved begin/end_user_action from control-up/down
And the indentation is improved as well. For instance it should now correctly indent: some_function(true, 42,
[] {//enter here , that will lead to: some_function(true, 42,
[] {
//cursor here
} |
Is the indent here as intended? Looks strange to me. Other than that the PR looks good to me. |
@d3rrial Thank you, that is definitely a bug. I'll fix it Tomorrow. |
57984df
to
92f93c9
Compare
I fixed the bug @d3rrial mentioned. Also improved indentation when writing constructor implementations on multiple lines. Let me know if there are other issues:) |
See also the last commit. You can now avoid using arrow keys when for instance writing: auto c=std::make_shared<int>(10); |
bool find_open_curly_bracket_backward(Gtk::TextIter iter, Gtk::TextIter &found_iter); | ||
bool find_close_curly_bracket_forward(Gtk::TextIter iter, Gtk::TextIter &found_iter); | ||
long open_close_paranthesis_count(Gtk::TextIter iter); | ||
long open_close_bracket_count(Gtk::TextIter iter, unsigned int left_bracket, unsigned int right_bracket); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsigned int
? Are you sure? Wouldn't that mean the '('
has to be cast from char? Or does Clang handle single quoted symbols differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*iter
returns unsigned int
since it is a UTF-8 character. So I do the cast automatically in the function parameters. At least the tests passed:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it wasn't an error, at most I would have expected the compiler to throw a warning. As long as it works, it's all good :)
when I type auto
where my cursor sits in the angled bracketes with |
In the case of |
This doesn't work for me. Could it be because of different keyboard layouts / keyval differences? |
Yeah, tested on Linux. Have to find the right key that works (GDK_KEY_greater works on OS X). |
I just tested and |
The problem is searching for |
Well, auto a=crazytemplate<std::string, void*, int,
double, size_t>(...); This has to remain valid, tho... Edit: Are typeof() functions used in templating? Because if they are, then this is probably a moot point. |
689e330
to
51d4134
Compare
…ion arguments of autocompleted templated functions. Also selects the text in the function arguments after pressing '('.
Looks good to me, even works with nested templates. Haven't done any edge-case tests for false positives yet, but I haven't had any false negatives. 👍 |
51d4134
to
ab2f699
Compare
Thank you, good to hear. At least there is some progress:) |
I made the rules for the movements very strict so that they will not happen unless you want them to, hopefully. |
While I personally love this feature / these movements and will/would use them all the time, for some people this might be an inconvenience (I can't fathom how, because they behave just like regular, solid brackets in any case other than when you type in a bracket which is already there) so I think it might be best if this was put into a setting in the config file. |
I'm thinking that too. I'll use it myself, but we should maybe have it disabled by default. What do you think @zalox ? |
See #281 (comment). I see no reason to not enable these features by default. It would effectively improve the coding experience for new users. People like me, that don't like magic features, know how to disable them and keep quiet as long as there is an option to do so. |
So what should we call this bracket feature in the preferences? |
Not completely sure about the preference item name |
564c868
to
55650ac
Compare
Fixed the spellcheck issue on undo/redo/pasting. |
fff7bfc
to
3b8ec87
Compare
3b8ec87
to
780fe03
Compare
Shouldn't the |
I tried doing smart insertion of {}, but found that too often that was not what I wanted. Additionally, we already have smart indentation and insertion of } after pressing enter after {, and this leads to far less false positives. |
@zalox This PR should be getting ready for merge. I added some more improvements that should be pretty safe. The biggest change is the indentation cleanup, and that seems to work fine. |
…ing deprecated nodes in preferences
e77fc26
to
5d4fd20
Compare
5d4fd20
to
43eaad0
Compare
@zalox this PR should now be ready for merge!:) |
I'll merge this now as this PR is stable and contains numerous improvements. |
@d3rrial, @zalox and others: I need testing of this PR before merge: