[anjuta] sourceview: fix bgo#638787 - wrong set on gtk_source_view_set_smart_home_end
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] sourceview: fix bgo#638787 - wrong set on gtk_source_view_set_smart_home_end
- Date: Sat, 19 Feb 2011 13:35:25 +0000 (UTC)
commit 267deb21bf9039d38e433e93d491273766453412
Author: Johannes Schmid <jhs gnome org>
Date: Sat Feb 19 14:34:44 2011 +0100
sourceview: fix bgo#638787 - wrong set on gtk_source_view_set_smart_home_end
plugins/sourceview/anjuta-view.c | 106 +-------------------------------------
plugins/sourceview/sourceview.c | 1 -
2 files changed, 2 insertions(+), 105 deletions(-)
---
diff --git a/plugins/sourceview/anjuta-view.c b/plugins/sourceview/anjuta-view.c
index b0ce854..a99f15e 100644
--- a/plugins/sourceview/anjuta-view.c
+++ b/plugins/sourceview/anjuta-view.c
@@ -73,10 +73,6 @@ struct _AnjutaViewPrivate
static void anjuta_view_dispose (GObject *object);
static void anjuta_view_finalize (GObject *object);
-static void anjuta_view_move_cursor (GtkTextView *text_view,
- GtkMovementStep step,
- gint count,
- gboolean extend_selection);
static gint anjuta_view_focus_out (GtkWidget *widget,
GdkEventFocus *event);
@@ -308,7 +304,6 @@ static void
anjuta_view_class_init (AnjutaViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkTextViewClass *textview_class = GTK_TEXT_VIEW_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkBindingSet *binding_set;
GParamSpec *anjuta_view_spec_popup;
@@ -325,8 +320,6 @@ anjuta_view_class_init (AnjutaViewClass *klass)
widget_class->drag_drop = anjuta_view_drag_drop;
widget_class->drag_data_received = anjuta_view_drag_data_received;
widget_class->drag_motion = anjuta_view_drag_motion;
-
- textview_class->move_cursor = anjuta_view_move_cursor;
g_type_class_add_private (klass, sizeof (AnjutaViewPrivate));
@@ -342,101 +335,6 @@ anjuta_view_class_init (AnjutaViewClass *klass)
binding_set = gtk_binding_set_by_class (klass);
}
-static void
-move_cursor (GtkTextView *text_view,
- const GtkTextIter *new_location,
- gboolean extend_selection)
-{
- GtkTextBuffer *buffer = gtk_text_view_get_buffer (text_view);
-
- if (extend_selection)
- gtk_text_buffer_move_mark_by_name (buffer,
- "insert",
- new_location);
- else
- gtk_text_buffer_place_cursor (buffer, new_location);
-
- gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (text_view),
- gtk_text_buffer_get_insert (buffer),
- ANJUTA_VIEW_SCROLL_MARGIN,
- FALSE,
- 0.0,
- 0.0);
-}
-
-static void
-anjuta_view_move_cursor (GtkTextView *text_view,
- GtkMovementStep step,
- gint count,
- gboolean extend_selection)
-{
- GtkTextBuffer *buffer = gtk_text_view_get_buffer (text_view);
- GtkTextMark *mark;
- GtkTextIter cur, iter;
-
- /* really make sure gtksourceview's home/end is disabled */
- g_return_if_fail (!gtk_source_view_get_smart_home_end (
- GTK_SOURCE_VIEW (text_view)));
-
- mark = gtk_text_buffer_get_insert (buffer);
- gtk_text_buffer_get_iter_at_mark (buffer, &cur, mark);
- iter = cur;
-
- if (step == GTK_MOVEMENT_DISPLAY_LINE_ENDS &&
- (count == -1) && gtk_text_iter_starts_line (&iter))
- {
- /* Find the iter of the first character on the line. */
- while (!gtk_text_iter_ends_line (&cur))
- {
- gunichar c;
-
- c = gtk_text_iter_get_char (&cur);
- if (g_unichar_isspace (c))
- gtk_text_iter_forward_char (&cur);
- else
- break;
- }
-
- /* if we are clearing selection, we need to move_cursor even
- * if we are at proper iter because selection_bound may need
- * to be moved */
- if (!gtk_text_iter_equal (&cur, &iter) || !extend_selection)
- move_cursor (text_view, &cur, extend_selection);
- }
- else if (step == GTK_MOVEMENT_DISPLAY_LINE_ENDS &&
- (count == 1) && gtk_text_iter_ends_line (&iter))
- {
- /* Find the iter of the last character on the line. */
- while (!gtk_text_iter_starts_line (&cur))
- {
- gunichar c;
-
- gtk_text_iter_backward_char (&cur);
- c = gtk_text_iter_get_char (&cur);
- if (!g_unichar_isspace (c))
- {
- /* We've gone one character too far. */
- gtk_text_iter_forward_char (&cur);
- break;
- }
- }
-
- /* if we are clearing selection, we need to move_cursor even
- * if we are at proper iter because selection_bound may need
- * to be moved */
- if (!gtk_text_iter_equal (&cur, &iter) || !extend_selection)
- move_cursor (text_view, &cur, extend_selection);
- }
- else
- {
- /* note that we chain up to GtkTextView skipping GtkSourceView */
- (* GTK_TEXT_VIEW_CLASS (anjuta_view_parent_class)->move_cursor) (text_view,
- step,
- count,
- extend_selection);
- }
-}
-
static void
anjuta_view_init (AnjutaView *view)
{
@@ -525,7 +423,7 @@ anjuta_view_new (Sourceview *sv)
"insert-spaces-instead-of-tabs", FALSE,
"highlight-current-line", TRUE,
"indent-on-tab", TRUE, /* Fix #388727 */
- "smart-home-end", FALSE, /* Never changes this */
+ "smart-home-end", GTK_SOURCE_SMART_HOME_END_BEFORE,
NULL));
gtk_text_view_set_buffer (GTK_TEXT_VIEW (view),
@@ -533,7 +431,7 @@ anjuta_view_new (Sourceview *sv)
gtk_widget_show_all (view);
- ANJUTA_VIEW(view)->priv->sv = sv;
+ ANJUTA_VIEW(view)->priv->sv = sv;
return view;
}
diff --git a/plugins/sourceview/sourceview.c b/plugins/sourceview/sourceview.c
index 566d489..de9069a 100644
--- a/plugins/sourceview/sourceview.c
+++ b/plugins/sourceview/sourceview.c
@@ -761,7 +761,6 @@ sourceview_instance_init(Sourceview* sv)
G_CALLBACK(on_backspace),sv);
g_object_set (G_OBJECT (sv->priv->view), "has-tooltip", TRUE, NULL);
- gtk_source_view_set_smart_home_end(GTK_SOURCE_VIEW(sv->priv->view), FALSE);
/* Apply Preferences */
sourceview_prefs_init(sv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]