summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-03-23 17:54:16 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-03-23 17:54:16 +0000
commit0c45c57f6e92cd1a71a67e23aa76eb87dbdcb952 (patch)
tree8576e5a95a869999d525774a50fcad3908c2aaa8
parente00f842a5b0fbea7ab12fe9470926b8e4d146f08 (diff)
downloadgdk-pixbuf-0c45c57f6e92cd1a71a67e23aa76eb87dbdcb952.tar.gz
extend selection for pageup/pagedown and ctrl+pageup/pagedown if shift is
2002-03-23 Havoc Pennington <hp@pobox.com> * gtk/gtktextview.c (gtk_text_view_move_cursor_internal): extend selection for pageup/pagedown and ctrl+pageup/pagedown if shift is held. more of #53934
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.pre-2-106
-rw-r--r--ChangeLog.pre-2-26
-rw-r--r--ChangeLog.pre-2-46
-rw-r--r--ChangeLog.pre-2-66
-rw-r--r--ChangeLog.pre-2-86
-rw-r--r--gtk/gtktextview.c50
7 files changed, 67 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 8473ad641..520559e1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2002-03-23 Havoc Pennington <hp@pobox.com>
+ * gtk/gtktextview.c (gtk_text_view_move_cursor_internal): extend
+ selection for pageup/pagedown and ctrl+pageup/pagedown if
+ shift is held. more of #53934
+
+2002-03-23 Havoc Pennington <hp@pobox.com>
+
* gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect
layout handlers earlier in the function, to avoid possible
reentrancy screwups
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 8473ad641..520559e1c 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,5 +1,11 @@
2002-03-23 Havoc Pennington <hp@pobox.com>
+ * gtk/gtktextview.c (gtk_text_view_move_cursor_internal): extend
+ selection for pageup/pagedown and ctrl+pageup/pagedown if
+ shift is held. more of #53934
+
+2002-03-23 Havoc Pennington <hp@pobox.com>
+
* gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect
layout handlers earlier in the function, to avoid possible
reentrancy screwups
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 8473ad641..520559e1c 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,5 +1,11 @@
2002-03-23 Havoc Pennington <hp@pobox.com>
+ * gtk/gtktextview.c (gtk_text_view_move_cursor_internal): extend
+ selection for pageup/pagedown and ctrl+pageup/pagedown if
+ shift is held. more of #53934
+
+2002-03-23 Havoc Pennington <hp@pobox.com>
+
* gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect
layout handlers earlier in the function, to avoid possible
reentrancy screwups
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 8473ad641..520559e1c 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,5 +1,11 @@
2002-03-23 Havoc Pennington <hp@pobox.com>
+ * gtk/gtktextview.c (gtk_text_view_move_cursor_internal): extend
+ selection for pageup/pagedown and ctrl+pageup/pagedown if
+ shift is held. more of #53934
+
+2002-03-23 Havoc Pennington <hp@pobox.com>
+
* gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect
layout handlers earlier in the function, to avoid possible
reentrancy screwups
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 8473ad641..520559e1c 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,5 +1,11 @@
2002-03-23 Havoc Pennington <hp@pobox.com>
+ * gtk/gtktextview.c (gtk_text_view_move_cursor_internal): extend
+ selection for pageup/pagedown and ctrl+pageup/pagedown if
+ shift is held. more of #53934
+
+2002-03-23 Havoc Pennington <hp@pobox.com>
+
* gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect
layout handlers earlier in the function, to avoid possible
reentrancy screwups
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 8473ad641..520559e1c 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,5 +1,11 @@
2002-03-23 Havoc Pennington <hp@pobox.com>
+ * gtk/gtktextview.c (gtk_text_view_move_cursor_internal): extend
+ selection for pageup/pagedown and ctrl+pageup/pagedown if
+ shift is held. more of #53934
+
+2002-03-23 Havoc Pennington <hp@pobox.com>
+
* gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect
layout handlers earlier in the function, to avoid possible
reentrancy screwups
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 31c58109a..0a26822cf 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -234,9 +234,11 @@ static void gtk_text_view_page_horizontally (GtkTextView *text_view,
gboolean extend_selection);
static void gtk_text_view_set_anchor (GtkTextView *text_view);
static void gtk_text_view_scroll_pages (GtkTextView *text_view,
- gint count);
+ gint count,
+ gboolean extend_selection);
static void gtk_text_view_scroll_hpages (GtkTextView *text_view,
- gint count);
+ gint count,
+ gboolean extend_selection);
static void gtk_text_view_insert_at_cursor (GtkTextView *text_view,
const gchar *str);
static void gtk_text_view_delete_from_cursor (GtkTextView *text_view,
@@ -4396,6 +4398,20 @@ gtk_text_view_move_iter_by_lines (GtkTextView *text_view,
}
}
+static void
+move_cursor (GtkTextView *text_view,
+ const GtkTextIter *new_location,
+ gboolean extend_selection)
+{
+ if (extend_selection)
+ gtk_text_buffer_move_mark_by_name (get_buffer (text_view),
+ "insert",
+ new_location);
+ else
+ gtk_text_buffer_place_cursor (get_buffer (text_view),
+ new_location);
+}
+
/* FIXME when we are unfrozen and can change GtkMovementStep,
* fix this
*/
@@ -4416,13 +4432,13 @@ gtk_text_view_move_cursor_internal (GtkTextView *text_view,
if (step == GTK_MOVEMENT_PAGES)
{
- gtk_text_view_scroll_pages (text_view, count);
+ gtk_text_view_scroll_pages (text_view, count, extend_selection);
gtk_text_view_pend_cursor_blink (text_view);
return;
}
else if (step == PAGE_HORIZONTALLY_HACK_VALUE)
{
- gtk_text_view_scroll_hpages (text_view, count);
+ gtk_text_view_scroll_hpages (text_view, count, extend_selection);
gtk_text_view_pend_cursor_blink (text_view);
return;
}
@@ -4518,13 +4534,7 @@ gtk_text_view_move_cursor_internal (GtkTextView *text_view,
if (!gtk_text_iter_equal (&insert, &newplace))
{
- if (extend_selection)
- gtk_text_buffer_move_mark (get_buffer (text_view),
- gtk_text_buffer_get_mark (get_buffer (text_view),
- "insert"),
- &newplace);
- else
- gtk_text_buffer_place_cursor (get_buffer (text_view), &newplace);
+ move_cursor (text_view, &newplace, extend_selection);
DV(g_print (G_STRLOC": scrolling onscreen\n"));
gtk_text_view_scroll_mark_onscreen (text_view,
@@ -4572,7 +4582,8 @@ gtk_text_view_set_anchor (GtkTextView *text_view)
static void
gtk_text_view_scroll_pages (GtkTextView *text_view,
- gint count)
+ gint count,
+ gboolean extend_selection)
{
gdouble newval;
gdouble oldval;
@@ -4608,13 +4619,13 @@ gtk_text_view_scroll_pages (GtkTextView *text_view,
{
/* already at top, just be sure we are at offset 0 */
gtk_text_buffer_get_start_iter (get_buffer (text_view), &new_insert);
- gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
+ move_cursor (text_view, &new_insert, extend_selection);
}
else if (count > 0 && adj->value >= (adj->upper - adj->page_size - 1e-12))
{
/* already at bottom, just be sure we are at the end */
gtk_text_buffer_get_end_iter (get_buffer (text_view), &new_insert);
- gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
+ move_cursor (text_view, &new_insert, extend_selection);
}
else
{
@@ -4630,7 +4641,7 @@ gtk_text_view_scroll_pages (GtkTextView *text_view,
gtk_text_layout_get_iter_at_pixel (text_view->layout, &new_insert, cursor_x_pos, cursor_y_pos);
clamp_iter_onscreen (text_view, &new_insert);
- gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
+ move_cursor (text_view, &new_insert, extend_selection);
gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, cursor_y_pos);
}
@@ -4646,7 +4657,8 @@ gtk_text_view_scroll_pages (GtkTextView *text_view,
static void
gtk_text_view_scroll_hpages (GtkTextView *text_view,
- gint count)
+ gint count,
+ gboolean extend_selection)
{
gdouble newval;
gdouble oldval;
@@ -4672,13 +4684,13 @@ gtk_text_view_scroll_hpages (GtkTextView *text_view,
{
/* already at far left, just be sure we are at offset 0 */
gtk_text_iter_set_line_offset (&new_insert, 0);
- gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
+ move_cursor (text_view, &new_insert, extend_selection);
}
else if (count > 0 && adj->value >= (adj->upper - adj->page_size - 1e-12))
{
/* already at far right, just be sure we are at the end */
gtk_text_iter_forward_to_line_end (&new_insert);
- gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
+ move_cursor (text_view, &new_insert, extend_selection);
}
else
{
@@ -4694,7 +4706,7 @@ gtk_text_view_scroll_hpages (GtkTextView *text_view,
gtk_text_layout_get_iter_at_pixel (text_view->layout, &new_insert, cursor_x_pos, cursor_y_pos);
clamp_iter_onscreen (text_view, &new_insert);
- gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
+ move_cursor (text_view, &new_insert, extend_selection);
gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, cursor_y_pos);
}