SF.net SVN: geany: [715] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Aug 15 08:51:56 UTC 2006


Revision: 715
Author:   eht16
Date:     2006-08-15 01:51:48 -0700 (Tue, 15 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=715&view=rev

Log Message:
-----------
Made increase/decrease indentation working with selections.
Keep the old cursor position when working on a single line (do not jump to line start).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-08-14 15:02:52 UTC (rev 714)
+++ trunk/ChangeLog	2006-08-15 08:51:48 UTC (rev 715)
@@ -1,3 +1,11 @@
+2006-08-15  Enrico Tröger  <enrico.troeger at uvena.de>
+
+ * src/callbacks.c:
+   Made increase/decrease indentation working with selections.
+   Keep the old cursor position when working on a single line
+   (do not jump to line start).
+
+
 2006-08-14  Nick Treleaven  <nick.treleaven at btinternet.com>
 
  * src/sci_cb.c: Applied patch from Jens Granseuer to fix build with
@@ -8,7 +16,7 @@
    Assume C-like warning messages when running make when the current
    file is a Makefile.
    Moved some msgwin setup and cleanup code to msgwindow.c.
- * src/utils.c, src/utils.h
+ * src/utils.c, src/utils.h:
    Moved utils_parse_compiler_error_line to msgwindow.c.
 
 

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2006-08-14 15:02:52 UTC (rev 714)
+++ trunk/src/callbacks.c	2006-08-15 08:51:48 UTC (rev 715)
@@ -2474,14 +2474,24 @@
                                         gpointer         user_data)
 {
 	gint idx = document_get_cur_idx();
-	gint line, pos;
 	if (idx == -1 || ! doc_list[idx].is_valid) return;
 
-	line = sci_get_current_line(doc_list[idx].sci, -1);
-	pos = sci_get_line_indent_position(doc_list[idx].sci, line);
+	if (sci_can_copy(doc_list[idx].sci))
+	{
+		sci_cmd(doc_list[idx].sci, SCI_TAB);
+	}
+	else
+	{
+		gint line, pos, old_pos;
 
-	sci_set_current_position(doc_list[idx].sci, pos);
-	sci_cmd(doc_list[idx].sci, SCI_TAB);
+		old_pos = sci_get_current_position(doc_list[idx].sci);
+		line = sci_get_current_line(doc_list[idx].sci, old_pos);
+		pos = sci_get_line_indent_position(doc_list[idx].sci, line);
+
+		sci_set_current_position(doc_list[idx].sci, pos);
+		sci_cmd(doc_list[idx].sci, SCI_TAB);
+		sci_set_current_position(doc_list[idx].sci, old_pos + 1);
+	}
 }
 
 
@@ -2490,13 +2500,23 @@
                                         gpointer         user_data)
 {
 	gint idx = document_get_cur_idx();
-	gint line, pos;
 	if (idx == -1 || ! doc_list[idx].is_valid) return;
 
-	line = sci_get_current_line(doc_list[idx].sci, -1);
-	pos = sci_get_line_indent_position(doc_list[idx].sci, line);
+	if (sci_can_copy(doc_list[idx].sci))
+	{
+		sci_cmd(doc_list[idx].sci, SCI_BACKTAB);
+	}
+	else
+	{
+		gint line, pos, old_pos;
 
-	sci_set_current_position(doc_list[idx].sci, pos);
-	sci_cmd(doc_list[idx].sci, SCI_BACKTAB);
+		old_pos = sci_get_current_position(doc_list[idx].sci);
+		line = sci_get_current_line(doc_list[idx].sci, old_pos);
+		pos = sci_get_line_indent_position(doc_list[idx].sci, line);
+
+		sci_set_current_position(doc_list[idx].sci, pos);
+		sci_cmd(doc_list[idx].sci, SCI_BACKTAB);
+		sci_set_current_position(doc_list[idx].sci, old_pos - 1);
+	}
 }
 


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