SF.net SVN: geany: [1904] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Tue Sep 25 16:44:33 UTC 2007


Revision: 1904
          http://geany.svn.sourceforge.net/geany/?rev=1904&view=rev
Author:   ntrel
Date:     2007-09-25 09:44:33 -0700 (Tue, 25 Sep 2007)

Log Message:
-----------
Remove pos argument from sci_get_current_line(), because
sci_get_line_from_position() can be used instead and it's clearer.
Remove unused sci_get_line_end_styled() - it's also the same as
sci_get_line_from_position().

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
    trunk/src/editor.c
    trunk/src/keybindings.c
    trunk/src/navqueue.c
    trunk/src/sciwrappers.c
    trunk/src/sciwrappers.h
    trunk/src/utils.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-09-25 16:21:35 UTC (rev 1903)
+++ trunk/ChangeLog	2007-09-25 16:44:33 UTC (rev 1904)
@@ -15,6 +15,12 @@
    ui->set_statusbar() can now be used to do both with the log argument.
    After Geany 0.12 this is how the core versions of those functions
    will work, so the status window can be set independently.
+ * src/utils.c, src/keybindings.c, src/sciwrappers.c, src/sciwrappers.h,
+   src/navqueue.c, src/callbacks.c, src/editor.c:
+   Remove pos argument from sci_get_current_line(), because
+   sci_get_line_from_position() can be used instead and it's clearer.
+   Remove unused sci_get_line_end_styled() - it's also the same as
+   sci_get_line_from_position().
 
 
 2007-09-24  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2007-09-25 16:21:35 UTC (rev 1903)
+++ trunk/src/callbacks.c	2007-09-25 16:44:33 UTC (rev 1904)
@@ -1728,7 +1728,7 @@
 		gint line, ind_pos, old_pos, new_pos, step;
 
 		old_pos = sci_get_current_position(doc_list[idx].sci);
-		line = sci_get_current_line(doc_list[idx].sci, old_pos);
+		line = sci_get_line_from_position(doc_list[idx].sci, old_pos);
 		ind_pos = sci_get_line_indent_position(doc_list[idx].sci, line);
 		// when using tabs increase cur pos by 1, when using space increase it by tab_width
 		step = (editor_prefs.use_tabs) ? 1 : editor_prefs.tab_width;
@@ -1757,7 +1757,7 @@
 		gint line, ind_pos, old_pos, new_pos, step, indent;
 
 		old_pos = sci_get_current_position(doc_list[idx].sci);
