anjuta r3513 - in trunk: . libanjuta/interfaces manuals/reference/libanjuta plugins plugins/build-basic-autotools plugins/debug-manager plugins/document-manager plugins/editor plugins/indent plugins/language-support-cpp-java plugins/macro plugins/search plugins/symbol-browser plugins/symbol-db plugins/tools



Author: naba
Date: Wed Jan 23 14:15:46 2008
New Revision: 3513
URL: http://svn.gnome.org/viewvc/anjuta?rev=3513&view=rev

Log:
	* libanjuta/interfaces/libanjuta.idl:
	* manuals/reference/libanjuta/libanjuta-sections.txt:
	* plugins/build-basic-autotools/build-basic-autotools.c:
	(build_indicator_location_set), (on_editor_changed):
	* plugins/debug-manager/plugin.c: (show_program_counter_in_editor):
	* plugins/debug-manager/variable.c: (get_hovered_word):
	* plugins/document-manager/action-callbacks.c:
	(on_editor_command_upper_case_activate),
	(on_editor_command_lower_case_activate):
	* plugins/document-manager/search-box.c: (on_incremental_search),
	(on_search_activated):
	* plugins/editor/text-editor-iterable.c: (icell_get_attribute),
	(iiter_last), (iiter_set_position), (iiter_get_position),
	(iiter_get_length), (iiter_compare), (iiter_diff),
	(iiter_iface_init):
	* plugins/editor/text_editor.c: (text_editor_get_position_lineno),
	(text_editor_goto_point), (itext_editor_goto_start),
	(itext_editor_goto_end), (itext_editor_goto_position),
	(itext_editor_get_text_all), (itext_editor_get_text),
	(itext_editor_get_position), (itext_editor_get_offset),
	(itext_editor_get_length), (itext_editor_insert),
	(itext_editor_erase), (itext_editor_erase_all),
	(itext_editor_get_column), (itext_editor_get_overwrite),
	(itext_editor_set_popup_menu),
	(itext_editor_get_line_from_position),
	(itext_editor_get_line_begin_position),
	(itext_editor_get_line_end_position),
	(itext_editor_get_position_from_offset),
	(itext_editor_get_start_position), (itext_editor_get_end_position),
	(itext_editor_iface_init), (iconvert_to_upper),
	(iconvert_to_lower), (iassist_suggest), (iassist_show_tips),
	(iindicable_set):
	* plugins/editor/text_editor.h:
	* plugins/editor/text_editor_cbs.c:
	(on_text_editor_scintilla_notify):
	* plugins/indent/plugin.c: (on_indent_action_activate):
	* plugins/language-support-cpp-java/cpp-java-assist.c:
	(cpp_java_assist_get_scope_context),
	(cpp_java_assist_get_pre_word),
	(cpp_java_assist_show_autocomplete),
	(cpp_java_assist_show_calltip), (cpp_java_assist_check),
	(on_editor_char_added), (on_assist_chosen):
	* plugins/language-support-cpp-java/plugin.c:
	(get_line_indentation), (skip_iter_to_previous_logical_line),
	(skip_preprocessor_lines), (initialize_indentation_params),
	(set_line_indentation), (get_line_indentation_base),
	(get_line_auto_indentation), (on_editor_char_inserted_cpp),
	(on_editor_char_inserted_java), (on_auto_indent):
	* plugins/macro/macro-actions.c: (match_shortcut):
	* plugins/macro/macro-dialog.c: (on_ok_clicked):
	* plugins/macro/plugin.c: (match_keyword):
	* plugins/search/plugin.c: (find_incremental):
	* plugins/search/search-replace.c: (search_and_replace),
	(search_start_over):
	* plugins/search/search-replace_backend.c:
	(file_buffer_new_from_te), (file_buffer_line_from_pos),
	(create_search_entries):
	* plugins/symbol-browser/plugin.c:
	(on_editor_buffer_symbols_update_timeout), (on_char_added),
	(isymbol_manager_iface_init):
	* plugins/symbol-db/plugin.c:
	(on_editor_buffer_symbols_update_timeout), (on_char_added),
	(isymbol_manager_iface_init):
	* plugins/tools/execute.c: (atp_output_context_construct),
	(atp_output_context_destroy), (atp_user_tool_execute):

	Update IAnjutaEditor and IAnjutaIndicable interfaces to take
	iterators instead of integer offsets.
	- Renamed original ianjuta_editor_get_position(int) to 
	ianjuta_editor_get_offset(). It is deprecated.
	- Renamed original ianjuta_editor_get_position_iter() to
	ianjuta_editor_get_position().
	- Renamed ianjuta_editor_get_cell_iter() to
	ianjuta_editor_get_position_from_offset()
	- Renamed ianjuta_editor_get_text_iter() to ianjuta_editor_get_text()
	- Added new methods:
	ianjuta_editor_get_start_position(), ianjuta_editor_get_end_position()
	ianjuta_editor_get_text_all(), ianjuta_editor_goto_start(),
	ianjuta_editor_goto_end().
	- All relevent signals and methods converted to use iterators.
	- All relevent plugins fixed to use new API.
	- Removed ianjuta_editor_cell_get_line() because it is provided by
	ianjuta_editor_get_line_from_position().
	- Removed ianjuta_symbol_manager_get_completions_at_position()
	because it not used anywhere and is not right to be there.
	- Updated IAnjutaEditable documentation.

	Updated IAnjutaIterable interface:
	- ianjuta_iterable_compare() and ianjuta_iterable_diff()
	- Introduced \'end-iter\' to point at the end of the list.
	- Updated IAnjutaIterable documentation.

	* plugins/Makefile.am:
	(Disabled sourceview plugin for now. Jhs is coming up with a patch
	for it soon).

Modified:
   trunk/ChangeLog
   trunk/libanjuta/interfaces/libanjuta.idl
   trunk/manuals/reference/libanjuta/libanjuta-sections.txt
   trunk/plugins/Makefile.am
   trunk/plugins/build-basic-autotools/build-basic-autotools.c
   trunk/plugins/debug-manager/plugin.c
   trunk/plugins/debug-manager/variable.c
   trunk/plugins/document-manager/action-callbacks.c
   trunk/plugins/document-manager/search-box.c
   trunk/plugins/editor/text-editor-iterable.c
   trunk/plugins/editor/text_editor.c
   trunk/plugins/editor/text_editor.h
   trunk/plugins/editor/text_editor_cbs.c
   trunk/plugins/indent/plugin.c
   trunk/plugins/language-support-cpp-java/cpp-java-assist.c
   trunk/plugins/language-support-cpp-java/plugin.c
   trunk/plugins/macro/macro-actions.c
   trunk/plugins/macro/macro-dialog.c
   trunk/plugins/macro/plugin.c
   trunk/plugins/search/plugin.c
   trunk/plugins/search/search-replace.c
   trunk/plugins/search/search-replace_backend.c
   trunk/plugins/symbol-browser/plugin.c
   trunk/plugins/symbol-db/plugin.c
   trunk/plugins/tools/execute.c

Modified: trunk/libanjuta/interfaces/libanjuta.idl
==============================================================================
--- trunk/libanjuta/interfaces/libanjuta.idl	(original)
+++ trunk/libanjuta/interfaces/libanjuta.idl	Wed Jan 23 14:15:46 2008
@@ -284,6 +284,7 @@
  */
 interface IAnjutaIndicable
 {
+	#include <libanjuta/interfaces/ianjuta-iterable.h>
 	enum Indicator
 	{
 		NONE,
@@ -292,7 +293,7 @@
 		CRITICAL
 	}
 	
-	void set (gint begin_location, gint end_location, Indicator indicator);
+	void set (IAnjutaIterable *begin_location, IAnjutaIterable *end_location, Indicator indicator);
 	void clear ();
 }
 
@@ -314,6 +315,7 @@
 	*
 	* Set iter to first element position. Returns FALSE if
 	* there is no element in the iterable (hence does not have first).
+	* The iter points to the first valid item.
 	*
 	* Returns: TRUE if sucessful, other FALSE.
 	*/
@@ -324,10 +326,13 @@
 	* @obj: Self
 	* @err: Error propagation and reporting
 	*
-	* Set the iter position to next element position. Returns FALSE if there
-	* is no next element and the iter remains pointed to the last element.
+	* Set the iter position to next element position. Iter can go until one
+	* item past the last item and lands in end-iter. end-iter does not point
+	* to any valid item and signifies end of the list. Returns FALSE if iter
+	* was already at end-iter (iter can not go past it) and remains pointed
+	* to the end-iter.
 	*
-	* Returns: TRUE if sucessful, other FALSE..
+	* Returns: TRUE if sucessful, otherwise FALSE if already at end-iter.
 	*/
 	gboolean next ();
 	
@@ -349,8 +354,9 @@
 	* @obj: Self
 	* @err: Error propagation and reporting
 	* 
-	* Set iter position to last element position. Returns FALSE if
-	* there is no element in the iterable (hence does not have last).
+	* Set iter position to end-iter (one past last element) position.
+	* Returns FALSE if there is no element in the iterable (already
+	* at end-iter).
 	*
 	* Returns: TRUE if sucessful, other FALSE.
 	*/
@@ -377,12 +383,14 @@
 	* @err: Error propagation and reporting
 	* 
 	* Sets the current position of the iter to @position. The given @position
