SF.net SVN: geany: [705] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sat Aug 12 16:24:36 UTC 2006
Revision: 705
Author: eht16
Date: 2006-08-12 09:24:29 -0700 (Sat, 12 Aug 2006)
ViewCVS: http://svn.sourceforge.net/geany/?rev=705&view=rev
Log Message:
-----------
Removed unnecessary code in document_replace_tabs().
Really take tab width when replacing instead of using width = 4.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/document.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-08-12 13:30:52 UTC (rev 704)
+++ trunk/ChangeLog 2006-08-12 16:24:29 UTC (rev 705)
@@ -1,3 +1,10 @@
+2006-08-12 Enrico Tröger <enrico.troeger at uvena.de>
+
+ * src/document.c:
+ Removed unnecessary code in document_replace_tabs().
+ Really take tab width when replacing instead of using width = 4.
+
+
2006-08-12 Nick Treleaven <nick.treleaven at btinternet.com>
* src/search.c: Enable case sensitive when regex search enabled.
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2006-08-12 13:30:52 UTC (rev 704)
+++ trunk/src/document.c 2006-08-12 16:24:29 UTC (rev 705)
@@ -1308,31 +1308,25 @@
void document_replace_tabs(gint idx)
{
- gint i, len, j = 0, tabs_amount = 0, tab_w, pos;
- gchar *data, *replacement, *text;
+ gint i, len, j = 0, k, tabs_amount = 0, tab_w, pos;
+ gchar *data, *text;
if (idx < 0 || ! doc_list[idx].is_valid) return;
pos = sci_get_current_position(doc_list[idx].sci);
tab_w = sci_get_tab_width(doc_list[idx].sci);
- replacement = g_malloc(tab_w + 1);
// get the text
len = sci_get_length(doc_list[idx].sci) + 1;
data = g_malloc(len);
sci_get_text(doc_list[idx].sci, len, data);
- // prepare the spaces with the width of a tab
- for (i = 0; i < tab_w; i++) replacement[i] = ' ';
- replacement[tab_w] = '\0';
-
for (i = 0; i < len; i++) if (data[i] == 9) tabs_amount++;
// if there are no tabs, just return and leave the content untouched
if (tabs_amount == 0)
{
g_free(data);
- g_free(replacement);
return;
}
@@ -1345,10 +1339,7 @@
// increase cursor position to keep it at same position
if (pos > i) pos += 3;
- text[j++] = 32;
- text[j++] = 32;
- text[j++] = 32;
- text[j++] = 32;
+ for (k = 0; k < tab_w; k++) text[j++] = 32;
}
else
{
@@ -1363,7 +1354,6 @@
g_free(data);
g_free(text);
- g_free(replacement);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list