-		line = sci_get_current_line(doc_list[idx].sci, old_pos);
+		line = sci_get_line_from_position(doc_list[idx].sci, old_pos);
 		ind_pos = sci_get_line_indent_position(doc_list[idx].sci, line);
 		step = (editor_prefs.use_tabs) ? 1 : editor_prefs.tab_width;
 		new_pos = (old_pos >= ind_pos) ? old_pos - step : old_pos;

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2007-09-25 16:21:35 UTC (rev 1903)
+++ trunk/src/editor.c	2007-09-25 16:44:33 UTC (rev 1904)
@@ -1977,7 +1977,7 @@
 		while (i >= 0 && isspace(previous_line[i])) i--;
 		if (i >= 1 && is_doc_comment_char(previous_line[i - 1], lexer) && previous_line[i] == '/')
 		{
-			gint cur_line = sci_get_current_line(sci, -1);
+			gint cur_line = sci_get_current_line(sci);
 			gint indent_pos = sci_get_line_indent_position(sci, cur_line);
 			gint indent_len = sci_get_col_from_position(sci, indent_pos);
 
@@ -2266,7 +2266,7 @@
 		return;	// prevent gdk_window_scroll warning
 
 	if (line == -1)
-		line = sci_get_current_line(sci, -1);
+		line = sci_get_current_line(sci);
 
 	// sci 'visible line' != doc line number because of folding and line wrapping
 	/* calling SCI_VISIBLEFROMDOCLINE for line is more accurate than calling

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2007-09-25 16:21:35 UTC (rev 1903)
+++ trunk/src/keybindings.c	2007-09-25 16:44:33 UTC (rev 1904)
@@ -1064,7 +1064,7 @@
 
 	if (! DOC_IDX_VALID(idx)) return;
 
-	cur_line = sci_get_current_line(doc_list[idx].sci, -1);
+	cur_line = sci_get_current_line(doc_list[idx].sci);
 
 	switch (key_id)
 	{

Modified: trunk/src/navqueue.c
===================================================================
--- trunk/src/navqueue.c	2007-09-25 16:21:35 UTC (rev 1903)
+++ trunk/src/navqueue.c	2007-09-25 16:44:33 UTC (rev 1904)
@@ -147,7 +147,7 @@
 	// first add old file as old position
 	if (doc_list[old_idx].tm_file)
 	{
-		gint cur_line = sci_get_current_line(doc_list[old_idx].sci, -1);
+		gint cur_line = sci_get_current_line(doc_list[old_idx].sci);
 
 		add_new_position(doc_list[old_idx].tm_file->file_name, cur_line + 1);
 	}

Modified: trunk/src/sciwrappers.c
===================================================================
--- trunk/src/sciwrappers.c	2007-09-25 16:21:35 UTC (rev 1903)
+++ trunk/src/sciwrappers.c	2007-09-25 16:44:33 UTC (rev 1904)
@@ -608,12 +608,6 @@
 }
 
 
-gint sci_get_line_end_styled(ScintillaObject * sci, gint end_styled)
-{
-	return SSM(sci,SCI_LINEFROMPOSITION, end_styled,0);
-}
-
-
 void sci_set_tab_width(ScintillaObject * sci, gint width)
 {
 	SSM(sci, SCI_SETTABWIDTH, width, 0);
@@ -840,16 +834,9 @@
 }
 
 
-gint sci_get_current_line(ScintillaObject *sci, gint pos)
+gint sci_get_current_line(ScintillaObject *sci)
 {
-	if (pos >= 0)
-	{
-		return SSM(sci, SCI_LINEFROMPOSITION, pos, 0);
-	}
-	else
-	{
-		return SSM(sci, SCI_LINEFROMPOSITION, SSM(sci, SCI_GETCURRENTPOS, 0, 0), 0);
-	}
+	return SSM(sci, SCI_LINEFROMPOSITION, SSM(sci, SCI_GETCURRENTPOS, 0, 0), 0);
 }
 
 /* Get number of lines partially or fully selected.

Modified: trunk/src/sciwrappers.h
===================================================================
--- trunk/src/sciwrappers.h	2007-09-25 16:21:35 UTC (rev 1903)
+++ trunk/src/sciwrappers.h	2007-09-25 16:44:33 UTC (rev 1904)
@@ -114,7 +114,6 @@
 void				sci_set_lexer				(ScintillaObject * sci, gint lexer);
 void				sci_clear_all				(ScintillaObject * sci);
 gint				sci_get_end_styled			(ScintillaObject * sci);
-gint				sci_get_line_end_styled		(ScintillaObject * sci, gint end_styled);
 void				sci_set_tab_width			(ScintillaObject * sci, gint width);
 gint				sci_get_tab_width			(ScintillaObject * sci);
 gchar				sci_get_char_at				(ScintillaObject * sci, gint pos);
@@ -156,7 +155,7 @@
 gint				sci_get_zoom				(ScintillaObject * sci);
 void				sci_cmd						(ScintillaObject * sci, gint cmd);
 
-gint				sci_get_current_line		(ScintillaObject * sci, gint pos);
+gint				sci_get_current_line		(ScintillaObject * sci);
 gint				sci_get_lines_selected		(ScintillaObject * sci);
 gint				sci_get_first_visible_line	(ScintillaObject * sci);
 

Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c	2007-09-25 16:21:35 UTC (rev 1903)
+++ trunk/src/utils.c	2007-09-25 16:44:33 UTC (rev 1904)
@@ -506,7 +506,7 @@
 		return tag_line;
 	}
 
-	line = sci_get_current_line(doc_list[idx].sci, -1);
+	line = sci_get_current_line(doc_list[idx].sci);
 	fold_level = sci_get_fold_level(doc_list[idx].sci, line);
 	// check if the cached line and file index have changed since last time:
 	if (! current_function_changed(idx, line, fold_level))


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