-	* must be from 0 to length - 1 (ianjuta_iter_get_length()), otherwise
-	* FLASE will be returned. If invalid iter @position is given, the current
-	* iter position is not altered.
+	* must be from 0 to length - 1 (#ianjuta_iter_get_length()) to point to
+	* a valid element. Passing @position < 0 will set it to end-iter. It
+	* returns TRUE for the above cases. FLASE will be returned, if
+	* out-of-range @position is passed (@position > length - 1) and iter is
+	* set to end-iter.
 	*
-	* Returns: TRUE if successfully set (i.e. @position is within the range).
-	* otherwise returns FALSE (i.e. @position is out of data range).
+	* Returns: TRUE if successfully set (i.e. @position is within the range or
+	* end-iter). otherwise returns FALSE (i.e. @position is out of data range).
 	*/
 	gboolean set_position (gint position);
 	
@@ -392,9 +400,10 @@
 	* @err: Error propagation and reporting
 	*
 	* Index of the current iter in the iterable. It will be
-	* from 0 to length - 1 (ianjuta_iter_get_length())
+	* from 0 to length - 1 (ianjuta_iter_get_length()) if iter is pointed
+	* at valid element. It will return -1 if iter is pointed at end-iter.
 	*
-	* Returns: integer index.
+	* Returns: integer index, or -1 for end-iter.
 	*/
 	gint get_position ();
 
@@ -403,7 +412,7 @@
 	* @obj: Self
 	* @err: Error propagation and reporting
 	* 
-	* Length of the iterable
+	* Length of the iterable (number of elements indexable by it).
 	*
 	* Returns: total length of the list.
 	*/
@@ -433,6 +442,38 @@
 	void assign (IAnjutaIterable *src_iter);
 
 	/**
+	* ianjuta_iterable_compare:
+	* @obj: Self
+	* @iter2: Second iter to compare.
+	* @err: Error propagation and reporting
+	* 
+	* Compares the position of @iter2 with this @obj. Returns -1
+	* value if this @obj is smaller than @iter2. Returns +1 value
+	* if this @obj is larger than @iter2. And returns 0 if both are equal.
+	* If you want difference of the iter positions, use
+	* #ianjuta_iterable_diff(). This method is meant for fast comparision.
+	* 
+	* Returns: 0 if equal, -1 if @obj is smaller than @iter2
+	* or +1 if @obj is larger than @iter2.
+	*
+	*/
+	gint compare (IAnjutaIterable *iter2);
+	
+	/**
+	* ianjuta_iterable_diff:
+	* @obj: Self
+	* @iter2: Second iter to differenciate.
+	* @err: Error propagation and reporting
+	* 
+	* Compares the position of @iter2 with this @obj and returns difference
+	* in position of the two (@obj - @iter2).
+	* 
+	* Returns: The position difference of @obj - @iter2
+	*
+	*/
+	gint diff (IAnjutaIterable *iter2);
+	
+	/**
 	 * SECTION:ianjuta-iterable-tree
 	 * @title: IAnjutaIterableTree
 	 * @short_description: Implemented by tree objects that can iterate
@@ -919,18 +960,18 @@
 	
 	/**
 	 * IAnjutaEditor::char_added:
-	 * @position: The position where @ch is added.
+	 * @position: The iter position where @ch is added.
 	 * @ch: The character that has been added.
 	 * @obj: Self
 	 * 
 	 * This signal is emitted when any character is added inside the editor.
 	 * The newly added character is @ch which has been inserted at @position.
 	 */
-	void   ::char_added (gint position, gchar ch);
+	void   ::char_added (GObject *position, gchar ch);
 	
 	/**
 	 * IAnjutaEditor::changed:
-	 * @position: The position where change happend.
+	 * @position: The iter position where change happend.
 	 * @added: TRUE if added, FALSE if deleted.
 	 * @length: Length of the text changed.
 	 * @lines: Number of lines added or removed.
@@ -942,7 +983,7 @@
 	 * terminated. Use @length to read the text. @lines represent the
 	 * number of line breaks in the added or removed text.
 	 */
-	void   ::changed (gint position, gboolean added, gint length, gint lines, const gchar *text);
+	void   ::changed (GObject *position, gboolean added, gint length, gint lines, const gchar *text);
 	
 	/**
 	 * ianjuta_editor_get_tabsize:
@@ -995,27 +1036,34 @@
 	 * custom auto-indent can set this to false and override the preferences
 	 * setting
 	 */
-	void set_auto_indent(gboolean auto_indent);
+	void set_auto_indent (gboolean auto_indent);
 	
 	/**
-	 * ianjuta_editor_erase:
+	 * ianjuta_editor_erase_range:
 	 * @obj: Self
-	 * @position: Start position of chars to erase. Must be 0 or more.
-	 * @length: number of chars to erase. -1 means till the end of document.
+	 * @position_start: Start position of chars to erase.
+	 * @position_end: End position of chars to erase.
 	 * @err: Error propagation and reporting
 	 *
-	 * Erases the @length number of chars starting from @position. If length
-	 * is 0, nothing happens.
+	 * Erases the chars between positions pointed by @position_start and
+	 * @position_end. The character pointed by @position_start is included,
+	 * while pointed by @position_end is not include in the range. After
+	 * the erase operation, all active iters, except these two, are no
+	 * longer guranteed to be valid. At the end the operation, these two
+	 * iters point to the same position which is the position where erase
+	 * happend (usually the original @position_start position).
 	 */
-	void   erase (gint position, gint length);
+	void   erase (IAnjutaIterable *position_start, IAnjutaIterable *position_end);
 	
-	/**
+ 	/**
 	 * ianjuta_editor_erase_all:
-	 * @obj: Self
-	 * @err: Error propagation and reporting
-	 *
+ 	 * @obj: Self
+ 	 * @err: Error propagation and reporting
+ 	 *
 	 * Empties the whole editor buffer. There will be zero characters.
-	 */
+	 * After the erase operation, none of the active iters are guranteed
+	 * to be valid. 
+ 	 */
 	void   erase_all ();
 	
 	/**
@@ -1029,7 +1077,7 @@
 	 * Inserts @length characters from @text buffer at given @position of
 	 * editor buffer. If @length is -1, the whole @text is used.
 	 */
-	void   insert (int position, const gchar *text, gint length);
+	void   insert (IAnjutaIterable *position, const gchar *text, gint length);
 	
 	/**
 	 * ianjuta_editor_append:
@@ -1039,7 +1087,7 @@
 	 * @err: Error propagation and reporting
 	 *
 	 * Appends @length characters from @text buffer at the end of editor
-	 * buffer. If @length is -1, the whole @text is used.
+	 * buffer. If @length is -1, the whole @text is used. @length is in bytes.
 	 */
 	void   append (const gchar *text, gint length);
 	
@@ -1055,72 +1103,67 @@
 	void   goto_line (gint lineno);
 	
 	/**
-	 * ianjuta_editor_goto_position:
+	 * ianjuta_editor_goto_start:
 	 * @obj: Self
-	 * @position: Character position where carat will be moved.
 	 * @err: Error propagation and reporting
 	 *
-	 * Carat is moved to the given @position and text view is scrolled to
-	 * bring @position in viewable area of the editor.
+	 * Carat is moved to the begining of editor and text view is scrolled to
+	 * bring it in viewable area of the editor.
 	 */
-	void goto_position (gint position);
+	void   goto_start ();
 	
 	/**
-	 * ianjuta_editor_get_text:
+	 * ianjuta_editor_goto_end:
 	 * @obj: Self
-	 * @position: Begining position. Must be greater than or equal to 0.
-	 * @length: length of the text. -1 means till the end of document.
 	 * @err: Error propagation and reporting
 	 *
-	 * Gets @length text characters beginning from @position
-	 * (including char pointed by @position). If @length is less then
-	 * 0 or exceeds document length, text till the end of the document is
-	 * returned. @start must be 0 or greater then 0. If @start is beyond
-	 * document length, NULL is returned. If @length is 0, NULL is returned.
-	 * The characters returned are utf-8 encoded.
+	 * Carat is moved to the end of editor and text view is scrolled to
+	 * bring it in viewable area of the editor.
+	 */
+	void   goto_end ();
+	
+	/**
+	 * ianjuta_editor_goto_position:
+	 * @obj: Self
+	 * @position: Character position where carat will be moved.
+	 * @err: Error propagation and reporting
 	 *
-	 * Returns: A buffer of utf-8 characters.
-	 * The returned buffer must be freed when no longer required.
+	 * Carat is moved to the given @position and text view is scrolled to
+	 * bring @position in viewable area of the editor.
 	 */
-	gchar* get_text (gint position, gint length);
-
+	void goto_position (IAnjutaIterable *position);
+	
 	/**
-	 * ianjuta_editor_get_text_iter:
+	 * ianjuta_editor_get_text:
 	 * @obj: Self
 	 * @begin: Begining iterator
 	 * @end: End iterator
 	 * @err: Error propagation and reporting
 	 *
-	 * Gets text characters beginning from @begin
-	 * (including char pointed by @begin) and ending with @end
-	 * The characters returned are utf-8 encoded.
+	 * Gets text characters beginning from @begin (including char
+	 * pointed by @begin) and ending with @end (excluding character
+	 * pointed by @end). The characters returned are utf-8 encoded.
+	 * The iterators @begin and @end could be in either order. The returned
+	 * text, however, is in right order. If both @begin and @end points
+	 * to the same position, NULL is returned.
 	 *
 	 * Returns: A buffer of utf-8 characters.
 	 * The returned buffer must be freed when no longer required.
 	 */
-	gchar* get_text_iter (IAnjutaIterable* begin, IAnjutaIterable* end);
+	gchar* get_text (IAnjutaIterable *begin, IAnjutaIterable *end);
 
-	/*
-	 * ianjuta_editor_get_position:
-	 * @obj: Self
-	 * @err: Error propagation and reporting
-	 *
-	 * Get current caret position
-	 *
-	 * Returns: Current character position since the begining of file.
-	 */
-	gint   get_position ();
-	
-	/*
-	 * ianjuta_editor_get_position_iter:
+	/**
+	 * ianjuta_editor_get_text_all:
 	 * @obj: Self
 	 * @err: Error propagation and reporting
 	 *
-	 * Get current caret position
+	 * Gets all text characters in the editor.
+	 * The characters returned are utf-8 encoded.
 	 *
-	 * Returns: Iterator that points to the current position
+	 * Returns: A buffer of utf-8 characters containing all text from editor.
+	 * The returned buffer must be freed when no longer required.
 	 */
-	IAnjutaIterable*   get_position_iter ();
+	gchar* get_text_all ();
 	
 	/**
 	 * ianjuta_editor_line_from_position:
@@ -1132,7 +1175,7 @@
 	 * Returns: Line which corresponds to @position
 	 *
 	 */
-	int get_line_from_position (int position);
+	int get_line_from_position (IAnjutaIterable *position);
 	
 	/**
 	 * ianjuta_editor_get_lineno:
@@ -1189,7 +1232,7 @@
 	*
 	* Returns: fixme
 	*/
-	gint get_line_begin_position (gint line);
+	IAnjutaIterable* get_line_begin_position (gint line);
 	
 	/**
 	* ianjuta_editor_get_line_end_position:
@@ -1201,7 +1244,7 @@
 	* 
 	* Returns: fixme
 	*/
-	gint get_line_end_position (gint line);
+	IAnjutaIterable *get_line_end_position (gint line);
 	
 	/**
 	 * ianjuta_editor_get_overwrite:
@@ -1227,33 +1270,75 @@
 	 */
 	void set_popup_menu (GtkWidget *menu);
 	
+	/*
+	 * ianjuta_editor_get_offset:
+	 * @obj: Self
+	 * @err: Error propagation and reporting
+	 *
+	 * Get current caret position in integer character offset. Deprecated.
+	 * Use ianjuta_editor_get_position() instead.
+	 *
+	 * Returns: Current character position since the begining of file.
+	 */
+	gint   get_offset ();
+	
+	/*
+	 * ianjuta_editor_get_position:
+	 * @obj: Self
+	 * @err: Error propagation and reporting
+	 *
+	 * Get current caret position.
+	 *
+	 * Returns: Iterator that points to the current position.
+	 */
+	IAnjutaIterable*   get_position ();
+	
 	/**
-	 * ianjuta_editor_get_cell_iter:
+	 * ianjuta_editor_get_position_from_offset:
 	 * @obj: Self
-	 * @position: Byte position where the iter will be set
+	 * @offset: Character offset position where the iter will be set
 	 * @err: Error propagation and reporting
 	 *
 	 * Creates and returns an iter for editor cells. The iter is
-	 * placed at the unicode character position where the given byte
-     * @position happens to fall (means given @position does not necessarily
-	 * is the current position of the iter). The returned iter
-	 * is cell (character) iter and not byte iter, so all iter operations
+	 * placed at the unicode character position where the given offset
+     * @offset happens to fall. The returned iter is cell (character)
+	 * iter and not byte iter, so all iter operations
 	 * on it are character (not byte) iteration, including all position
-     * and index references in the iter. However, the @position paramter
-     * passed to this function is byte position (because all editor
- 	 * Aoperations are based on byte positions). @position could happen
-     * to be in the middle of a unicode character and that is a vaild
-     * situation.
+     * and index references in the iter.
      *
-     * The iter must be
-     * unreferrenced by the caller when done. The iter navigates
-     * (next/previous) in step of unicode characters (one unicode
- 	 * character == one cell).
+     * The iter must be unreferrenced by the caller when done.
+	 * The iter navigates (next/previous) in step of unicode
+	 * characters (one unicode character == one cell).
 	 * 
-	 * Retruns: a newly created iter of IAnjutaEditorCell placed at the
-	 * given position.
+	 * Retrun value: a newly created iter of IAnjutaEditorCell placed at the
+	 * given @offset position.
 	 */
-	IAnjutaIterable* get_cell_iter (gint position);
+	IAnjutaIterable* get_position_from_offset (gint offset);
+	
+	/**
+	 * ianjuta_editor_get_start_position:
+	 * @obj: Self
+	 * @err: Error propagation and reporting
+	 *
+	 * Gets the iter positioned at the start of the editor buffer.
+	 *
+	 * Retrun value: Cell iter set to the begining of the editor.
+	 */
+	IAnjutaIterable* get_start_position ();
+	
+	/**
+	 * ianjuta_editor_get_end_position:
+	 * @obj: Self
+	 * @err: Error propagation and reporting
+	 *
+	 * Gets the iter positioned at the end of the editor buffer. The
+	 * returned iter is the end-iter which does not point to any valid
+	 * character in the buffer (it is pointed one step beyond the last
+	 * valid character).
+	 * 
+	 * Retrun value: Cell iter set to the end of the editor (end-iter).
+	 */
+	IAnjutaIterable* get_end_position ();
 
 	/**
 	 * SECTION:ianjuta-editor-selection
@@ -1452,7 +1537,7 @@
 		 * change characters from start position to end position to uppercase.
 		 *
 		 */
-		void to_upper (gint start_position, gint end_position);
+		void to_upper (IAnjutaIterable *start_position, IAnjutaIterable *end_position);
 		
 		/**
 		 * ianjuta_editor_convert_to_lower:
@@ -1464,7 +1549,7 @@
 		 * change characters from start position to end position to lowercase
 		 *
 		 */
-		void to_lower (gint start_position, gint end_position);
+		void to_lower (IAnjutaIterable *start_position, IAnjutaIterable *end_position);
 	}
 	
 	/**
@@ -1542,6 +1627,7 @@
 	{
 		/* IAnjutaEdiotrAssist::assist_chosen:
 		 * @obj: self
+		 * @selection: The selection index
 		 *
 		 * User's selection from the choices. It is the index of the choice
 		 * presented with ianjuta_editor_assist_suggest().
@@ -1561,7 +1647,7 @@
 		 * will occur
 		 *
 		 */
-		void suggest (List<const gchar*> choices, int position, int char_alignment);
+		void suggest (List<const gchar*> choices, IAnjutaIterable *position, int char_alignment);
 		
 		/** ianjuta_editor_assist_hide_suggestions
 		 * @obj: Self
@@ -1587,7 +1673,7 @@
 		 * position when the choices are displayed.
 		 *
 		 */
-		void show_tips (List<const gchar*> tips, gint position, gint char_alignment);
+		void show_tips (List<const gchar*> tips, IAnjutaIterable *position, gint char_alignment);
 		
 		/**
 		 * ianjuta_editor_assist_cancel_tip:
@@ -1942,17 +2028,6 @@
 	gint get_length ();
 
 	/**
-	 * ianjuta_editor_cell_get_line:
-	 * @obj: self
-	 * @err: Error propagation and reporting.
-	 *
-	 * Get the line of the cell
-	 * 
-	 * Returns: Line of the cell
-	 */
-	gint get_line();
-	
-	/**
 	 * ianjuta_editor_cell_get_char:
 	 * @obj: Self
 	 * @err: Error propagation and reporting
@@ -4339,18 +4414,6 @@
 	* Returns: fixme
 	*/
 	IAnjutaIterable* get_parents (const gchar *symbol_name);
-	
-	/**
-	* ianjuta_symbol_manager_get_completions_at_position:
-	* @obj: Self
-	* @symbol_name: fixme
-	* @err: Error propagation and reporting.
-	* 
-	* fixme
-	* 
-	* Returns: fixme
-	*/
-	IAnjutaIterable* get_completions_at_position (const gchar* file_uri, const gchar *text_buffer, const gint text_length, const gint text_pos);
 }
 
 /**

Modified: trunk/manuals/reference/libanjuta/libanjuta-sections.txt
==============================================================================
--- trunk/manuals/reference/libanjuta/libanjuta-sections.txt	(original)
+++ trunk/manuals/reference/libanjuta/libanjuta-sections.txt	Wed Jan 23 14:15:46 2008
@@ -619,23 +619,27 @@
 ianjuta_editor_append
 ianjuta_editor_erase
 ianjuta_editor_erase_all
-ianjuta_editor_get_cell_iter
 ianjuta_editor_get_column
 ianjuta_editor_get_current_word
+ianjuta_editor_get_end_position
 ianjuta_editor_get_length
 ianjuta_editor_get_line_begin_position
 ianjuta_editor_get_line_end_position
 ianjuta_editor_get_line_from_position
 ianjuta_editor_get_lineno
+ianjuta_editor_get_offset
 ianjuta_editor_get_overwrite
 ianjuta_editor_get_position
-ianjuta_editor_get_position_iter
+ianjuta_editor_get_position_from_offset
+ianjuta_editor_get_start_position
 ianjuta_editor_get_tabsize
 ianjuta_editor_get_text
-ianjuta_editor_get_text_iter
+ianjuta_editor_get_text_all
 ianjuta_editor_get_use_spaces
+ianjuta_editor_goto_end
 ianjuta_editor_goto_line
 ianjuta_editor_goto_position
+ianjuta_editor_goto_start
 ianjuta_editor_insert
 ianjuta_editor_set_auto_indent
 ianjuta_editor_set_popup_menu
@@ -835,7 +839,6 @@
 ianjuta_editor_cell_get_char
 ianjuta_editor_cell_get_character
 ianjuta_editor_cell_get_length
-ianjuta_editor_cell_get_line
 <SUBSECTION Standard>
 IANJUTA_EDITOR_CELL
 IANJUTA_IS_EDITOR_CELL
@@ -1162,7 +1165,9 @@
 IAnjutaIterableIface
 ianjuta_iterable_error_quark
 ianjuta_iterable_assign
+ianjuta_iterable_compare
 ianjuta_iterable_clone
+ianjuta_iterable_diff
 ianjuta_iterable_first
 ianjuta_iterable_foreach
 ianjuta_iterable_get_length
@@ -1486,7 +1491,6 @@
 IAnjutaSymbolManager
 IAnjutaSymbolManagerIface
 ianjuta_symbol_manager_error_quark
-ianjuta_symbol_manager_get_completions_at_position
 ianjuta_symbol_manager_get_members
 ianjuta_symbol_manager_get_parents
 ianjuta_symbol_manager_search

Modified: trunk/plugins/Makefile.am
==============================================================================
--- trunk/plugins/Makefile.am	(original)
+++ trunk/plugins/Makefile.am	Wed Jan 23 14:15:46 2008
@@ -26,7 +26,6 @@
 	document-manager \
 	search \
 	valgrind \
-	sourceview \
 	language-support-cpp-java \
 	glade \
 	devhelp \
@@ -34,6 +33,7 @@
 	language-manager \
 	symbol-db
 # indent
+# sourceview
 
 ## This a temporary measure to insure anjuta does not crash due to old plugin.
 ## Make sure there are no old plugins left

Modified: trunk/plugins/build-basic-autotools/build-basic-autotools.c
==============================================================================
--- trunk/plugins/build-basic-autotools/build-basic-autotools.c	(original)
+++ trunk/plugins/build-basic-autotools/build-basic-autotools.c	Wed Jan 23 14:15:46 2008
@@ -154,7 +154,7 @@
 							  IAnjutaEditor *editor,
 							  const gchar *editor_filename)
 {
-	gint line_start, line_end;
+	IAnjutaIterable *line_start, *line_end;
 	
 	if (editor && editor_filename &&
 		IANJUTA_IS_INDICABLE (editor) &&
@@ -162,14 +162,18 @@
 		strcmp (editor_filename, loc->filename) == 0)
 	{
 		DEBUG_PRINT ("loc line: %d", loc->line);
-	
+		
 		line_start = ianjuta_editor_get_line_begin_position (editor,
 															 loc->line, NULL);
+		
 		line_end = ianjuta_editor_get_line_end_position (editor,
 														 loc->line, NULL);
 		ianjuta_indicable_set (IANJUTA_INDICABLE (editor),
 							   line_start, line_end, loc->indicator,
 							   NULL);
+		
+		g_object_unref (line_start);
+		g_object_unref (line_end);
 	}
 }
 
@@ -1894,11 +1898,12 @@
 }
 
 static void
-on_editor_changed (IAnjutaEditor *editor, gint position, gboolean added,
-				   gint length, gint lines, const gchar *text,
+on_editor_changed (IAnjutaEditor *editor, IAnjutaIterable *position,
+				   gboolean added, gint length, gint lines, const gchar *text,
 				   BasicAutotoolsPlugin *ba_plugin)
 {
-	gint line, begin_pos, end_pos;
+	gint line;
+	IAnjutaIterable *begin_pos, *end_pos;
 	if (g_hash_table_lookup (ba_plugin->editors_created,
 							 editor) == NULL)
 		return;
@@ -1911,9 +1916,11 @@
 		ianjuta_indicable_set (IANJUTA_INDICABLE (editor), begin_pos,
 							   end_pos, IANJUTA_INDICABLE_NONE, NULL);
 	}
-	DEBUG_PRINT ("Editor changed: position = %d, added = %d,"
+	DEBUG_PRINT ("Editor changed: line = %d, added = %d,"
 				 " length = %d, lines = %d, text = \'%s\'",
-				 position, added, length, lines, text);
+				 line, added, length, lines, text);
+	g_object_unref (begin_pos);
+	g_object_unref (end_pos);
 }
 
 static void

Modified: trunk/plugins/debug-manager/plugin.c
==============================================================================
--- trunk/plugins/debug-manager/plugin.c	(original)
+++ trunk/plugins/debug-manager/plugin.c	Wed Jan 23 14:15:46 2008
@@ -157,11 +157,15 @@
 		}
 		if (IANJUTA_IS_INDICABLE(editor))
 		{
-			gint begin = ianjuta_editor_get_line_begin_position(editor, self->pc_line, NULL);
-			gint end = ianjuta_editor_get_line_end_position(editor, self->pc_line, NULL);
+			IAnjutaIterable *begin =
+				ianjuta_editor_get_line_begin_position(editor, self->pc_line, NULL);
+			IAnjutaIterable *end =
+				ianjuta_editor_get_line_end_position(editor, self->pc_line, NULL);
 			
-			ianjuta_indicable_set(IANJUTA_INDICABLE(editor), begin, end, IANJUTA_INDICABLE_IMPORTANT,
-				NULL);
+			ianjuta_indicable_set(IANJUTA_INDICABLE(editor), begin, end,
+								  IANJUTA_INDICABLE_IMPORTANT, NULL);
+			g_object_unref (begin);
+			g_object_unref (end);
 		}		
 	}
 }

Modified: trunk/plugins/debug-manager/variable.c
==============================================================================
--- trunk/plugins/debug-manager/variable.c	(original)
+++ trunk/plugins/debug-manager/variable.c	Wed Jan 23 14:15:46 2008
@@ -77,16 +77,12 @@
 	/* Get selected characters if possible */
 	if (IANJUTA_IS_EDITOR_SELECTION (editor))
 	{
-		gint pos = ianjuta_iterable_get_position (iter, NULL);
-
 		/* Check if hover on selection */
 		start = ianjuta_editor_selection_get_start (IANJUTA_EDITOR_SELECTION (editor), NULL);
-		if (start && (ianjuta_iterable_get_position (start, NULL) 
-						   < pos))
+		if (start && (ianjuta_iterable_compare (start, iter, NULL) <= 0))
 		{
 			end = ianjuta_editor_selection_get_end (IANJUTA_EDITOR_SELECTION (editor), NULL);
-			if (end && (ianjuta_iterable_get_position (end, NULL) 
-							 >= pos))
+			if (end && (ianjuta_iterable_compare (end, iter, NULL) > 0))
 			{
 				/* Hover on selection, get selected characters */
 			    g_object_unref (end);
@@ -121,13 +117,10 @@
 	for (end = ianjuta_iterable_clone (iter, NULL); ianjuta_iterable_next (end, NULL);)
 	{
 		if (!is_name (ianjuta_editor_cell_get_char (IANJUTA_EDITOR_CELL (end), 0, NULL)))
-		{
-			ianjuta_iterable_previous (end, NULL);
 			break;
-		}
 	}
 
-	buf = ianjuta_editor_get_text_iter (editor, start, end, NULL);
+	buf = ianjuta_editor_get_text (editor, start, end, NULL);
 	DEBUG_PRINT("get name %s", buf == NULL ? "(null)" : buf);
 	g_object_unref (start);
 	g_object_unref (end);

Modified: trunk/plugins/document-manager/action-callbacks.c
==============================================================================
--- trunk/plugins/document-manager/action-callbacks.c	(original)
+++ trunk/plugins/document-manager/action-callbacks.c	Wed Jan 23 14:15:46 2008
@@ -341,9 +341,7 @@
 														NULL);
 			end = ianjuta_editor_selection_get_end (IANJUTA_EDITOR_SELECTION (doc), NULL);			
 			ianjuta_editor_convert_to_upper (IANJUTA_EDITOR_CONVERT (doc), 
-											 ianjuta_iterable_get_position (start, NULL),
-											 ianjuta_iterable_get_position (end, NULL),
-											 NULL);
+											 start, end, NULL);
 			g_object_unref (start);
 			g_object_unref (end);			
 		}
@@ -364,11 +362,9 @@
 			start = ianjuta_editor_selection_get_start (IANJUTA_EDITOR_SELECTION (doc), NULL);
 			end = ianjuta_editor_selection_get_end (IANJUTA_EDITOR_SELECTION (doc), NULL);			
 			ianjuta_editor_convert_to_lower (IANJUTA_EDITOR_CONVERT (doc), 
-											 ianjuta_iterable_get_position (start, NULL),
-											 ianjuta_iterable_get_position (end, NULL),
-											 NULL);
+											 start, end, NULL);
 			g_object_unref (start);
-			g_object_unref (end);			
+			g_object_unref (end);
 		}
 	}
 }

Modified: trunk/plugins/document-manager/search-box.c
==============================================================================
--- trunk/plugins/document-manager/search-box.c	(original)
+++ trunk/plugins/document-manager/search-box.c	Wed Jan 23 14:15:46 2008
@@ -250,13 +250,12 @@
 	else
 	{
 		search_start = 
-			IANJUTA_EDITOR_CELL (ianjuta_editor_get_position_iter (private->current_editor, 
-																   NULL));
+			IANJUTA_EDITOR_CELL (ianjuta_editor_get_position (private->current_editor, 
+															  NULL));
 	}
 	
-	search_end = 
-		IANJUTA_EDITOR_CELL (ianjuta_iterable_clone (IANJUTA_ITERABLE (search_start), NULL));
-	ianjuta_iterable_last (IANJUTA_ITERABLE (search_end), NULL);
+	search_end = IANJUTA_EDITOR_CELL (ianjuta_editor_get_end_position (private->current_editor, 
+																		NULL));
 	
 	if (ianjuta_editor_search_forward (IANJUTA_EDITOR_SEARCH (private->current_editor),
 									   search_text, case_sensitive,
@@ -306,14 +305,13 @@
 		return;
 	
 	search_start = 
-		IANJUTA_EDITOR_CELL (ianjuta_editor_get_position_iter (private->current_editor, 
-															   NULL));
+		IANJUTA_EDITOR_CELL (ianjuta_editor_get_position (private->current_editor, 
+														  NULL));
 	real_start =
 			ianjuta_iterable_clone (IANJUTA_ITERABLE (search_start), NULL);
 	
-	search_end = 
-		IANJUTA_EDITOR_CELL (ianjuta_iterable_clone (IANJUTA_ITERABLE (search_start), NULL));
-	ianjuta_iterable_last (IANJUTA_ITERABLE (search_end), NULL);
+	search_end = IANJUTA_EDITOR_CELL (ianjuta_editor_get_end_position (private->current_editor, 
+																	   NULL));
 	
 	selection = IANJUTA_EDITOR_SELECTION (private->current_editor);
 	
@@ -325,8 +323,8 @@
 	{
 		IAnjutaIterable* selection_start = 
 			ianjuta_editor_selection_get_start (selection, NULL);
-		if (ianjuta_iterable_get_position (IANJUTA_ITERABLE (search_start), NULL) ==
-			ianjuta_iterable_get_position (selection_start, NULL))
+		if (ianjuta_iterable_compare (IANJUTA_ITERABLE (search_start),
+									  selection_start, NULL) == 0)
 		{
 			gchar* selected_text =
 				ianjuta_editor_selection_get (selection, NULL);
@@ -371,8 +369,8 @@
 										   &result_start,
 										   &result_end, NULL))
 		{
-			if (ianjuta_iterable_get_position (IANJUTA_ITERABLE (result_start), NULL)
-				!= ianjuta_iterable_get_position (real_start, NULL))
+			if (ianjuta_iterable_compare (IANJUTA_ITERABLE (result_start),
+										  real_start, NULL) != 0)
 			{
 				found = TRUE;
 				anjuta_status_push (private->status, 

Modified: trunk/plugins/editor/text-editor-iterable.c
==============================================================================
--- trunk/plugins/editor/text-editor-iterable.c	(original)
+++ trunk/plugins/editor/text-editor-iterable.c	Wed Jan 23 14:15:46 2008
@@ -391,12 +391,12 @@
 }
 
 static IAnjutaEditorAttribute
-icell_get_attribute (IAnjutaEditorCell *cell, GError **e)
+icell_get_attribute (IAnjutaEditorCell *icell, GError **e)
 {
+	TextEditorCell* cell = TEXT_EDITOR_CELL(icell);
 	IAnjutaEditorAttribute attrib = IANJUTA_EDITOR_TEXT;
 	TextEditorAttrib text_attrib =
-		text_editor_get_attribute (TEXT_EDITOR_CELL (cell)->priv->editor,
-								   TEXT_EDITOR_CELL (cell)->priv->position);
+		text_editor_get_attribute (cell->priv->editor, cell->priv->position);
 	switch (text_attrib)
 	{
 		case TEXT_EDITOR_ATTRIB_TEXT:
@@ -530,11 +530,9 @@
 iiter_last (IAnjutaIterable* iter, GError** e)
 {
 	TextEditorCell* cell = TEXT_EDITOR_CELL(iter);
-	gint length;
-	
-	length = ianjuta_editor_get_length (IANJUTA_EDITOR (cell->priv->editor),
-										NULL);
-	text_editor_cell_set_position (TEXT_EDITOR_CELL (iter), length);
+	cell->priv->position =
+		scintilla_send_message (SCINTILLA (cell->priv->editor->scintilla),
+								SCI_GETLENGTH, 0, 0);
 	return TRUE;
 }
 
@@ -560,11 +558,18 @@
 iiter_set_position (IAnjutaIterable* iter, gint position, GError** e)
 {
 	gint i;
-	gint old_byte_position, new_byte_position;
+	gboolean within_range = TRUE;
+	gint old_byte_position = 0, new_byte_position = 0;
 	TextEditorCell* cell = TEXT_EDITOR_CELL(iter);
 	
 	if (position < 0)
-		return FALSE;
+	{
+		/* Set to end-iter (length of the doc) */
+		cell->priv->position =
+			scintilla_send_message (SCINTILLA (cell->priv->editor->scintilla),
+									SCI_GETLENGTH, 0, 0);
+		return within_range;
+	}
 	
 	/* FIXME: Find more optimal solution */
 	/* Iterate untill the we reach given character position */
@@ -576,12 +581,16 @@
 									SCI_POSITIONAFTER, old_byte_position, 0);	
 		if (old_byte_position == new_byte_position)
 		{
-			/* Out of range. Don't set anything */
-			return FALSE;
+			/* Out of range. set to end-iter */
+			DEBUG_PRINT ("Out of range: setting pos at %d", new_byte_position);
+			within_range = FALSE;
+			break;
 		}
+		old_byte_position = new_byte_position;
 	}
 	cell->priv->position = new_byte_position;
-	return TRUE;
+	DEBUG_PRINT ("Editor byte position set at: %d", cell->priv->position);
+	return within_range;
 }
 
 static gint
@@ -602,6 +611,8 @@
 		char_position = g_utf8_strlen (data, -1);
 		g_free (data);
 	}
+	DEBUG_PRINT ("Byte pos = %d, char position = %d", cell->priv->position,
+				 char_position);
 	return char_position;
 }
 
@@ -614,11 +625,9 @@
 	TextEditorCell* cell = TEXT_EDITOR_CELL(iter);
 	
 	/* FIXME: Find a more optimal solution */
-	data =
-		(gchar *) aneditor_command (TEXT_EDITOR
-									(cell->priv->editor)->editor_id,
-									ANE_GETTEXTRANGE, 0,
-									-1);
+	data = (gchar *) aneditor_command (TEXT_EDITOR
+									   (cell->priv->editor)->editor_id,
+									   ANE_GETTEXTRANGE, 0, -1);
 	length = g_utf8_strlen (data, -1);
 	g_free (data);
 	return length;
@@ -642,6 +651,55 @@
 	cell->priv->position = src->priv->position;
 }
 
+static gint
+iiter_compare (IAnjutaIterable *iter, IAnjutaIterable *iter2, GError **e)
+{
+	gint delta;
+	TextEditorCell *cell = TEXT_EDITOR_CELL (iter);
+	TextEditorCell *cell2 = TEXT_EDITOR_CELL (iter2);
+	delta = cell->priv->position - cell2->priv->position;
+	return (delta == 0)? 0 : ((delta > 0)? 1 : -1);
+}
+
+static gint
+iiter_diff (IAnjutaIterable *iter, IAnjutaIterable *iter2, GError **e)
+{
+	gint diff = 0;
+	TextEditorCell *cell = TEXT_EDITOR_CELL (iter);
+	TextEditorCell *cell2 = TEXT_EDITOR_CELL (iter2);
+	
+	if (cell->priv->position == cell2->priv->position)
+	{
+		return 0;
+	}
+	
+	/* FIXME: Find more optimal solution */
+	/* Iterate until we reach larger iter position */
+	if (cell->priv->position > cell2->priv->position)
+	{
+		gint byte_position = cell2->priv->position;
+		while (byte_position < cell->priv->position)
+		{
+			byte_position =
+				scintilla_send_message (SCINTILLA (cell->priv->editor->scintilla),
+										SCI_POSITIONAFTER, byte_position, 0);
+			diff--;
+		}
+	}
+	else
+	{
+		gint byte_position = cell->priv->position;
+		while (byte_position < cell2->priv->position)
+		{
+			byte_position =
+				scintilla_send_message (SCINTILLA (cell->priv->editor->scintilla),
+										SCI_POSITIONAFTER, byte_position, 0);
+			diff++;
+		}
+	}
+	return diff;
+}
+
 static void
 iiter_iface_init(IAnjutaIterableIface* iface)
 {
@@ -655,6 +713,8 @@
 	iface->get_length = iiter_get_length;
 	iface->clone = iiter_clone;
 	iface->assign = iiter_assign;
+	iface->compare = iiter_compare;
+	iface->diff = iiter_diff;
 }
 
 ANJUTA_TYPE_BEGIN(TextEditorCell, text_editor_cell, G_TYPE_OBJECT);

Modified: trunk/plugins/editor/text_editor.c
==============================================================================
--- trunk/plugins/editor/text_editor.c	(original)
+++ trunk/plugins/editor/text_editor.c	Wed Jan 23 14:15:46 2008
@@ -1,4 +1,4 @@
- /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * text_editor.c
  * Copyright (C) 2000 - 2004  Naba Kumar
@@ -798,6 +798,17 @@
 }
 
 guint
+text_editor_get_position_lineno (TextEditor * te, gint position)
+{
+	guint count;
+	g_return_val_if_fail (te != NULL, 0);
+
+	count =	scintilla_send_message (SCINTILLA (te->scintilla),
+					SCI_LINEFROMPOSITION, position, 0);
+	return linenum_scintilla_to_text_editor(count);
+}
+
+guint
 text_editor_get_current_column (TextEditor * te)
 {
 	g_return_val_if_fail (te != NULL, 0);
@@ -844,8 +855,7 @@
 	g_return_val_if_fail (te != NULL, FALSE);
 	g_return_val_if_fail(IS_SCINTILLA (te->scintilla) == TRUE, FALSE);
 
-	scintilla_send_message (SCINTILLA (te->scintilla), SCI_GOTOPOS,
-				point, 0);
+	scintilla_send_message (SCINTILLA (te->scintilla), SCI_GOTOPOS, point, 0);
 	return TRUE;
 }
 
@@ -2231,72 +2241,62 @@
 }
 
 static void
-itext_editor_goto_position (IAnjutaEditor *editor, gint position, GError **e)
+itext_editor_goto_start (IAnjutaEditor *editor, GError **e)
 {
-	text_editor_goto_point (TEXT_EDITOR (editor), position);
+	text_editor_goto_point (TEXT_EDITOR (editor), 0);
 }
 
-static gchar*
-itext_editor_get_text (IAnjutaEditor *editor, gint position, gint length,
-					   GError **e)
+static void
+itext_editor_goto_end (IAnjutaEditor *editor, GError **e)
 {
-	gchar *data;
-	gint end;
-	TextEditor *te = TEXT_EDITOR (editor);
-
-	g_return_val_if_fail (position >= 0, NULL);
-	if (length == 0)
-		return NULL;
+	text_editor_goto_point (TEXT_EDITOR (editor), -1);
+}
 
-	if (length < 0)
-		end = scintilla_send_message (SCINTILLA (te->scintilla),
-									  SCI_GETLENGTH, 0, 0);
-	else
-		end = position + length;
-	
-	/* Silently correct length like stated in the docs #506740 */
-	if (end > ianjuta_editor_get_length (editor, NULL))
-		end = -1;
+static void
+itext_editor_goto_position (IAnjutaEditor *editor, IAnjutaIterable *position,
+							GError **e)
+{
+	text_editor_goto_point (TEXT_EDITOR (editor),
+							text_editor_cell_get_position (TEXT_EDITOR_CELL
+														   (position)));
+}
 
-	data =	(gchar *) aneditor_command (te->editor_id,
-										ANE_GETTEXTRANGE, position, end);
-	return data;
+static gchar*
+itext_editor_get_text_all (IAnjutaEditor *editor, GError **e)
+{
+	TextEditor *te = TEXT_EDITOR (editor);
+	return (gchar *) aneditor_command (te->editor_id, ANE_GETTEXTRANGE, 0, -1);
 }
 
 static gchar*
-itext_editor_get_text_iter (IAnjutaEditor *editor, 
-							IAnjutaIterable* begin,
-							IAnjutaIterable* end,
-							GError **e)
+itext_editor_get_text (IAnjutaEditor *editor, IAnjutaIterable* begin,
+					   IAnjutaIterable* end, GError **e)
 {
 	gchar *data;
 	gint start_pos = text_editor_cell_get_position (TEXT_EDITOR_CELL (begin));
 	gint end_pos = text_editor_cell_get_position (TEXT_EDITOR_CELL (end));
-	gint after_end_pos; 
 	TextEditor *te = TEXT_EDITOR (editor);
-
-	/* get_text_iter includes the character at end in the range while 
-	 * ANE_GETTEXTRANGE excludes it. look for the character following end */
-	after_end_pos = scintilla_send_message (SCINTILLA ( te->scintilla), SCI_POSITIONAFTER, end_pos, 0);
-	if (after_end_pos == end_pos)
-	       	after_end_pos = -1; /* Reach end of buffer, Get all remain */
-
-	data =	(gchar *) aneditor_command (te->editor_id, ANE_GETTEXTRANGE, start_pos, after_end_pos);
+	data =	(gchar *) aneditor_command (te->editor_id, ANE_GETTEXTRANGE, start_pos, end_pos);
 	return data;
 }
 
-static gint
-itext_editor_get_position (IAnjutaEditor *editor, GError **e)
+static IAnjutaIterable*
+itext_editor_get_position (IAnjutaEditor* editor, GError **e)
 {
-	return text_editor_get_current_position (TEXT_EDITOR(editor));
+	TextEditor *te = TEXT_EDITOR (editor);
+	gint position = text_editor_get_current_position (te);
+	TextEditorCell *position_iter = text_editor_cell_new (te, position);
+	return IANJUTA_ITERABLE (position_iter);
 }
 
-static IAnjutaIterable*
-itext_editor_get_position_iter (IAnjutaEditor* editor, GError **e)
+static gint
+itext_editor_get_offset (IAnjutaEditor *editor, GError **e)
 {
-	TextEditor* te = TEXT_EDITOR (editor);
-	return IANJUTA_ITERABLE (text_editor_cell_new (te,
-												   text_editor_get_current_position (te)));
+	gint pos;
+	IAnjutaIterable *iter = itext_editor_get_position (editor, NULL);
+	pos = ianjuta_iterable_get_position (iter, NULL);
+	g_object_unref (iter);
+	return pos;
 }
 
 static gint
@@ -2308,8 +2308,15 @@
 static gint
 itext_editor_get_length (IAnjutaEditor *editor, GError **e)
 {
-	return aneditor_command (TEXT_EDITOR (editor)->editor_id,
-							 ANE_GETLENGTH, 0, 0);
+	/* FIXME: Find a more optimal solution */
+	gint char_position;
+	gchar *data =
+		(gchar *) aneditor_command (TEXT_EDITOR (editor)->editor_id,
+									ANE_GETTEXTRANGE, 0,
+									-1);
+	char_position = g_utf8_strlen (data, -1);
+	g_free (data);
+	return char_position;
 }
 
 static gchar*
@@ -2326,8 +2333,8 @@
 }
 
 static void
-itext_editor_insert (IAnjutaEditor *editor, gint pos, const gchar *txt,
-					 gint length, GError **e)
+itext_editor_insert (IAnjutaEditor *editor, IAnjutaIterable *position,
+					 const gchar *txt, gint length, GError **e)
 {
 	gchar *text_to_insert;
 	if (length >= 0)
@@ -2336,7 +2343,9 @@
 		text_to_insert = g_strdup (txt);
 	
 	aneditor_command (TEXT_EDITOR(editor)->editor_id, ANE_INSERTTEXT,
-					  pos, (long)text_to_insert);
+					  text_editor_cell_get_position
+					  (TEXT_EDITOR_CELL (position)),
+					  (long)text_to_insert);
 	g_free (text_to_insert);
 }
 
@@ -2357,87 +2366,128 @@
 }
 
 static void
-itext_editor_erase (IAnjutaEditor *editor, gint position, gint length,
-					GError **e)
+itext_editor_erase (IAnjutaEditor *editor,
+					IAnjutaIterable *position_start,
+					IAnjutaIterable *position_end, GError **e)
 {
-	gint end;
-
-	g_return_if_fail (position >= 0);
-	if (length == 0)
+	gint start, end;
+	
+	/* If both positions are NULL, erase all */
+	if (position_start == NULL && position_end == NULL)
+	{
+		scintilla_send_message (SCINTILLA (TEXT_EDITOR (editor)->scintilla), 
+								SCI_CLEARALL,
+								0, 0);
 		return;
-
-	if (length < 0)
+	}
+	
+	/* Determine correct start and end byte positions */
+	if (position_start)
+		start = text_editor_cell_get_position (TEXT_EDITOR_CELL (position_start));
+	else
+		start = 0;
+	
+	if (position_end)
+		end = text_editor_cell_get_position (TEXT_EDITOR_CELL (position_end));
+	else
 		end = scintilla_send_message (SCINTILLA (TEXT_EDITOR (editor)->scintilla),
 									  SCI_GETLENGTH, 0, 0);
-	else
-		end = position + length;
-
-	scintilla_send_message (SCINTILLA(TEXT_EDITOR (editor)->scintilla),
-						    SCI_SETSEL, position, end);
-	text_editor_replace_selection (TEXT_EDITOR (editor), "");
+	if (start != end)
+	{
+		scintilla_send_message (SCINTILLA(TEXT_EDITOR (editor)->scintilla),
+								SCI_SETSEL, start, end);
+		text_editor_replace_selection (TEXT_EDITOR (editor), "");
+	}
 }
 
 static void
 itext_editor_erase_all (IAnjutaEditor *editor, GError **e)
 {
-	scintilla_send_message (SCINTILLA (TEXT_EDITOR (editor)->scintilla), SCI_CLEARALL,
+	scintilla_send_message (SCINTILLA (TEXT_EDITOR (editor)->scintilla), 
+							SCI_CLEARALL,
 							0, 0);
 }
 
 static int
-itext_editor_get_column(IAnjutaEditor *editor, GError **e)
+itext_editor_get_column (IAnjutaEditor *editor, GError **e)
 {
-	return text_editor_get_current_column(TEXT_EDITOR(editor));
+	return text_editor_get_current_column (TEXT_EDITOR(editor));
 }
 
 static gboolean
-itext_editor_get_overwrite(IAnjutaEditor *editor, GError **e)
+itext_editor_get_overwrite (IAnjutaEditor *editor, GError **e)
 {
-	return text_editor_get_overwrite(TEXT_EDITOR(editor));
+	return text_editor_get_overwrite (TEXT_EDITOR (editor));
 }
 
 static void
-itext_editor_set_popup_menu(IAnjutaEditor *editor, GtkWidget* menu, GError **e)
+itext_editor_set_popup_menu (IAnjutaEditor *editor, GtkWidget* menu, GError **e)
 {
-	text_editor_set_popup_menu(TEXT_EDITOR(editor), menu);
+	text_editor_set_popup_menu (TEXT_EDITOR (editor), menu);
 }
 
 static gint
-itext_editor_get_line_from_position (IAnjutaEditor *editor, gint pos, GError **e)
+itext_editor_get_line_from_position (IAnjutaEditor *editor,
+									 IAnjutaIterable *position, GError **e)
 {
-	return text_editor_get_line_from_position (TEXT_EDITOR (editor), pos);
+	return text_editor_get_line_from_position (TEXT_EDITOR (editor),
+				text_editor_cell_get_position (TEXT_EDITOR_CELL (position)));
 }
 
-static gint
+static IAnjutaIterable*
 itext_editor_get_line_begin_position (IAnjutaEditor *editor, gint line,
 									  GError **e)
 {
-	gint ln;
-	
-	g_return_val_if_fail (line > 0, -1);
+	gint ln, byte_pos;
+	TextEditor *te;
 	
+	g_return_val_if_fail (line > 0, NULL);
+	te = TEXT_EDITOR (editor);
 	ln = linenum_text_editor_to_scintilla (line);
-	return scintilla_send_message (SCINTILLA (TEXT_EDITOR (editor)->scintilla),
+	byte_pos = scintilla_send_message (SCINTILLA (te->scintilla),
 								   SCI_POSITIONFROMLINE, ln, 0);
+	return IANJUTA_ITERABLE (text_editor_cell_new (te, byte_pos));
 }
 
-static gint
+static IAnjutaIterable*
 itext_editor_get_line_end_position (IAnjutaEditor *editor, gint line,
 									  GError **e)
 {
-	gint ln;
+	gint ln, byte_pos;
+	TextEditor *te;
 	
-	g_return_val_if_fail (line > 0, -1);
+	g_return_val_if_fail (line > 0, NULL);
+	te = TEXT_EDITOR (editor);
 	
 	ln = linenum_text_editor_to_scintilla (line);
-	return scintilla_send_message (SCINTILLA (TEXT_EDITOR (editor)->scintilla),
+	byte_pos = scintilla_send_message (SCINTILLA (te->scintilla),
 								   SCI_GETLINEENDPOSITION, ln, 0);
+	return IANJUTA_ITERABLE (text_editor_cell_new (te, byte_pos));
+}
+
+static IAnjutaIterable*
+itext_editor_get_position_from_offset (IAnjutaEditor *editor, gint offset, GError **e)
+{
+	TextEditorCell *editor_cell = text_editor_cell_new (TEXT_EDITOR (editor), 0);
+	/* Set to the right utf8 character offset */
+	ianjuta_iterable_set_position (IANJUTA_ITERABLE (editor_cell), offset, NULL);
+	return IANJUTA_ITERABLE (editor_cell);
+}
+
+static IAnjutaIterable*
+itext_editor_get_start_position (IAnjutaEditor *editor, GError **e)
+{
+	TextEditorCell *editor_cell = text_editor_cell_new (TEXT_EDITOR (editor), 0);
+	return IANJUTA_ITERABLE (editor_cell);
 }
 
 static IAnjutaIterable*
-itext_editor_get_cell_iter (IAnjutaEditor *editor, gint position, GError **e)
+itext_editor_get_end_position (IAnjutaEditor *editor, GError **e)
 {
-	TextEditorCell *editor_cell = text_editor_cell_new (TEXT_EDITOR (editor), position);
+	gint length = scintilla_send_message (SCINTILLA (TEXT_EDITOR (editor)->scintilla),
+										  SCI_GETLENGTH, 0, 0);
+	TextEditorCell *editor_cell = text_editor_cell_new (TEXT_EDITOR (editor),
+														length);
 	return IANJUTA_ITERABLE (editor_cell);
 }
 
@@ -2450,11 +2500,13 @@
 	iface->set_use_spaces = itext_editor_set_use_spaces;
 	iface->set_auto_indent = itext_editor_set_auto_indent;	
 	iface->goto_line = itext_editor_goto_line;
+	iface->goto_start = itext_editor_goto_start;
+	iface->goto_end = itext_editor_goto_end;
 	iface->goto_position = itext_editor_goto_position;
+	iface->get_text_all = itext_editor_get_text_all;
 	iface->get_text = itext_editor_get_text;
-	iface->get_text_iter = itext_editor_get_text_iter;	
+	iface->get_offset = itext_editor_get_offset;
 	iface->get_position = itext_editor_get_position;
-	iface->get_position_iter = itext_editor_get_position_iter;
 	iface->get_lineno = itext_editor_get_lineno;
 	iface->get_length = itext_editor_get_length;
 	iface->get_current_word = itext_editor_get_current_word;
@@ -2468,7 +2520,9 @@
 	iface->get_line_from_position = itext_editor_get_line_from_position;
 	iface->get_line_begin_position = itext_editor_get_line_begin_position;
 	iface->get_line_end_position = itext_editor_get_line_end_position;
-	iface->get_cell_iter = itext_editor_get_cell_iter;
+	iface->get_position_from_offset = itext_editor_get_position_from_offset;
+	iface->get_start_position = itext_editor_get_start_position;
+	iface->get_end_position = itext_editor_get_end_position;
 }
 
 static const gchar *
@@ -2913,21 +2967,27 @@
 /* IAnjutaEditorConvert implementation */
 
 static void
-iconvert_to_upper(IAnjutaEditorConvert* te, gint start_position,
-				  gint end_position, GError** ee)
+iconvert_to_upper (IAnjutaEditorConvert* te, IAnjutaIterable *start_position,
+				   IAnjutaIterable *end_position, GError** ee)
 {
+	gint start, end;
+	start = text_editor_cell_get_position (TEXT_EDITOR_CELL (start_position));
+	end = text_editor_cell_get_position (TEXT_EDITOR_CELL (end_position));
 	scintilla_send_message (SCINTILLA (TEXT_EDITOR(te)->scintilla),
-						   SCI_SETSEL, start_position, end_position);
+							SCI_SETSEL, start, end);
 	text_editor_command (TEXT_EDITOR(te), ANE_UPRCASE, 0, 0);
 }
 
 static void
-iconvert_to_lower(IAnjutaEditorConvert* te, gint start_position,
-				  gint end_position, GError** ee)
+iconvert_to_lower(IAnjutaEditorConvert* te, IAnjutaIterable *start_position,
+				  IAnjutaIterable *end_position, GError** ee)
 {
+	gint start, end;
+	start = text_editor_cell_get_position (TEXT_EDITOR_CELL (start_position));
+	end = text_editor_cell_get_position (TEXT_EDITOR_CELL (end_position));
 	scintilla_send_message (SCINTILLA (TEXT_EDITOR(te)->scintilla),
-						   SCI_SETSEL, start_position, end_position);
-	text_editor_command (TEXT_EDITOR(te), ANE_LWRCASE, 0, 0);	
+							SCI_SETSEL, start, end);
+	text_editor_command (TEXT_EDITOR (te), ANE_LWRCASE, 0, 0);	
 }
 
 static void
@@ -3040,7 +3100,7 @@
 
 static void
 iassist_suggest (IAnjutaEditorAssist *iassist, GList* choices,
-				 gint position, int char_alignment, GError **err)
+				 IAnjutaIterable *position, int char_alignment, GError **err)
 {
 	GString *words;
 	GList *choice;
@@ -3100,7 +3160,7 @@
 
 static void 
 iassist_show_tips (IAnjutaEditorAssist *iassist, GList* tips,
-				   gint position, gint char_alignment, GError **err)
+				   IAnjutaIterable *position, gint char_alignment, GError **err)
 {
 	gint lineno, cur_pos, cur_col, real_pos, real_col;
 	GString *calltip;
@@ -3287,31 +3347,29 @@
 }
 
 static void
-iindicable_set (IAnjutaIndicable *te, gint begin_location, gint end_location,
+iindicable_set (IAnjutaIndicable *te, IAnjutaIterable *begin_location,
+				IAnjutaIterable *end_location,
 				IAnjutaIndicableIndicator indicator, GError **err)
 {
+	gint begin = text_editor_cell_get_position (TEXT_EDITOR_CELL (begin_location));
+	gint end = text_editor_cell_get_position (TEXT_EDITOR_CELL (end_location));
 	switch (indicator)
 	{
 		case IANJUTA_INDICABLE_NONE:
-			text_editor_set_indicator (TEXT_EDITOR (te), begin_location,
-									   end_location, -1);
+			text_editor_set_indicator (TEXT_EDITOR (te), begin, end, -1);
 		break;
 		case IANJUTA_INDICABLE_IMPORTANT:
-			text_editor_set_indicator (TEXT_EDITOR (te), begin_location,
-									   end_location, 0);
+			text_editor_set_indicator (TEXT_EDITOR (te), begin, end, 0);
 		break;
 		case IANJUTA_INDICABLE_WARNING:
-			text_editor_set_indicator (TEXT_EDITOR (te), begin_location,
-									   end_location, 1);
+			text_editor_set_indicator (TEXT_EDITOR (te),  begin, end, 1);
 		break;
 		case IANJUTA_INDICABLE_CRITICAL:
-			text_editor_set_indicator (TEXT_EDITOR (te), begin_location,
-									   end_location, 2);
+			text_editor_set_indicator (TEXT_EDITOR (te),  begin, end, 2);
 		break;
 		default:
 			g_warning ("Unsupported indicator %d", indicator);
-			text_editor_set_indicator (TEXT_EDITOR (te), begin_location,
-									   end_location, -1);
+			text_editor_set_indicator (TEXT_EDITOR (te),  begin, end, -1);
 		break;
 	}
 }

Modified: trunk/plugins/editor/text_editor.h
==============================================================================
--- trunk/plugins/editor/text_editor.h	(original)
+++ trunk/plugins/editor/text_editor.h	Wed Jan 23 14:15:46 2008
@@ -176,6 +176,7 @@
 guint    text_editor_get_total_lines (TextEditor * te);
 glong    text_editor_get_current_position (TextEditor * te);
 guint    text_editor_get_current_lineno (TextEditor * te);
+guint    text_editor_get_position_lineno (TextEditor * te, gint position);
 guint    text_editor_get_current_column (TextEditor * te);
 guint    text_editor_get_line_from_position (TextEditor * te, glong pos);
 gchar*   text_editor_get_selection (TextEditor * te);

Modified: trunk/plugins/editor/text_editor_cbs.c
==============================================================================
--- trunk/plugins/editor/text_editor_cbs.c	(original)
+++ trunk/plugins/editor/text_editor_cbs.c	Wed Jan 23 14:15:46 2008
@@ -173,11 +173,14 @@
 		return;
 		
 	case SCN_CHARADDED:
-		te->current_line = text_editor_get_current_lineno (te);
-		position = text_editor_get_current_position (te) - 1;
-		g_signal_emit_by_name(G_OBJECT (te), "char_added", position,
-							  (gchar)nt->ch);
-		
+		{
+			position = text_editor_get_current_position (te) - 1;
+			TextEditorCell *position_iter = text_editor_cell_new (te, position);
+			te->current_line = text_editor_get_current_lineno (te);
+			g_signal_emit_by_name(G_OBJECT (te), "char-added", position_iter,
+								  (gchar)nt->ch);
+			g_object_unref (position_iter);
+		}
 		return;
 	case SCN_AUTOCSELECTION:
 	case SCN_USERLISTSELECTION:
@@ -191,10 +194,13 @@
 	case SCN_MODIFIED:
 		if (nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT))
 		{
+			TextEditorCell *position_iter =
+					text_editor_cell_new (te, nt->position);
 			gboolean added = nt->modificationType & SC_MOD_INSERTTEXT;
-			g_signal_emit_by_name (G_OBJECT (te), "changed", nt->position,
+			g_signal_emit_by_name (G_OBJECT (te), "changed", position_iter,
 								   added, nt->length, nt->linesAdded,
 								   nt->text);
+			g_object_unref (position_iter);
 		}
 		return;
 	case SCN_MARGINCLICK:

Modified: trunk/plugins/indent/plugin.c
==============================================================================
--- trunk/plugins/indent/plugin.c	(original)
+++ trunk/plugins/indent/plugin.c	Wed Jan 23 14:15:46 2008
@@ -143,7 +143,7 @@
 		DEBUG_PRINT ("Could not execute: %s", cmd);
 	}
 	
-	text = ianjuta_editor_get_text(plugin->current_editor, 0, -1, NULL);
+	text = ianjuta_editor_get_text_all (plugin->current_editor, NULL);
 	anjuta_launcher_set_terminal_echo (launcher, TRUE);
 	anjuta_launcher_send_stdin (launcher, text);
 	anjuta_launcher_send_stdin_eof (launcher);

Modified: trunk/plugins/language-support-cpp-java/cpp-java-assist.c
==============================================================================
--- trunk/plugins/language-support-cpp-java/cpp-java-assist.c	(original)
+++ trunk/plugins/language-support-cpp-java/cpp-java-assist.c	Wed Jan 23 14:15:46 2008
@@ -179,6 +179,8 @@
 	gboolean scope_chars_found = FALSE;
 	
 	end = ianjuta_iterable_clone (iter, NULL);
+	ianjuta_iterable_next (end, NULL);
+	
 	ch = ianjuta_editor_cell_get_char (IANJUTA_EDITOR_CELL (iter), 0, NULL);
 	
 	while (ch && is_scope_context_character (ch))
@@ -197,7 +199,7 @@
 		begin = ianjuta_iterable_clone (iter, NULL);
 		if (!out_of_range)
 			ianjuta_iterable_next (begin, NULL);
-		scope_chars = ianjuta_editor_get_text_iter (editor, begin, end, NULL);
+		scope_chars = ianjuta_editor_get_text (editor, begin, end, NULL);
 		g_object_unref (begin);
 	}
 	g_object_unref (end);
@@ -213,6 +215,8 @@
 	gboolean preword_found = TRUE;
 	
 	end = ianjuta_iterable_clone (iter, NULL);
+	ianjuta_iterable_next (end, NULL);
+
 	ch = ianjuta_editor_cell_get_char (IANJUTA_EDITOR_CELL (iter), 0, NULL);
 	
 	while (ch && is_word_character (ch))
@@ -231,7 +235,7 @@
 		IAnjutaIterable *begin = ianjuta_iterable_clone (iter, NULL);
 		if (!out_of_range)
 			ianjuta_iterable_next (begin, NULL);
-		preword_chars = ianjuta_editor_get_text_iter (editor, begin, end, NULL);
+		preword_chars = ianjuta_editor_get_text (editor, begin, end, NULL);
 		g_object_unref (begin);
 	}
 	g_object_unref (end);
@@ -347,7 +351,8 @@
 cpp_java_assist_show_autocomplete (CppJavaAssist *assist,
 								   const gchar *pre_word)
 {
-	gint position, max_completions, length;
+	IAnjutaIterable *position;
+	gint max_completions, length;
 	GList *completion_list;
 
 	if (assist->priv->completion_cache == NULL) return FALSE;	
@@ -417,6 +422,7 @@
 			return TRUE;
 		}
 	}
+	g_object_unref (position);
 	return FALSE;
 }
 
@@ -529,7 +535,6 @@
 		if (tips)
 		{
 			/* Calculate calltip offset from context offset */
-			gint position = ianjuta_iterable_get_position (position_iter, NULL);
 			gint char_alignment =
 				get_iter_column (assist, position_iter)- context_offset;
 			
@@ -537,7 +542,7 @@
 				char_alignment = context_offset;
 			
 			ianjuta_editor_assist_show_tips (assist->priv->iassist, tips,
-											 position + 1, char_alignment,
+											 position_iter, char_alignment,
 											 NULL);
 			g_list_foreach (tips, (GFunc) g_free, NULL);
 			g_list_free (tips);
@@ -551,7 +556,6 @@
 cpp_java_assist_check (CppJavaAssist *assist, gboolean autocomplete,
 					   gboolean calltips)
 {
-	gint position;
 	gboolean shown = FALSE;
 	IAnjutaEditor *editor;
 	IAnjutaIterable *iter, *iter_save;
@@ -569,8 +573,7 @@
 	
 	editor = IANJUTA_EDITOR (assist->priv->iassist);
 	
-	position = ianjuta_editor_get_position (editor, NULL);
-	iter = ianjuta_editor_get_cell_iter (editor, position, NULL);
+	iter = ianjuta_editor_get_position (editor, NULL);
 	ianjuta_iterable_previous (iter, NULL);
 	iter_save = ianjuta_iterable_clone (iter, NULL);
 	
@@ -676,8 +679,8 @@
 }
 
 static void
-on_editor_char_added (IAnjutaEditor *editor, gint insert_pos, gchar ch,
-					  CppJavaAssist *assist)
+on_editor_char_added (IAnjutaEditor *editor, IAnjutaIterable *insert_pos,
+					  gchar ch, CppJavaAssist *assist)
 {
 	gboolean enable_complete =
 		anjuta_preferences_get_int_with_default (assist->priv->preferences,
@@ -696,7 +699,7 @@
 				  CppJavaAssist* assist)
 {
 	CppJavaAssistTag *tag;
-	gint cur_pos;
+	IAnjutaIterable *cur_pos;
 	GString *assistance;
 	IAnjutaEditor *te;
 	IAnjutaIterable *iter;
@@ -734,7 +737,7 @@
 	
 	te = IANJUTA_EDITOR (assist->priv->iassist);
 	cur_pos = ianjuta_editor_get_position (te, NULL);
-	iter = ianjuta_editor_get_cell_iter (te, cur_pos, NULL);
+	iter = ianjuta_iterable_clone (cur_pos, NULL);
 	
 	if (ianjuta_iterable_previous (iter, NULL))
 	{
@@ -744,14 +747,11 @@
 	ianjuta_document_begin_undo_action (IANJUTA_DOCUMENT (te), NULL);
 	if (pre_word)
 	{
-		IAnjutaIterable *cursor_iter =
-			ianjuta_editor_get_cell_iter (te, cur_pos, NULL);
 		ianjuta_iterable_next (iter, NULL);
 		ianjuta_editor_selection_set (IANJUTA_EDITOR_SELECTION (te),
-									  iter, cursor_iter, NULL);
+									  iter, cur_pos, NULL);
 		ianjuta_editor_selection_replace (IANJUTA_EDITOR_SELECTION (te),
 										  assistance->str, -1, NULL);
-		g_object_unref (cursor_iter);
 		g_free (pre_word);
 	}
 	else
@@ -759,6 +759,7 @@
 		ianjuta_editor_insert (te, cur_pos, assistance->str, -1, NULL);
 	}
 	g_object_unref (iter);
+	g_object_unref (cur_pos);
 
 	ianjuta_document_end_undo_action (IANJUTA_DOCUMENT (te), NULL);
 	

Modified: trunk/plugins/language-support-cpp-java/plugin.c
==============================================================================
--- trunk/plugins/language-support-cpp-java/plugin.c	(original)
+++ trunk/plugins/language-support-cpp-java/plugin.c	Wed Jan 23 14:15:46 2008
@@ -135,7 +135,7 @@
 static gint
 get_line_indentation (IAnjutaEditor *editor, gint line_num)
 {
-	gint line_begin, line_end;
+	IAnjutaIterable *line_begin, *line_end;
 	gchar *line_string, *idx;
 	gint line_indent = 0;
 	
@@ -145,11 +145,18 @@
 	DEBUG_PRINT ("%s: line begin = %d, line end = %d", __FUNCTION__,
 				 line_begin, line_end);
 	*/
-	if (line_begin == line_end)
+	if (ianjuta_iterable_compare (line_begin, line_end, NULL) == 0)
+	{
+		g_object_unref (line_begin);
+		g_object_unref (line_end);
 		return 0;
+	}
+	
+	line_string = ianjuta_editor_get_text (editor, line_begin, line_end,
+												NULL);
+	g_object_unref (line_begin);
+	g_object_unref (line_end);
 	
-	line_string = ianjuta_editor_get_text (editor, line_begin,
-										   line_end - line_begin, NULL);
 	/* DEBUG_PRINT ("line_string = '%s'", line_string); */
 	
 	if (!line_string)
@@ -165,7 +172,7 @@
 		else
 			line_indent++;
 		idx++; /* Since we are looking for first non-space char, simple
-	            * increment of the chars would do */
+	            * increment of the utf8 chars would do */
 	}
 	g_free (line_string);
 	return line_indent;
@@ -274,9 +281,7 @@
 	{
 		/*
 		DEBUG_PRINT ("Line %d is continuation line .. Skipping",
-					 ianjuta_editor_get_line_from_position
-						(editor, ianjuta_iterable_get_position (iter, NULL),
-						 NULL));
+					 ianjuta_editor_get_line_from_position (editor, iter, NULL));
 		*/
 		found = skip_iter_to_previous_line (editor, iter);
 		if (!found)
@@ -284,17 +289,13 @@
 	}
 	/*
 	DEBUG_PRINT ("Line %d is *not* continuation line .. Breaking",
-				 ianjuta_editor_get_line_from_position
-					(editor, ianjuta_iterable_get_position (iter, NULL),
-					 NULL));
+				 ianjuta_editor_get_line_from_position (editor, iter, NULL));
 	*/
 	if (found)
 		found = skip_iter_to_previous_line (editor, iter);
 	/*
 	DEBUG_PRINT ("Line %d is next logical line",
-				 ianjuta_editor_get_line_from_position
-					(editor, ianjuta_iterable_get_position (iter, NULL),
-					 NULL));
+				 ianjuta_editor_get_line_from_position (editor, iter, NULL));
 	*/
 	return found;
 }
@@ -372,8 +373,7 @@
 				/*
 				DEBUG_PRINT ("Line %d is preprocessor line .. Skipping",
 							 ianjuta_editor_get_line_from_position
-								(editor, ianjuta_iterable_get_position (new_iter, NULL),
-								 NULL));
+							 (editor, new_iter, NULL));
 				*/
 				break;
 			}
@@ -396,8 +396,7 @@
 			/*
 			DEBUG_PRINT ("Line %d is *not* preprocessor line .. Breaking",
 						 ianjuta_editor_get_line_from_position
-							(editor, ianjuta_iterable_get_position (new_iter, NULL),
-							 NULL));
+							(editor, new_iter, NULL));
 			*/
 			break;
 		}
@@ -542,10 +541,10 @@
 		begin_modeline += 3;
 		end_modeline = strstr (begin_modeline, "-*-");
 		if (end_modeline)
-    {
-      *vim = FALSE;
-			return g_strndup (begin_modeline, end_modeline - begin_modeline);
-    }
+		{
+		  *vim = FALSE;
+				return g_strndup (begin_modeline, end_modeline - begin_modeline);
+		}
 	}
 	/* Search for vim-like modelines */
 	begin_modeline = strstr (comment_text, "vim:set");
@@ -592,8 +591,8 @@
 	
 	/* Find the first comment text in the buffer */
 	comment_text = g_string_new (NULL);
