diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index e51f68ac7da..8d38537e180 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -584,10 +584,10 @@ int automatic_hscrolling_p; | |||
| 584 | 584 | ||
| 585 | /* How close to the margin can point get before the window is scrolled | 585 | /* How close to the margin can point get before the window is scrolled |
| 586 | horizontally. */ | 586 | horizontally. */ |
| 587 | int automatic_hscroll_margin; | 587 | int hscroll_margin; |
| 588 | 588 | ||
| 589 | /* How much to scroll horizontally when point is inside the above margin. */ | 589 | /* How much to scroll horizontally when point is inside the above margin. */ |
| 590 | Lisp_Object Vautomatic_hscroll_step; | 590 | Lisp_Object Vhscroll_step; |
| 591 | 591 | ||
| 592 | /* A list of symbols, one for each supported image type. */ | 592 | /* A list of symbols, one for each supported image type. */ |
| 593 | 593 | ||
| @@ -8024,22 +8024,22 @@ hscroll_window_tree (window) | |||
| 8024 | Lisp_Object window; | 8024 | Lisp_Object window; |
| 8025 | { | 8025 | { |
| 8026 | int hscrolled_p = 0; | 8026 | int hscrolled_p = 0; |
| 8027 | int hscroll_relative_p = FLOATP (Vautomatic_hscroll_step); | 8027 | int hscroll_relative_p = FLOATP (Vhscroll_step); |
| 8028 | int hscroll_step_abs = 0; | 8028 | int hscroll_step_abs = 0; |
| 8029 | double hscroll_step_rel = 0; | 8029 | double hscroll_step_rel = 0; |
| 8030 | 8030 | ||
| 8031 | if (hscroll_relative_p) | 8031 | if (hscroll_relative_p) |
| 8032 | { | 8032 | { |
| 8033 | hscroll_step_rel = XFLOAT_DATA (Vautomatic_hscroll_step); | 8033 | hscroll_step_rel = XFLOAT_DATA (Vhscroll_step); |
| 8034 | if (hscroll_step_rel < 0) | 8034 | if (hscroll_step_rel < 0) |
| 8035 | { | 8035 | { |
| 8036 | hscroll_relative_p = 0; | 8036 | hscroll_relative_p = 0; |
| 8037 | hscroll_step_abs = 0; | 8037 | hscroll_step_abs = 0; |
| 8038 | } | 8038 | } |
| 8039 | } | 8039 | } |
| 8040 | else if (INTEGERP (Vautomatic_hscroll_step)) | 8040 | else if (INTEGERP (Vhscroll_step)) |
| 8041 | { | 8041 | { |
| 8042 | hscroll_step_abs = XINT (Vautomatic_hscroll_step); | 8042 | hscroll_step_abs = XINT (Vhscroll_step); |
| 8043 | if (hscroll_step_abs < 0) | 8043 | if (hscroll_step_abs < 0) |
| 8044 | hscroll_step_abs = 0; | 8044 | hscroll_step_abs = 0; |
| 8045 | } | 8045 | } |
| @@ -8056,7 +8056,7 @@ hscroll_window_tree (window) | |||
| 8056 | hscrolled_p |= hscroll_window_tree (w->vchild); | 8056 | hscrolled_p |= hscroll_window_tree (w->vchild); |
| 8057 | else if (w->cursor.vpos >= 0) | 8057 | else if (w->cursor.vpos >= 0) |
| 8058 | { | 8058 | { |
| 8059 | int hscroll_margin, text_area_x, text_area_y; | 8059 | int h_margin, text_area_x, text_area_y; |
| 8060 | int text_area_width, text_area_height; | 8060 | int text_area_width, text_area_height; |
| 8061 | struct glyph_row *current_cursor_row | 8061 | struct glyph_row *current_cursor_row |
| 8062 | = MATRIX_ROW (w->current_matrix, w->cursor.vpos); | 8062 | = MATRIX_ROW (w->current_matrix, w->cursor.vpos); |
| @@ -8071,14 +8071,13 @@ hscroll_window_tree (window) | |||
| 8071 | &text_area_width, &text_area_height); | 8071 | &text_area_width, &text_area_height); |
| 8072 | 8072 | ||
| 8073 | /* Scroll when cursor is inside this scroll margin. */ | 8073 | /* Scroll when cursor is inside this scroll margin. */ |
| 8074 | hscroll_margin | 8074 | h_margin = hscroll_margin * CANON_X_UNIT (XFRAME (w->frame)); |
| 8075 | = automatic_hscroll_margin * CANON_X_UNIT (XFRAME (w->frame)); | ||
| 8076 | 8075 | ||
| 8077 | if ((XFASTINT (w->hscroll) | 8076 | if ((XFASTINT (w->hscroll) |
| 8078 | && w->cursor.x <= hscroll_margin) | 8077 | && w->cursor.x <= h_margin) |
| 8079 | || (cursor_row->enabled_p | 8078 | || (cursor_row->enabled_p |
| 8080 | && cursor_row->truncated_on_right_p | 8079 | && cursor_row->truncated_on_right_p |
| 8081 | && (w->cursor.x >= text_area_width - hscroll_margin))) | 8080 | && (w->cursor.x >= text_area_width - h_margin))) |
| 8082 | { | 8081 | { |
| 8083 | struct it it; | 8082 | struct it it; |
| 8084 | int hscroll; | 8083 | int hscroll; |
| @@ -8110,15 +8109,15 @@ hscroll_window_tree (window) | |||
| 8110 | if (!hscroll_relative_p && hscroll_step_abs == 0) | 8109 | if (!hscroll_relative_p && hscroll_step_abs == 0) |
| 8111 | hscroll = max (0, it.current_x - text_area_width / 2) | 8110 | hscroll = max (0, it.current_x - text_area_width / 2) |
| 8112 | / CANON_X_UNIT (it.f); | 8111 | / CANON_X_UNIT (it.f); |
| 8113 | else if (w->cursor.x >= text_area_width - hscroll_margin) | 8112 | else if (w->cursor.x >= text_area_width - h_margin) |
| 8114 | { | 8113 | { |
| 8115 | if (hscroll_relative_p) | 8114 | if (hscroll_relative_p) |
| 8116 | wanted_x = text_area_width * (1 - hscroll_step_rel) | 8115 | wanted_x = text_area_width * (1 - hscroll_step_rel) |
| 8117 | - hscroll_margin; | 8116 | - h_margin; |
| 8118 | else | 8117 | else |
| 8119 | wanted_x = text_area_width | 8118 | wanted_x = text_area_width |
| 8120 | - hscroll_step_abs * CANON_X_UNIT (it.f) | 8119 | - hscroll_step_abs * CANON_X_UNIT (it.f) |
| 8121 | - hscroll_margin; | 8120 | - h_margin; |
| 8122 | hscroll | 8121 | hscroll |
| 8123 | = max (0, it.current_x - wanted_x) / CANON_X_UNIT (it.f); | 8122 | = max (0, it.current_x - wanted_x) / CANON_X_UNIT (it.f); |
| 8124 | } | 8123 | } |
| @@ -8126,10 +8125,10 @@ hscroll_window_tree (window) | |||
| 8126 | { | 8125 | { |
| 8127 | if (hscroll_relative_p) | 8126 | if (hscroll_relative_p) |
| 8128 | wanted_x = text_area_width * hscroll_step_rel | 8127 | wanted_x = text_area_width * hscroll_step_rel |
| 8129 | + hscroll_margin; | 8128 | + h_margin; |
| 8130 | else | 8129 | else |
| 8131 | wanted_x = hscroll_step_abs * CANON_X_UNIT (it.f) | 8130 | wanted_x = hscroll_step_abs * CANON_X_UNIT (it.f) |
| 8132 | + hscroll_margin; | 8131 | + h_margin; |
| 8133 | hscroll | 8132 | hscroll |
| 8134 | = max (0, it.current_x - wanted_x) / CANON_X_UNIT (it.f); | 8133 | = max (0, it.current_x - wanted_x) / CANON_X_UNIT (it.f); |
| 8135 | } | 8134 | } |
| @@ -15060,16 +15059,16 @@ go back to their normal size. */); | |||
| 15060 | nil means don't display a cursor there. */); | 15059 | nil means don't display a cursor there. */); |
| 15061 | cursor_in_non_selected_windows = 1; | 15060 | cursor_in_non_selected_windows = 1; |
| 15062 | 15061 | ||
| 15063 | DEFVAR_BOOL ("automatic-hscrolling", &automatic_hscrolling_p, | 15062 | DEFVAR_BOOL ("auto-hscroll-mode", &automatic_hscrolling_p, |
| 15064 | doc: /* *Non-nil means scroll the display automatically to make point visible. */); | 15063 | doc: /* *Non-nil means scroll the display automatically to make point visible. */); |
| 15065 | automatic_hscrolling_p = 1; | 15064 | automatic_hscrolling_p = 1; |
| 15066 | 15065 | ||
| 15067 | DEFVAR_INT ("automatic-hscroll-margin", &automatic_hscroll_margin, | 15066 | DEFVAR_INT ("hscroll-margin", &hscroll_margin, |
| 15068 | doc: /* *How many columns away from the window edge point is allowed to get | 15067 | doc: /* *How many columns away from the window edge point is allowed to get |
| 15069 | before automatic hscrolling will horizontally scroll the window. */); | 15068 | before automatic hscrolling will horizontally scroll the window. */); |
| 15070 | automatic_hscroll_margin = 5; | 15069 | hscroll_margin = 5; |
| 15071 | 15070 | ||
| 15072 | DEFVAR_LISP ("automatic-hscroll-step", &Vautomatic_hscroll_step, | 15071 | DEFVAR_LISP ("hscroll-step", &Vhscroll_step, |
| 15073 | doc: /* *How many columns to scroll the window when point gets too close to the edge. | 15072 | doc: /* *How many columns to scroll the window when point gets too close to the edge. |
| 15074 | When point is less than `automatic-hscroll-margin' columns from the window | 15073 | When point is less than `automatic-hscroll-margin' columns from the window |
| 15075 | edge, automatic hscrolling will scroll the window by the amount of columns | 15074 | edge, automatic hscrolling will scroll the window by the amount of columns |
| @@ -15085,7 +15084,7 @@ scroll more than the value given by the scroll step. | |||
| 15085 | 15084 | ||
| 15086 | Note that the lower bound for automatic hscrolling specified by `scroll-left' | 15085 | Note that the lower bound for automatic hscrolling specified by `scroll-left' |
| 15087 | and `scroll-right' overrides this variable's effect. */); | 15086 | and `scroll-right' overrides this variable's effect. */); |
| 15088 | Vautomatic_hscroll_step = make_number (0); | 15087 | Vhscroll_step = make_number (0); |
| 15089 | 15088 | ||
| 15090 | DEFVAR_LISP ("image-types", &Vimage_types, | 15089 | DEFVAR_LISP ("image-types", &Vimage_types, |
| 15091 | doc: /* List of supported image types. | 15090 | doc: /* List of supported image types. |