summaryrefslogtreecommitdiff
blob: ad5f878530f7fca3ff5f7e9dad283533b7f15ac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--- vte.c.ORG	2004-03-06 10:28:09.000000000 -0800
+++ vte.c	2004-03-06 10:44:23.000000000 -0800
@@ -1917,4 +1917,31 @@
 }
 
+/* Scroll up or down in the current screen. */
+static void
+vte_terminal_scroll_lines(VteTerminal *terminal, gint lines)
+{
+        glong destination;
+        g_return_if_fail(VTE_IS_TERMINAL(terminal));
+#ifdef VTE_DEBUG
+        if (_vte_debug_on(VTE_DEBUG_IO)) {
+                fprintf(stderr, "Scrolling %d lines.\n", lines);
+        }
+#endif
+        /* Calculate the ideal position where we want to be before clamping. */
+        destination = floor(gtk_adjustment_get_value(terminal->adjustment));
+        destination += lines;
+        /* Can't scroll past data we have. */
+        destination = CLAMP(destination,
+                            terminal->adjustment->lower,
+                            terminal->adjustment->upper - terminal->row_count);
+        /* Tell the scrollbar to adjust itself. */
+        gtk_adjustment_set_value(terminal->adjustment, destination);
+        /* Clear dingus match set. */
+        vte_terminal_match_contents_clear(terminal);
+        /* Notify viewers that the contents have changed. */
+        vte_terminal_emit_contents_changed(terminal);
+}
+
+
 /* Scroll so that the scroll delta is the minimum value. */
 static void
@@ -8038,4 +8065,22 @@
 			}
 			break;
+		case GDK_KP_Up:
+                case GDK_Up:
+                        if (terminal->pvt->modifiers & GDK_SHIFT_MASK) {
+                                vte_terminal_scroll_lines(terminal, -1);
+                                scrolled = TRUE;
+                                handled = TRUE;
+                                suppress_meta_esc = TRUE;
+                        }
+                        break;
+                case GDK_KP_Down:
+                case GDK_Down:
+                        if (terminal->pvt->modifiers & GDK_SHIFT_MASK) {
+                                vte_terminal_scroll_lines(terminal, 1);
+                                scrolled = TRUE;
+                                handled = TRUE;
+                                suppress_meta_esc = TRUE;
+                        }
+                        break;
 		case GDK_KP_Home:
 		case GDK_Home: