Commit 02576c52 authored by Johannes Schmid's avatar Johannes Schmid Committed by Johannes Schmid

#569908 – completion of symbol shouldn't scroll the editor

2009-02-02  Johannes Schmid  <jhs@gnome.org>

	* libanjuta/interfaces/libanjuta.idl:
	* plugins/document-manager/search-box.c (on_incremental_search),
	(on_search_activated):
	* plugins/language-support-cpp-java/cpp-java-assist.c
	(on_assist_chosen):
	* plugins/scintilla/text_editor.c (iselection_set),
	(iselection_iface_init):
	* plugins/search/search-replace.c (search_and_replace):
	* plugins/search/search-replace_backend.c (create_search_entries):
	* plugins/sourceview/sourceview.c (set_select), (iselect_block),
	(iselect_set), (iselect_iface_init):
	#569908 – completion of symbol shouldn't scroll the editor

svn path=/trunk/; revision=4680
parent 1f645429
2009-02-02 Johannes Schmid <jhs@gnome.org>
* libanjuta/interfaces/libanjuta.idl:
* plugins/document-manager/search-box.c (on_incremental_search),
(on_search_activated):
* plugins/language-support-cpp-java/cpp-java-assist.c
(on_assist_chosen):
* plugins/scintilla/text_editor.c (iselection_set),
(iselection_iface_init):
* plugins/search/search-replace.c (search_and_replace):
* plugins/search/search-replace_backend.c (create_search_entries):
* plugins/sourceview/sourceview.c (set_select), (iselect_block),
(iselect_set), (iselect_iface_init):
#569908 – completion of symbol shouldn't scroll the editor
2009-02-02 Johannes Schmid <jhs@gnome.org>
* manuals/anjuta-manual/C/glade.xml:
......@@ -1640,12 +1640,13 @@ interface IAnjutaEditor
* @obj: Self
* @start: Begin of selection
* @end: End of selection
* @scroll: Scroll selection onscreen
* @err: Error propagation and reporting
*
* Select characters between start and end. Start and end don't have to
* be ordered.
*/
void set (IAnjutaIterable* start, IAnjutaIterable* end);
void set (IAnjutaIterable* start, IAnjutaIterable* end, gboolean scroll);
/**
* ianjuta_editor_selection_get_start:
......@@ -1693,16 +1694,6 @@ interface IAnjutaEditor
* method does not do anything.
*/
void select_function ();
/**
* ianjuta_editor_selection_select_to_brace:
* @obj: Self
* @err: Error propagation and reporting
*
* Select to brace. Some highlight mode does not have braces concept,
* in that case, this method does not do anything.
*/
void select_to_brace ();
/**
* ianjuta_editor_edit_select_all:
......
......@@ -268,7 +268,7 @@ on_incremental_search (GtkWidget* widget, SearchBox* search_box)
selection = IANJUTA_EDITOR_SELECTION (private->current_editor);
ianjuta_editor_selection_set (selection,
IANJUTA_ITERABLE (result_start),
IANJUTA_ITERABLE (result_end), NULL);
IANJUTA_ITERABLE (result_end), TRUE, NULL);
g_object_unref (result_start);
g_object_unref (result_end);
......@@ -393,7 +393,7 @@ on_search_activated (GtkWidget* widget, SearchBox* search_box)
{
ianjuta_editor_selection_set (selection,
IANJUTA_ITERABLE (result_start),
IANJUTA_ITERABLE (result_end), NULL);
IANJUTA_ITERABLE (result_end), TRUE, NULL);
g_object_unref (result_start);
g_object_unref (result_end);
}
......
......@@ -883,7 +883,7 @@ on_assist_chosen (IAnjutaEditorAssist* iassist, gint selection,
{
ianjuta_iterable_next (iter, NULL);
ianjuta_editor_selection_set (IANJUTA_EDITOR_SELECTION (te),
iter, cur_pos, NULL);
iter, cur_pos, FALSE, NULL);
ianjuta_editor_selection_replace (IANJUTA_EDITOR_SELECTION (te),
assistance->str, -1, NULL);
g_free (pre_word);
......
......@@ -2594,6 +2594,7 @@ static void
iselection_set (IAnjutaEditorSelection* edit,
IAnjutaIterable* istart,
IAnjutaIterable* iend,
gboolean scroll, /* TODO: Is is possible to set this in scintilla? */
GError** e)
{
TextEditorCell* start = TEXT_EDITOR_CELL (istart);
......@@ -2662,12 +2663,6 @@ iselection_select_all (IAnjutaEditorSelection* te, GError** ee)
text_editor_command (TEXT_EDITOR (te), ANE_SELECTALL, 0, 0);
}
static void
iselection_select_to_brace (IAnjutaEditorSelection* te, GError** ee)
{
text_editor_command (TEXT_EDITOR (te), ANE_SELECTTOBRACE, 0, 0);
}
static void
iselection_select_block (IAnjutaEditorSelection *te, GError **e)
{
......@@ -2726,7 +2721,6 @@ iselection_iface_init (IAnjutaEditorSelectionIface *iface)
iface->get_end = iselection_get_end;
iface->replace = iselection_replace;
iface->select_all = iselection_select_all;
iface->select_to_brace = iselection_select_to_brace;
iface->select_block = iselection_select_block;
iface->select_function = iselection_select_function;
}
......
......@@ -447,6 +447,7 @@ search_and_replace (void)
ianjuta_editor_selection_set(IANJUTA_EDITOR_SELECTION (fb->te),
start,
end,
TRUE,
NULL);
g_object_unref (start);
g_object_unref (end);
......@@ -479,6 +480,7 @@ search_and_replace (void)
ianjuta_editor_selection_set(IANJUTA_EDITOR_SELECTION (fb->te),
start,
end,
TRUE,
NULL);
g_object_unref (start);
g_object_unref (end);
......@@ -508,6 +510,7 @@ search_and_replace (void)
ianjuta_editor_selection_set(IANJUTA_EDITOR_SELECTION (fb->te),
start,
end,
TRUE,
NULL);
ianjuta_editor_selection_replace(IANJUTA_EDITOR_SELECTION (fb->te),
sr->replace.repl_str,
......@@ -543,6 +546,7 @@ search_and_replace (void)
ianjuta_editor_selection_set(IANJUTA_EDITOR_SELECTION (fb->te),
start,
end,
TRUE,
NULL);
ianjuta_editor_selection_replace(IANJUTA_EDITOR_SELECTION (fb->te),
sr->replace.repl_str,
......
......@@ -796,7 +796,7 @@ create_search_entries (Search *s)
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);
start, end, TRUE, NULL);
g_object_unref (start);
g_object_unref (end);
}
......
......@@ -1400,27 +1400,22 @@ idocument_iface_init (IAnjutaDocumentIface *iface)
}
static void
set_select(Sourceview* sv, GtkTextIter* start_iter, GtkTextIter* end_iter)
set_select(Sourceview* sv, GtkTextIter* start_iter, GtkTextIter* end_iter, gboolean scroll)
{
GtkTextBuffer* buffer = GTK_TEXT_BUFFER (sv->priv->document);
gtk_text_buffer_select_range (buffer, start_iter, end_iter);
gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (sv->priv->view),
gtk_text_buffer_get_insert (buffer),
0.25,
FALSE,
0.0,
0.0);
if (scroll)
gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (sv->priv->view),
gtk_text_buffer_get_insert (buffer),
0.25,
FALSE,
0.0,
0.0);
}
/* IAnjutaEditorSelection */
// TODO: Move these to ilanguage-support?
static void
iselect_to_brace(IAnjutaEditorSelection* edit, GError** e)
{
}
/* Find the previous open brace that begins the current indentation level. */
static gboolean find_open_bracket(GtkTextIter *iter)
{
......@@ -1454,7 +1449,7 @@ static gboolean find_close_bracket(GtkTextIter *iter)
{
case '{':
++level;
break;
break;
case '}':
if (!--level)
return TRUE;
......@@ -1483,7 +1478,7 @@ iselect_block(IAnjutaEditorSelection* edit, GError** e)
if (find_close_bracket (&end_iter))
{
gtk_text_iter_forward_char (&end_iter); /* move past brace */
set_select (sv, &iter, &end_iter);
set_select (sv, &iter, &end_iter, TRUE);
}
}
}
......@@ -1492,12 +1487,14 @@ static void
iselect_set (IAnjutaEditorSelection* edit,
IAnjutaIterable* istart,
IAnjutaIterable* iend,
gboolean scroll,
GError** e)
{
Sourceview* sv = ANJUTA_SOURCEVIEW(edit);
set_select(sv,
sourceview_cell_get_iter (SOURCEVIEW_CELL (istart)),
sourceview_cell_get_iter (SOURCEVIEW_CELL (iend)));
sourceview_cell_get_iter (SOURCEVIEW_CELL (iend)),
scroll);
}
......@@ -1600,7 +1597,6 @@ iselect_iface_init(IAnjutaEditorSelectionIface *iface)
iface->select_block = iselect_block;
iface->select_function = iselect_function;
iface->select_all = iselect_all;
iface->select_to_brace = iselect_to_brace;
iface->select_block = iselect_block;
iface->get = iselect_get;
iface->replace = iselect_replace;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment