GNOME Bugzilla – Bug 637695
allow comment/uncomment with gtksourceview editor
Last modified: 2011-01-07 22:37:40 UTC
With the gtksourceview editor there is no function for commenting/uncommenting available. A suggestion about default shortcut: strg+m for commenting and shift+strg+m for uncommenting because those are the ones used in the gedit "code comment" plugin
Created a CodeIn task for it, maybe someone picks it up: http://socghop.appspot.com/gci/task/show/google/gci2010/gnome/t129312363432
Created attachment 177657 [details] [review] Comment/Uncomment function for anjuta's language-support-cpp-java plugin I have implemented this feature in the course of the related GCI task.
Review of attachment 177657 [details] [review]: From the implementation that looks very good and clean. I have to test that later to day to be sure. Thanks a lot. Just a note: Please add a link to this to the CodeIn task (submitted work...) because otherwise I cannot close the task.
Review of attachment 177657 [details] [review]: OK, this works quite fine, two smaller issues: * When something was commented like this /* some comment */ then the indentation is lost (or at least one tab is lost) when uncommenting it. Maybe you need to move one iterator for the erase by one, it's a bit tricky because the point between characters. * In a C++ file, hitting uncomment on a /* */ comments it additionally with // instead of removing the comment. ::: plugins/language-support-cpp-java/plugin.c @@ +1450,3 @@ + (g_str_equal (plugin->current_language, "C"))) + { + if (g_str_has_prefix (text_stripped, "/*") && These should be surrounded by ianjuta_document_begin_undo_action() and ianjuta_document_end_undo_action() @@ +1515,3 @@ + if (is_commented) + { + ianjuta_editor_erase (editor, start_copy, end_copy, NULL); Same as above with undo-action
Created attachment 177790 [details] [review] Comment/Uncomment function for anjuta's language-support-cpp-java plugin This should fix the mentioned problems. Concerning the undo action, this was already present in the previous patch in the function on_toggle_comment. Is it inappropriately placed there?
Review of attachment 177790 [details] [review]: Yes, that works! Great! Sorry to have missed the undo/redo stuff last time. It's fine where it is. Commit: http://git.gnome.org/browse/anjuta/commit/?id=be39289b292bf616ccf77ba9c6420d36a0cba9ce