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