comparison src/xdisp.c @ 43659:49dc01d3bc00

(syms_of_xdisp) <auto-hscroll-mode>: Renamed from automatic-hscrolling. Users changed. <hscroll-margin>: Renamed from automatic-hscroll-margin. Users changed. <hscroll-step>: Renamed from automatic-hscroll-step. Users changed.
author Eli Zaretskii <eliz@gnu.org>
date Sun, 03 Mar 2002 17:28:52 +0000
parents b7964dae2379
children 65b7d85cfbc1
comparison
equal deleted inserted replaced
43658:66852c480a4d 43659:49dc01d3bc00
582 582
583 int automatic_hscrolling_p; 583 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
594 Lisp_Object Vimage_types; 594 Lisp_Object Vimage_types;
595 595
8022 static int 8022 static int
8023 hscroll_window_tree (window) 8023 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 }
8046 else 8046 else
8047 hscroll_step_abs = 0; 8047 hscroll_step_abs = 0;
8054 hscrolled_p |= hscroll_window_tree (w->hchild); 8054 hscrolled_p |= hscroll_window_tree (w->hchild);
8055 else if (WINDOWP (w->vchild)) 8055 else if (WINDOWP (w->vchild))
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);
8063 struct glyph_row *desired_cursor_row 8063 struct glyph_row *desired_cursor_row
8064 = MATRIX_ROW (w->desired_matrix, w->cursor.vpos); 8064 = MATRIX_ROW (w->desired_matrix, w->cursor.vpos);
8069 8069
8070 window_box (w, TEXT_AREA, &text_area_x, &text_area_y, 8070 window_box (w, TEXT_AREA, &text_area_x, &text_area_y,
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;
8085 struct buffer *saved_current_buffer; 8084 struct buffer *saved_current_buffer;
8086 int pt; 8085 int pt;
8108 8107
8109 /* Position cursor in window. */ 8108 /* Position cursor in 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 }
8125 else 8124 else
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 }
8136 hscroll = max (hscroll, XFASTINT (w->min_hscroll)); 8135 hscroll = max (hscroll, XFASTINT (w->min_hscroll));
8137 8136
15058 &cursor_in_non_selected_windows, 15057 &cursor_in_non_selected_windows,
15059 doc: /* *Non-nil means display a hollow cursor in non-selected windows. 15058 doc: /* *Non-nil means display a hollow cursor in non-selected windows.
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
15076 determined by this variable. If its value is a positive integer, scroll that 15075 determined by this variable. If its value is a positive integer, scroll that
15077 many columns. If it's a positive floating-point number, it specifies the 15076 many columns. If it's a positive floating-point number, it specifies the
15083 point was more than scroll step columns inside the margin, the window will 15082 point was more than scroll step columns inside the margin, the window will
15084 scroll more than the value given by the scroll step. 15083 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.
15092 Each element of the list is a symbol for a supported image type. */); 15091 Each element of the list is a symbol for a supported image type. */);
15093 Vimage_types = Qnil; 15092 Vimage_types = Qnil;