diff --git a/README b/README index 3bd6bc8e2..d9d664290 100644 --- a/README +++ b/README @@ -49,6 +49,7 @@ Available plugins are: * ``addons`` -- the Addons plugin * ``autoclose`` -- the Autoclose plugin * ``automark`` -- the Automark plugin +* ``bracketcolors`` -- the BracketColors plugin * ``codenav`` -- the CodeNav plugin * ``commander`` -- the Commander plugin * ``debugger`` -- the Debugger plugin diff --git a/bracketcolors/README b/bracketcolors/README index f40ee099c..abdde7bfc 100644 --- a/bracketcolors/README +++ b/bracketcolors/README @@ -1,5 +1,5 @@ Color brackets, parenthesis, and braces -=================== +======================================= .. contents:: @@ -7,7 +7,7 @@ About ----- This plugin enables bracket coloring features. Brackets are colored based on -nesting level +nesting level, often referred as "rainbow brackets". Features -------- diff --git a/bracketcolors/src/BracketMap.cc b/bracketcolors/src/BracketMap.cc index 592838b30..e219579a2 100644 --- a/bracketcolors/src/BracketMap.cc +++ b/bracketcolors/src/BracketMap.cc @@ -1,7 +1,7 @@ /* * BracketMap.cc * - * Copyright 2013 Asif Amin + * Copyright 2023 Asif Amin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,7 +67,6 @@ } - // ----------------------------------------------------------------------------- void BracketMap::ComputeOrder() /* @@ -109,35 +108,3 @@ GetOrder(bracket) = orderStack.size() - 1; } } - - - -// ----------------------------------------------------------------------------- - void BracketMap::Show() -/* - ------------------------------------------------------------------------------ */ -{ g_debug("%s: Showing bracket map ...", __FUNCTION__); - - for (const auto it : mBracketMap) { - - const Index &startIndex = it.first; - const Bracket &bracket = it.second; - - Length length = std::get<0>(bracket); - Order order = std::get<1>(bracket); - - Index end = -1; - if (length > 0) { - end = startIndex + length; - } - - g_debug( - "%s: Bracket at %d, Length: %d, End: %d, Order: %d", - __FUNCTION__, startIndex, length, end, order - ); - } - - g_debug("%s: ... Finished showing bracket map", __FUNCTION__); -} - diff --git a/bracketcolors/src/BracketMap.h b/bracketcolors/src/BracketMap.h index 55932315b..c87420d23 100644 --- a/bracketcolors/src/BracketMap.h +++ b/bracketcolors/src/BracketMap.h @@ -1,7 +1,7 @@ /* * BracketMap.h * - * Copyright 2013 Asif Amin + * Copyright 2023 Asif Amin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,8 +40,6 @@ BracketMap(); ~BracketMap(); - void Show(); - void Update(Index index, Length length); void ComputeOrder(); @@ -62,15 +60,4 @@ } }; - - - - - - - - - - - #endif diff --git a/bracketcolors/src/bracketcolors.cc b/bracketcolors/src/bracketcolors.cc index f00221b60..65a8b3a9e 100644 --- a/bracketcolors/src/bracketcolors.cc +++ b/bracketcolors/src/bracketcolors.cc @@ -1,7 +1,7 @@ /* * bracketcolors.cc * - * Copyright 2013 Asif Amin + * Copyright 2023 Asif Amin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -161,9 +161,6 @@ NULL ); } - else { - //g_debug("%s: computeTimeoutID already set", __FUNCTION__); - } if (drawTimeoutID == 0) { drawTimeoutID = g_timeout_add_full( @@ -174,9 +171,6 @@ NULL ); } - else { - //g_debug("%s: drawTimeoutID already set", __FUNCTION__); - } } @@ -192,17 +186,11 @@ g_source_remove(computeTimeoutID); computeTimeoutID = 0; } - else { - //g_debug("%s: computeTimeoutID already 0", __FUNCTION__); - } if (drawTimeoutID > 0) { g_source_remove(drawTimeoutID); drawTimeoutID = 0; } - else { - //g_debug("%s: drawTimeoutID already 0", __FUNCTION__); - } } @@ -379,11 +367,6 @@ ----------------------------------------------------------------------------- */ { - // g_debug( - // "%s: Purging a BracketColorsData", - // __FUNCTION__ - // ); - BracketColorsData *bcd = reinterpret_cast(data); delete bcd; } @@ -533,11 +516,6 @@ gint length = matchedBrace - position; - // g_debug( - // "%s: bracket at %d matched at %d", - // __FUNCTION__, position, matchedBrace - // ); - if (length > 0) { // matched from start brace bracketMap.Update(position, length); @@ -551,7 +529,6 @@ } else { // invalid mapping - // g_debug("%s: bracket at %d invalid", __FUNCTION__, position); if (is_open_bracket(char_at(sci, position), BracketType::COUNT)) { if (updateInvalidMapping) { @@ -668,11 +645,6 @@ gint curr = SSM(sci, SCI_INDICATORVALUEAT, correctIndicatorIndex, position); if (not curr) { - // g_debug( - // "%s: Setting indicator %d at %d", - // __FUNCTION__, - // correctIndicatorIndex, position - // ); SSM( sci, SCI_SETINDICATORCURRENT, @@ -729,9 +701,7 @@ ) { gint hasIndicator = SSM(sci, SCI_INDICATORVALUEAT, indicatorIndex, i); - // g_debug("%s: Indicator %d: %d", __FUNCTION__, indicatorIndex, hasIndicator); if (hasIndicator) { - // g_debug("%s: Clearing bracket at %d", __FUNCTION__, i); SSM( sci, SCI_SETINDICATORCURRENT, @@ -790,29 +760,20 @@ for (gint i = position; i < position + length; i++) { gchar newChar = char_at(sci, i); if (is_bracket_type(newChar, type)) { - // g_debug("%s: Handling new bracket character", __FUNCTION__); madeChange = TRUE; bracketColorsData.recomputeIndicies.insert(i); } } - // g_debug( - // "%s: Need to adjust %d brackets, recompute %d brackets", - // __FUNCTION__, indiciesToAdjust.size(), indiciesToRecompute.size() - // ); - if (not indiciesToAdjust.size() and not indiciesToRecompute.size()) { - //g_debug("%s: Nothing to do", __FUNCTION__); return madeChange; } for (const auto &it : indiciesToRecompute) { - //g_debug("%s: Recomputing bracket at %d", __FUNCTION__, it); bracketColorsData.recomputeIndicies.insert(it); } for (const auto &it : indiciesToAdjust) { - //g_debug("%s: Moved brace at %d to %d", __FUNCTION__, it, it + length); bracketMap.mBracketMap.insert( std::make_pair( it + length, @@ -861,21 +822,14 @@ } } - // g_debug( - // "%s: Need to remove %d brackets, adjust %d brackets", - // __FUNCTION__, indiciesToRemove.size(), indiciesToRecompute.size() - // ); - if ( not indiciesToRemove.size() and not indiciesToRecompute.size() ) { - //g_debug("%s: Nothing to do", __FUNCTION__); return FALSE; } for (const auto &it : indiciesToRemove) { - //g_debug("%s: Removing brace at %d", __FUNCTION__, it); bracketMap.mBracketMap.erase(it); bracketColorsData.RemoveFromQueues(it); } @@ -883,7 +837,6 @@ for (const auto &it : indiciesToRecompute) { // first bracket was moved backwards if (it >= position) { - //g_debug("%s: Moved brace at %d to %d", __FUNCTION__, it, it - length); bracketMap.mBracketMap.insert( std::make_pair( it - length, @@ -895,7 +848,6 @@ } // last bracket was moved else { - //g_debug("%s: Recomputing bracket at %d", __FUNCTION__, it); bracketColorsData.recomputeIndicies.insert(it); } } @@ -915,10 +867,6 @@ ----------------------------------------------------------------------------- */ { if (data->updateUI) { - // g_debug( - // "%s: Need to update %d indicies", - // __FUNCTION__, data->redrawIndicies.size() - // ); for ( auto position = data->redrawIndicies.begin(); @@ -969,10 +917,6 @@ case(SCN_MODIFIED): { if (nt->modificationType & SC_MOD_INSERTTEXT) { - // g_debug( - // "%s: Text added. Position: %d, Length: %d", - // __FUNCTION__, nt->position, nt->length - // ); // if we insert into position that had bracket clear_bc_indicators(sci, nt->position, nt->length); @@ -996,10 +940,6 @@ } if (nt->modificationType & SC_MOD_DELETETEXT) { - // g_debug( - // "%s: Text removed. Position: %d, Length: %d", - // __FUNCTION__, nt->position, nt->length - // ); for (gint bracketType = 0; bracketType < BracketType::COUNT; bracketType++) { if ( @@ -1016,10 +956,6 @@ } if (nt->modificationType & SC_MOD_CHANGESTYLE) { - // g_debug( - // "%s: Style change. Position: %d, Length: %d", - // __FUNCTION__, nt->position, nt->length - // ); if (data->init == TRUE) { for (gint bracketType = 0; bracketType < BracketType::COUNT; bracketType++) { @@ -1122,11 +1058,6 @@ ScintillaObject *sci = data->doc->editor->sci; - // g_debug( - // "%s: have to recompute %d indicies", - // __FUNCTION__, data->recomputeIndicies.size() - // ); - unsigned numIterations = 0; for ( auto position = data->recomputeIndicies.begin(); @@ -1184,19 +1115,14 @@ ----------------------------------------------------------------------------- */ { g_return_if_fail(DOC_VALID(doc)); - //g_debug("%s: closing document '%d'", __FUNCTION__, doc->id); - gpointer pluginData = plugin_get_document_data(geany_plugin, doc, sPluginName); if (pluginData != NULL) { BracketColorsData *data = reinterpret_cast(pluginData); - //g_debug("%s: Closing doc ID: %d", __FUNCTION__, data->doc->id); data->StopTimers(); } ScintillaObject *sci = doc->editor->sci; remove_bc_indicators(sci); - - //g_debug("%s: finished close routine", __FUNCTION__); } @@ -1211,11 +1137,9 @@ ----------------------------------------------------------------------------- */ { - //g_debug("%s: handling document activate", __FUNCTION__); gpointer pluginData = plugin_get_document_data(geany_plugin, doc, sPluginName); if (pluginData != NULL) { BracketColorsData *data = reinterpret_cast(pluginData); - //g_debug("%s: got page switch to doc ID: %d", __FUNCTION__, data->doc->id); data->StartTimers(); } } @@ -1231,13 +1155,11 @@ ----------------------------------------------------------------------------- */ { - //g_debug("%s: handling startup complete", __FUNCTION__); GeanyDocument *currDoc = document_get_current(); if (currDoc != NULL) { gpointer pluginData = plugin_get_document_data(geany_plugin, currDoc, sPluginName); if (pluginData != NULL) { BracketColorsData *data = reinterpret_cast(pluginData); - g_debug("%s: starting on doc ID: %d", __FUNCTION__, data->doc->id); data->StartTimers(); } } @@ -1257,7 +1179,6 @@ ----------------------------------------------------------------------------- */ { g_return_if_fail(DOC_VALID(doc)); - //g_debug("%s: opening document '%d'", __FUNCTION__, doc->id); BracketColorsData *data = bracket_colors_data_new(doc); ScintillaObject *sci = doc->editor->sci; @@ -1298,8 +1219,6 @@ ----------------------------------------------------------------------------- */ { - g_debug("%s: seting up plugin", __FUNCTION__); - geany_plugin = plugin; geany_data = plugin->geany_data; @@ -1334,8 +1253,6 @@ ----------------------------------------------------------------------------- */ { - g_debug("%s: leaving bracket colors", __FUNCTION__); - guint i = 0; foreach_document(i) { diff --git a/build/geany-plugins.nsi b/build/geany-plugins.nsi index 16c1d2f96..53f86b7c6 100644 --- a/build/geany-plugins.nsi +++ b/build/geany-plugins.nsi @@ -174,6 +174,7 @@ Section Uninstall Delete "$INSTDIR\lib\geany\addons.dll" Delete "$INSTDIR\lib\geany\autoclose.dll" Delete "$INSTDIR\lib\geany\automark.dll" + Delete "$INSTDIR\lib\geany\bracketcolors.dll" Delete "$INSTDIR\lib\geany\codenav.dll" Delete "$INSTDIR\lib\geany\commander.dll" Delete "$INSTDIR\lib\geany\defineformat.dll"