-	iter = ianjuta_editor_get_cell_iter (IANJUTA_EDITOR (plugin->current_editor),
-										 0, NULL);
+	iter = ianjuta_editor_get_start_position (IANJUTA_EDITOR (plugin->current_editor),
+											  NULL);
 	do
 	{
 		gboolean shift_buffer = TRUE;
@@ -672,14 +671,12 @@
 static gint
 set_line_indentation (IAnjutaEditor *editor, gint line_num, gint indentation)
 {
-	gint line_begin, line_end, indent_position;
-	gint current_pos;
-	gchar *line_string, *idx;
-	gint nchars = 0, nchars_removed = 0;
+	IAnjutaIterable *line_begin, *line_end, *indent_position;
+	IAnjutaIterable *current_pos;
+	gint carat_offset, nchars = 0, nchars_removed = 0;
 	gchar *old_indent_string = NULL, *indent_string = NULL;
 	
 	/* DEBUG_PRINT ("In %s()", __FUNCTION__); */
-	current_pos = ianjuta_editor_get_position (editor, NULL);
 	line_begin = ianjuta_editor_get_line_begin_position (editor, line_num, NULL);
 	line_end = ianjuta_editor_get_line_end_position (editor, line_num, NULL);
 	
@@ -687,45 +684,54 @@
 	DEBUG_PRINT ("line begin = %d, line end = %d, current_pos = %d",
 				 line_begin, line_end, current_pos);
 	*/
-	indent_position = line_begin;
+	indent_position = ianjuta_iterable_clone (line_begin, NULL);
 	
-	if (line_end > line_begin)
+	if (ianjuta_iterable_compare (line_end, line_begin, NULL) > 0)
 	{
-		line_string = ianjuta_editor_get_text (editor, line_begin,
-											   line_end - line_begin,
-											   NULL);
+		gchar *idx;
+		gchar *line_string = ianjuta_editor_get_text (editor, line_begin,
+														   line_end, NULL);
 		
-		/* DEBUG_PRINT ("line_string = '%s'", line_string); */
+		DEBUG_PRINT ("line_string = '%s'", line_string);
 		if (line_string)
 		{
 			idx = line_string;
 			
 			/* Find first non-white space */
 			while (*idx != '\0' && isspace (*idx))
-				idx++; /* Since we are looking for first non-space char, simple
-						* increment of the chars would do */
-			indent_position = line_begin + (idx - line_string);
+			{
+				idx = g_utf8_find_next_char (idx, NULL);
+				ianjuta_iterable_next (indent_position, NULL);
+			}
 			g_free (line_string);
 		}
 	}
+	/* Indent iter defined at this point, Identify how much is current
+	 * position is beyound this point. We need to restore it later after
+	 * indentation
+	*/
+	current_pos = ianjuta_editor_get_position (editor, NULL);
+	carat_offset = ianjuta_iterable_diff (indent_position, current_pos, NULL);
+	DEBUG_PRINT ("carat offset is = %d", carat_offset);
 	
 	/* Set new indentation */
 	if (indentation > 0)
 	{
-		indent_string = get_line_indentation_string (editor,
-													 indentation);
-		nchars = strlen (indent_string);
+		indent_string = get_line_indentation_string (editor, indentation);
+		nchars = g_utf8_strlen (indent_string, -1);
 		
 		/* Only indent if there is something to indent with */
 		if (indent_string)
 		{
 			/* Get existing indentation */
-			if (indent_position > line_begin)
+			if (ianjuta_iterable_compare (indent_position, line_begin, NULL) > 0)
 			{
-				old_indent_string = ianjuta_editor_get_text (editor, line_begin,
-															 indent_position - line_begin,
-															 NULL);
-				nchars_removed = strlen (old_indent_string);
+				old_indent_string =
+					ianjuta_editor_get_text (editor, line_begin,
+												  indent_position, NULL);
+				
+				DEBUG_PRINT ("old_indent_string = '%s'", old_indent_string);
+				nchars_removed = g_utf8_strlen (old_indent_string, -1);
 			}
 			
 			/* Only indent if there was no indentation before or old
@@ -737,7 +743,7 @@
 				/* Remove the old indentation string, if there is any */
 				if (old_indent_string)
 					ianjuta_editor_erase (editor, line_begin,
-										  indent_position - line_begin, NULL);
+										  indent_position, NULL);
 				
 				/* Insert the new indentation string */
 				ianjuta_editor_insert (editor, line_begin,
@@ -752,41 +758,48 @@
 	if (indentation == 0)
 	{
 		/* Get existing indentation */
-		if (indent_position > line_begin)
+		if (ianjuta_iterable_compare (indent_position, line_begin, NULL) > 0)
 		{
-			old_indent_string = ianjuta_editor_get_text (editor, line_begin,
-														 indent_position - line_begin,
-														 NULL);
-			nchars_removed = strlen (old_indent_string);
+			old_indent_string =
+				ianjuta_editor_get_text (editor, line_begin,
+											  indent_position, NULL);
+			nchars_removed = g_utf8_strlen (old_indent_string, -1);
 		}
 		if (old_indent_string)
-			ianjuta_editor_erase (editor, line_begin,
-								  indent_position - line_begin, NULL);
-				
+			ianjuta_editor_erase (editor, line_begin, indent_position, NULL);
 	}
 	
 	/* Restore current position */
-	if (current_pos >= indent_position)
+	if (carat_offset >= 0)
 	{
 		/* If the cursor was not before the first non-space character in
 		 * the line, restore it's position after indentation.
 		 */
-		gint delta_position = nchars - nchars_removed;
-		ianjuta_editor_goto_position (editor, current_pos + delta_position,
-									  NULL);
-		/*
-		DEBUG_PRINT ("Restored position to %d", current_pos + delta_position);
-		*/
+		gint i;
+		IAnjutaIterable *pos = ianjuta_editor_get_line_begin_position (editor, line_num, NULL);
+		for (i = 0; i < nchars + carat_offset; i++)
+			ianjuta_iterable_next (pos, NULL);
+		ianjuta_editor_goto_position (editor, pos, NULL);
+		g_object_unref (pos);
 	}
-	else if (current_pos >= line_begin)
+	else /* cursor_offset < 0 */
 	{
 		/* If the cursor was somewhere in the old indentation spaces,
 		 * home the cursor to first non-space character in the line (or
 		 * end of line if there is no non-space characters in the line.
 		 */
-		ianjuta_editor_goto_position (editor, current_pos + nchars,
-									  NULL);
+		gint i;
+		IAnjutaIterable *pos = ianjuta_editor_get_line_begin_position (editor, line_num, NULL);
+		for (i = 0; i < nchars; i++)
+			ianjuta_iterable_next (pos, NULL);
+		ianjuta_editor_goto_position (editor, pos, NULL);
+		g_object_unref (pos);
 	}
+
+	g_object_unref (current_pos);
+	g_object_unref (indent_position);
+	g_object_unref (line_begin);
+	g_object_unref (line_end);
 	
 	g_free (old_indent_string);
 	g_free (indent_string);
@@ -806,7 +819,6 @@
 {
 	IAnjutaIterable *iter;
 	gchar point_ch;
-	gint position;
 	gint line_indent = 0;
 	gboolean looking_at_just_next_line = TRUE;
 	gboolean current_line_is_preprocessor = FALSE;
@@ -819,9 +831,7 @@
 	
 	/* DEBUG_PRINT ("In %s()", __FUNCTION__); */
 	
-	position = ianjuta_editor_get_line_begin_position (editor, line_num,
-													   NULL);
-	iter = ianjuta_editor_get_cell_iter (editor, position, NULL);
+	iter = ianjuta_editor_get_line_begin_position (editor, line_num, NULL);
 	
 	current_line_is_preprocessor = line_is_preprocessor (editor, iter);
 	current_line_is_continuation = line_is_continuation (editor, iter);
@@ -862,9 +872,8 @@
 		{
 			gint line_saved;
 			
-			line_saved = ianjuta_editor_get_line_from_position (editor,
-								ianjuta_iterable_get_position (iter, NULL),
-																	NULL);
+			line_saved = ianjuta_editor_get_line_from_position (editor, iter,
+																NULL);
 			
 			/* If we encounter a block-end before anything else, the
 			 * statement could hardly be incomplte.
@@ -890,9 +899,8 @@
 		}
 		else if (point_ch == '{')
 		{
-			gint line_for_indent = ianjuta_editor_get_line_from_position (editor,
-								ianjuta_iterable_get_position (iter, NULL),
-								NULL);
+			gint line_for_indent =
+				ianjuta_editor_get_line_from_position (editor, iter, NULL);
 			line_indent = get_line_indentation (editor, line_for_indent);
 			/* Increase line indentation */
 			line_indent += INDENT_SIZE;
@@ -952,8 +960,7 @@
 				looking_at_just_next_line)
 			{
 				/*
-				gint line = ianjuta_editor_get_line_from_position
-					(editor, ianjuta_iterable_get_position (iter, NULL), NULL);
+				gint line = ianjuta_editor_get_line_from_position (editor, iter, NULL);
 				line_indent = get_line_indentation (editor, line);
 				*/
 			}
@@ -1021,13 +1028,14 @@
 {
 	IAnjutaIterable *iter;
 	gint line_indent = 0;
-	gint line_begin;
 	gint incomplete_statement = -1;
 	
-	g_return_val_if_fail (line > 1, 0);
+	g_return_val_if_fail (line > 0, 0);
+	
+	if (line == 1) /* First line */
+		return 0;
 	
-	line_begin = ianjuta_editor_get_line_begin_position (editor, line, NULL);
-	iter = ianjuta_editor_get_cell_iter (editor, line_begin, NULL);
+	iter = ianjuta_editor_get_line_begin_position (editor, line, NULL);
 	
 	if (is_iter_inside_comment_or_string (iter))
 	{
@@ -1083,9 +1091,8 @@
 			ianjuta_iterable_previous (iter, NULL);
 			if (cpp_java_util_jump_to_matching_brace (iter, ch, -1))
 			{
-				gint position = ianjuta_iterable_get_position (iter, NULL);
 				gint line = ianjuta_editor_get_line_from_position (editor,
-																   position,
+																   iter,
 																   NULL);
 				line_indent = get_line_indentation (editor, line);
 			}
@@ -1110,7 +1117,7 @@
 
 static void
 on_editor_char_inserted_cpp (IAnjutaEditor *editor,
-							 gint insert_pos,
+							 IAnjutaIterable *insert_pos,
 							 gchar ch,
 							 CppJavaPlugin *plugin)
 {
@@ -1124,7 +1131,7 @@
 	
 	/* DEBUG_PRINT ("Char added at position %d: '%c'", insert_pos, ch); */
 	
-	iter = ianjuta_editor_get_cell_iter (editor, insert_pos, NULL);
+	iter = ianjuta_iterable_clone (insert_pos, NULL);
 	
 	if (iter_is_newline (iter, ch))
 	{
@@ -1171,26 +1178,6 @@
 			}
 		}
 	}
-#if 0
-	else if (ch == '\t' &&
-			 anjuta_preferences_get_int (plugin->prefs,
-										 PREF_INDENT_TAB_INDENTS))
-	{
-		/* Indent on tab enabled */
-		/* Don't bother if we are inside comment or string */
-		attrib = ianjuta_editor_cell_get_attribute (IANJUTA_EDITOR_CELL (iter),
-													NULL);
-		if (attrib != IANJUTA_EDITOR_COMMENT &&
-			attrib != IANJUTA_EDITOR_STRING)
-		{
-			
-			/* Ensure that we remove the inserted tab */
-			ianjuta_editor_erase (editor, insert_pos, 1, NULL);
-			
-			should_auto_indent = TRUE;
-		}
-	}
-#endif
 	if (should_auto_indent)
 	{
 		gint insert_line;
@@ -1208,7 +1195,7 @@
 
 static void
 on_editor_char_inserted_java (IAnjutaEditor *editor,
-							  gint insert_pos,
+							  IAnjutaIterable *insert_pos,
 							  gchar ch,
 							  CppJavaPlugin *plugin)
 {
@@ -1405,8 +1392,8 @@
 														NULL);
 		sel_end = ianjuta_editor_selection_get_end (IANJUTA_EDITOR_SELECTION (editor),
 													NULL);
-		line_start = ianjuta_editor_cell_get_line (IANJUTA_EDITOR_CELL (sel_start), NULL);
-		line_end = ianjuta_editor_cell_get_line (IANJUTA_EDITOR_CELL (sel_end), NULL);
+		line_start = ianjuta_editor_get_line_from_position (editor, sel_start, NULL);
+		line_end = ianjuta_editor_get_line_from_position (editor, sel_end, NULL);
 		g_object_unref (sel_start);
 		g_object_unref (sel_end);
 	}

Modified: trunk/plugins/macro/macro-actions.c
==============================================================================
--- trunk/plugins/macro/macro-actions.c	(original)
+++ trunk/plugins/macro/macro-actions.c	Wed Jan 23 14:15:46 2008
@@ -27,7 +27,6 @@
 {
 	gchar shortcut;
 	gint offset = 0;
-	gint pos;
 	
 	gtk_tree_model_get(macro_db_get_model(plugin->macro_db), iter,
 		MACRO_SHORTCUT, &shortcut, -1);
@@ -36,14 +35,18 @@
 		gchar* text = macro_db_get_macro(plugin, plugin->macro_db, iter, &offset);
 		if (plugin->current_editor != NULL && text != NULL)
 		{
+			gint i;
+			IAnjutaIterable *pos;
 			pos = ianjuta_editor_get_position (IANJUTA_EDITOR(plugin->current_editor),
 			                                   NULL);
 			ianjuta_editor_insert (IANJUTA_EDITOR (plugin->current_editor),
-			                       pos, text, -1, NULL);			
+								   pos, text, -1, NULL);
+			for (i = 0; i < offset; i++)
+				ianjuta_iterable_next (pos, NULL);
 			ianjuta_editor_goto_position (IANJUTA_EDITOR(plugin->current_editor), 
-			                              pos + offset, 
-			                              NULL);
+			                              pos, NULL);
 			g_free(text);
+			g_object_unref (pos);
 		}
 		return TRUE;
 	}

Modified: trunk/plugins/macro/macro-dialog.c
==============================================================================
--- trunk/plugins/macro/macro-dialog.c	(original)
+++ trunk/plugins/macro/macro-dialog.c	Wed Jan 23 14:15:46 2008
@@ -49,7 +49,6 @@
 	GtkTreeIter iter;
 	gchar* text;
 	gint offset = 0;
-	gint pos;
 	
 	g_return_if_fail (plugin != NULL);
 	g_return_if_fail (model != NULL);
@@ -61,13 +60,17 @@
 	{
 		if (plugin->current_editor != NULL)
 		{
+			gint i;
+			IAnjutaIterable *pos;
 			pos = ianjuta_editor_get_position (IANJUTA_EDITOR(plugin->current_editor),
-			                                   NULL);
+											   NULL);
 			ianjuta_editor_insert (IANJUTA_EDITOR(plugin->current_editor),
 			                       pos, text, -1, NULL);
+			for (i = 0; i < offset; i++)
+				ianjuta_iterable_next (pos, NULL);
 			ianjuta_editor_goto_position (IANJUTA_EDITOR(plugin->current_editor), 
-			                              pos + offset, 
-			                              NULL);
+			                              pos, NULL);
+			g_object_unref (pos);
 		}
 		g_free(text);
 		gtk_widget_hide (plugin->macro_dialog);

Modified: trunk/plugins/macro/plugin.c
==============================================================================
--- trunk/plugins/macro/plugin.c	(original)
+++ trunk/plugins/macro/plugin.c	Wed Jan 23 14:15:46 2008
@@ -186,7 +186,6 @@
 {
 	gchar *name;
 	gint offset = 0;
-	gint pos;
 	
 	gtk_tree_model_get(macro_db_get_model(plugin->macro_db), iter,
 		MACRO_NAME, &name, -1);
@@ -195,14 +194,18 @@
 		gchar* text = macro_db_get_macro(plugin, plugin->macro_db, iter, &offset);
 		if (plugin->current_editor != NULL && text != NULL)
 		{
-			pos = ianjuta_editor_get_position (IANJUTA_EDITOR(plugin->current_editor),
-			                                   NULL);
+			gint i;
+			IAnjutaIterable *pos =
+				ianjuta_editor_get_position (IANJUTA_EDITOR(plugin->current_editor),
+											 NULL);
 			ianjuta_editor_insert (IANJUTA_EDITOR (plugin->current_editor),
 			                       pos, text, -1, NULL);
+			for (i = 0; i < offset; i++)
+				ianjuta_iterable_next (pos, NULL);
 			ianjuta_editor_goto_position (IANJUTA_EDITOR(plugin->current_editor), 
-			                              pos + offset, 
-			                              NULL);
+			                              pos, NULL);
 			g_free(text);
+			g_object_unref (pos);
 		}
 		return TRUE;
 	}

Modified: trunk/plugins/search/plugin.c
==============================================================================
--- trunk/plugins/search/plugin.c	(original)
+++ trunk/plugins/search/plugin.c	Wed Jan 23 14:15:46 2008
@@ -68,8 +68,8 @@
 	if (info != NULL)
 	{
 		IAnjutaIterable *start, *end;
-		start = ianjuta_editor_get_cell_iter (te, info->pos, NULL);
-		end = ianjuta_editor_get_cell_iter (te, info->pos + info->len, NULL);
+		start = ianjuta_editor_get_position_from_offset (te, info->pos, NULL);
+		end = ianjuta_editor_get_position_from_offset (te, info->pos + info->len, NULL);
 		ianjuta_editor_selection_set (IANJUTA_EDITOR_SELECTION (te),
 									  start, end, NULL);
 		g_object_unref (start);

Modified: trunk/plugins/search/search-replace.c
==============================================================================
--- trunk/plugins/search/search-replace.c	(original)
+++ trunk/plugins/search/search-replace.c	Wed Jan 23 14:15:46 2008
@@ -408,10 +408,17 @@
 									(sr->docman, NULL));
 
 						if (IANJUTA_INDICABLE (fb->te))
-					/* end-location is correct for sourceview, 1-too-big for scintilla */
-						ianjuta_indicable_set (IANJUTA_INDICABLE(fb->te),  
-						                       mi->pos, mi->pos + mi->len,  
-					            					IANJUTA_INDICABLE_IMPORTANT, NULL);
+						{
+							IAnjutaIterable *start_pos, *end_pos;
+							/* end-location is correct for sourceview, 1-too-big for scintilla */
+							start_pos = ianjuta_editor_get_position_from_offset (fb->te, mi->pos, NULL);
+							end_pos = ianjuta_editor_get_position_from_offset (fb->te, mi->pos + mi->len, NULL);
+							ianjuta_indicable_set (IANJUTA_INDICABLE(fb->te),
+												   start_pos, end_pos,
+												   IANJUTA_INDICABLE_IMPORTANT, NULL);
+							g_object_unref (start_pos);
+							g_object_unref (end_pos);
+						}
 						break;
 
 					case SA_BOOKMARK:
@@ -448,8 +455,8 @@
 							found_line = mi->line;
 						}
 						{
-							IAnjutaIterable* start = ianjuta_editor_get_cell_iter (fb->te, mi->pos, NULL);
-							IAnjutaIterable* end = ianjuta_editor_get_cell_iter (fb->te, mi->pos + mi->len, NULL);
+							IAnjutaIterable* start = ianjuta_editor_get_position_from_offset (fb->te, mi->pos, NULL);
+							IAnjutaIterable* end = ianjuta_editor_get_position_from_offset (fb->te, mi->pos + mi->len, NULL);
 							ianjuta_editor_selection_set(IANJUTA_EDITOR_SELECTION (fb->te), 
 														 start,
 														 end,
@@ -476,8 +483,8 @@
 
 						if (!interactive)
 						{
-							IAnjutaIterable* start = ianjuta_editor_get_cell_iter (fb->te, mi->pos - offset, NULL);
-							IAnjutaIterable* end = ianjuta_editor_get_cell_iter (fb->te, mi->pos - offset + mi->len, NULL);
+							IAnjutaIterable* start = ianjuta_editor_get_position_from_offset (fb->te, mi->pos - offset, NULL);
+							IAnjutaIterable* end = ianjuta_editor_get_position_from_offset (fb->te, mi->pos - offset + mi->len, NULL);
 							ianjuta_editor_selection_set(IANJUTA_EDITOR_SELECTION (fb->te), 
 														 start,
 														 end,
@@ -505,8 +512,8 @@
 								ch = NULL;
 						}
 							{
-								IAnjutaIterable* start = ianjuta_editor_get_cell_iter (fb->te, mi->pos - os, NULL);
-								IAnjutaIterable* end = ianjuta_editor_get_cell_iter (fb->te, mi->pos + mi->len - os, NULL);
+								IAnjutaIterable* start = ianjuta_editor_get_position_from_offset (fb->te, mi->pos - os, NULL);
+								IAnjutaIterable* end = ianjuta_editor_get_position_from_offset (fb->te, mi->pos + mi->len - os, NULL);
 								ianjuta_editor_selection_set(IANJUTA_EDITOR_SELECTION (fb->te),  
 															 start,														 
 															 end,
@@ -540,8 +547,8 @@
 						}
 						else
 						{
-							IAnjutaIterable* start = ianjuta_editor_get_cell_iter (fb->te, mi->pos - offset, NULL);
-							IAnjutaIterable* end = ianjuta_editor_get_cell_iter (fb->te, mi->pos + mi->len - offset, NULL);
+							IAnjutaIterable* start = ianjuta_editor_get_position_from_offset (fb->te, mi->pos - offset, NULL);
+							IAnjutaIterable* end = ianjuta_editor_get_position_from_offset (fb->te, mi->pos + mi->len - offset, NULL);
 							ianjuta_editor_selection_set(IANJUTA_EDITOR_SELECTION (fb->te),  
 														 start,
 														 end,
@@ -1011,18 +1018,15 @@
 	IAnjutaEditor *te = NULL;
 	if (IANJUTA_IS_EDITOR(doc))
 		te = IANJUTA_EDITOR(doc);
-	long length;
 	
 	if (te)
 	{
-		length = ianjuta_editor_get_length(te, NULL);;
-	
 		if (direction != SD_BACKWARD)
 			/* search from doc start */
-			ianjuta_editor_goto_position(te, 0, NULL);
+			ianjuta_editor_goto_start (te, NULL);
 		else
 			/* search from doc end */
-			ianjuta_editor_goto_position (te, length, NULL);
+			ianjuta_editor_goto_end (te, NULL);
 	}
 }
 

Modified: trunk/plugins/search/search-replace_backend.c
==============================================================================
--- trunk/plugins/search/search-replace_backend.c	(original)
+++ trunk/plugins/search/search-replace_backend.c	Wed Jan 23 14:15:46 2008
@@ -179,8 +179,8 @@
 		g_free (uri);
 	}
 	fb->len = ianjuta_editor_get_length(te, NULL);
-	fb->buf = ianjuta_editor_get_text(fb->te, 0, fb->len, NULL);
-	fb->pos = ianjuta_editor_get_position(fb->te, NULL);
+	fb->buf = ianjuta_editor_get_text_all (fb->te, NULL);
+	fb->pos = ianjuta_editor_get_offset(fb->te, NULL);
 	fb->line = ianjuta_editor_get_lineno(fb->te, NULL);
 	
 	return fb;
@@ -301,7 +301,11 @@
 	}
 	else if (FB_EDITOR == fb->type)
 	{
-		return ianjuta_editor_get_line_from_position(fb->te, pos, NULL);
+		IAnjutaIterable *position;
+		position = ianjuta_editor_get_position_from_offset (fb->te, pos, NULL);
+		lineno = ianjuta_editor_get_line_from_position (fb->te, position, NULL);
+		g_object_unref (position);
+		return lineno;
 	}
 	else
 		return -1;
@@ -638,7 +642,7 @@
 					}
 					else
 					{
-						se->start_pos = ianjuta_editor_get_position (se->te, NULL);
+						se->start_pos = ianjuta_editor_get_offset (se->te, NULL);
 					}
 					se->end_pos = -1;	/* not actually used when backward searching */
 				}
@@ -703,8 +707,8 @@
 				if (s->range.type != SR_SELECTION)
 				{
 					IAnjutaIterable *start, *end;
-					start = ianjuta_editor_get_cell_iter (se->te, selstart, NULL);
-					end = ianjuta_editor_get_cell_iter (se->te, selend, NULL);
+					start = ianjuta_editor_get_position_from_offset (se->te, selstart, NULL);
+					end = ianjuta_editor_get_position_from_offset (se->te, selend, NULL);
 					ianjuta_editor_selection_set(IANJUTA_EDITOR_SELECTION (se->te), 
 				                                 start, end, NULL);	
 					g_object_unref (start);

Modified: trunk/plugins/symbol-browser/plugin.c
==============================================================================
--- trunk/plugins/symbol-browser/plugin.c	(original)
+++ trunk/plugins/symbol-browser/plugin.c	Wed Jan 23 14:15:46 2008
@@ -65,7 +65,7 @@
 
 static void on_editor_update_ui (IAnjutaEditor *editor,
 								 SymbolBrowserPlugin *sv_plugin);
-static void on_char_added (IAnjutaEditor *editor, gint position, gchar ch,
+static void on_char_added (IAnjutaEditor *editor, IAnjutaIterable *position, gchar ch,
 						   SymbolBrowserPlugin *sv_plugin);
 
 static void
@@ -793,7 +793,7 @@
 		ed = IANJUTA_EDITOR (sv_plugin->current_editor);
 		
 		buffer_size = ianjuta_editor_get_length (ed, NULL);
-		current_buffer = ianjuta_editor_get_text (ed, 0, -1, NULL);
+		current_buffer = ianjuta_editor_get_text_all (ed, NULL);
 				
 		uri = ianjuta_file_get_uri (IANJUTA_FILE (ed), NULL);
 		
@@ -871,15 +871,15 @@
 }
 
 static void
-on_char_added (IAnjutaEditor *editor, gint position, gchar ch,
+on_char_added (IAnjutaEditor *editor, IAnjutaIterable *position, gchar ch,
 			   SymbolBrowserPlugin *sv_plugin)
 {
-	DEBUG_PRINT ("char added @ %d : %c [int %d]", position, ch, ch);
+	DEBUG_PRINT ("char added: %c [int %d]", ch, ch);
 	
 	/* try to force the update if a "." or a "->" is pressed */
 	if ((ch == '.') || (prev_char_added == '-' && ch == '>'))
 		on_editor_buffer_symbols_update_timeout (sv_plugin);
-		
+	
 	need_symbols_update = TRUE;
 	
 	prev_char_added = ch;
@@ -1280,107 +1280,12 @@
 	return NULL;
 }
 
-static IAnjutaIterable*
-isymbol_manager_get_completions_at_position (IAnjutaSymbolManager *sm,
-											const gchar *file_uri,
-							 				const gchar *text_buffer, 
-											gint text_length, 
-											gint text_pos,
-							 				GError **err)
-{
-	SymbolBrowserPlugin *sv_plugin;
-	const TMTag *func_scope_tag;
-	TMSourceFile *tm_file;
-	IAnjutaEditor *ed;
-	AnjutaSymbolView *symbol_view;
-	gulong line;
-	gulong scope_position;
-	gchar *needed_text = NULL;
-	gint access_method;
-	GPtrArray * completable_tags_array;
-	AnjutaSymbolIter *iter = NULL;
-	
-	sv_plugin = ANJUTA_PLUGIN_SYMBOL_BROWSER (sm);
-	ed = IANJUTA_EDITOR (sv_plugin->current_editor);	
-	symbol_view = ANJUTA_SYMBOL_VIEW (sv_plugin->sv_tree);
-	
-	line = ianjuta_editor_get_line_from_position (ed, text_pos, NULL);
-	
-	/* get the function scope */
-	tm_file = anjuta_symbol_view_get_tm_file (symbol_view, file_uri);
-	
-	/* check whether the current file_uri is listed in the tm_workspace or not... */	
-	if (tm_file == NULL)
-		return 	NULL;
-		
-
-	// FIXME: remove DEBUG_PRINT	
-/*/
-	DEBUG_PRINT ("tags in file &s\n");
-	if (tm_file->work_object.tags_array != NULL) {
-		int i;
-		for (i=0; i < tm_file->work_object.tags_array->len; i++) {
-			TMTag *cur_tag;
-		
-			cur_tag = (TMTag*)g_ptr_array_index (tm_file->work_object.tags_array, i);
-			tm_tag_print (cur_tag, stdout);
-		}
-	}
-/*/
-
-	func_scope_tag = tm_get_current_function (tm_file->work_object.tags_array, line);
-		
-	if (func_scope_tag == NULL) {
-		DEBUG_PRINT ("func_scope_tag is NULL, seems like it's a completion on a global scope");
-		return NULL;
-	}
-	
-	DEBUG_PRINT ("current expression scope: %s", func_scope_tag->name);
-	
-	
-	scope_position = ianjuta_editor_get_line_begin_position (ed, func_scope_tag->atts.entry.line, NULL);
-	needed_text = ianjuta_editor_get_text (ed, scope_position,
-										   text_pos - scope_position, NULL);
-
-	if (needed_text == NULL)
-		DEBUG_PRINT ("needed_text is null");
-	DEBUG_PRINT ("text needed is %s", needed_text );
-	
-
-	/* we'll pass only the text of the current scope: i.e. only the current function
-	 * in which we request the completion. */
-	TMTag * found_type = anjuta_symbol_view_get_type_of_expression (symbol_view, 
-				needed_text, text_pos - scope_position, func_scope_tag, &access_method);
-
-				
-	if (found_type == NULL) {
-		DEBUG_PRINT ("type not found.");
-		return NULL;	
-	}
-	
-	/* get the completable memebers. If the access is COMPLETION_ACCESS_STATIC we don't
-	 * want to know the parents members of the class.
-	 */
-	if (access_method == COMPLETION_ACCESS_STATIC)
-		completable_tags_array = anjuta_symbol_view_get_completable_members (found_type, FALSE);
-	else
-		completable_tags_array = anjuta_symbol_view_get_completable_members (found_type, TRUE);
-	
-	if (completable_tags_array && completable_tags_array->len)
-	{
-		iter = anjuta_symbol_iter_new (completable_tags_array);
-		return IANJUTA_ITERABLE (iter);
-	}
-	return NULL;
-}
-
 static void
 isymbol_manager_iface_init (IAnjutaSymbolManagerIface *iface)
 {
 	iface->search = isymbol_manager_search;
 	iface->get_members = isymbol_manager_get_members;
 	iface->get_parents = isymbol_manager_get_parents;
-	iface->get_completions_at_position = isymbol_manager_get_completions_at_position;
 }
 
 static void

Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c	(original)
+++ trunk/plugins/symbol-db/plugin.c	Wed Jan 23 14:15:46 2008
@@ -118,7 +118,7 @@
 		ed = IANJUTA_EDITOR (sdb_plugin->current_editor);
 		
 		buffer_size = ianjuta_editor_get_length (ed, NULL);
-		current_buffer = ianjuta_editor_get_text (ed, 0, -1, NULL);
+		current_buffer = ianjuta_editor_get_text_all (ed, NULL);
 				
 		uri = ianjuta_file_get_uri (IANJUTA_FILE (ed), NULL);		
 	} 
@@ -228,10 +228,10 @@
 }
 
 static void
-on_char_added (IAnjutaEditor *editor, gint position, gchar ch,
+on_char_added (IAnjutaEditor *editor, IAnjutaIterable *position, gchar ch,
 			   SymbolDBPlugin *sdb_plugin)
 {
-	DEBUG_PRINT ("char added @ %d : %c [int %d]", position, ch, ch);
+	DEBUG_PRINT ("char added: %c [int %d]", ch, ch);
 	
 	if (timer == NULL)
 	{
@@ -1262,27 +1262,12 @@
 	return NULL;
 }
 
-static IAnjutaIterable*
-isymbol_manager_get_completions_at_position (IAnjutaSymbolManager *sm,
-											const gchar *file_uri,
-							 				const gchar *text_buffer, 
-											gint text_length, 
-											gint text_pos,
-							 				GError **err)
-{
-	/* TODO */
-	DEBUG_PRINT ("TODO: isymbol_manager_get_completions_at_position ()");
-	return NULL;
-}
-
-
 static void
 isymbol_manager_iface_init (IAnjutaSymbolManagerIface *iface)
 {
 	iface->search = isymbol_manager_search;
 	iface->get_members = isymbol_manager_get_members;
 	iface->get_parents = isymbol_manager_get_parents;
-	iface->get_completions_at_position = isymbol_manager_get_completions_at_position;
 }
 
 ANJUTA_PLUGIN_BEGIN (SymbolDBPlugin, symbol_db);

Modified: trunk/plugins/tools/execute.c
==============================================================================
--- trunk/plugins/tools/execute.c	(original)
+++ trunk/plugins/tools/execute.c	Wed Jan 23 14:15:46 2008
@@ -67,7 +67,7 @@
 	gboolean created;
 	GString* buffer;
 	IAnjutaEditor* editor;
-	guint position;
+	IAnjutaIterable *position;
 } ATPOutputContext;
 
 /* Execute information
@@ -669,7 +669,8 @@
 	this->execution = execution;
 	this->view = NULL;
 	this->buffer = NULL;
-
+	this->position = NULL;
+	
 	return atp_output_context_initialize (this, execution, type);
 }
 
@@ -689,6 +690,10 @@
 	{
 		g_string_free (this->buffer, TRUE);
 	}
+	if (this->position)
+	{
+		g_object_unref (this->position);
+	}
 }
 
 /* Execution context
@@ -984,7 +989,7 @@
 			ed = get_current_editor(docman);
 			if (ed != NULL)
 			{
-				input = ianjuta_editor_get_text (ed, 0, -1, NULL);
+				input = ianjuta_editor_get_text_all (ed, NULL);
 			}
 			break;
 		case ATP_TIN_SELECTION:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]