From: Kim F. Storm Date: Tue, 11 Oct 2005 15:07:28 +0000 (+0000) Subject: (make_lispy_position): Fix buffer calculations for X-Git-Tag: emacs-pretest-22.0.90~6666 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a65fc2c39764e81adc7359ce18e95f1990285b81;p=emacs.git (make_lispy_position): Fix buffer calculations for mouse click or movement in right fringe and the margins. --- diff --git a/src/keyboard.c b/src/keyboard.c index 1d118c7a57b..56419ef5679 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5090,21 +5090,37 @@ make_lispy_position (f, x, y, time) &object, &dx, &dy, &width, &height); if (STRINGP (string)) string_info = Fcons (string, make_number (charpos)); + if (part == ON_LEFT_MARGIN) + wx = 0; + else + wx = window_box_right_offset (w, TEXT_AREA) - 1; + } + else if (part == ON_LEFT_FRINGE) + { + posn = Qleft_fringe; + rx = 0; + dx = wx; + wx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? 0 + : window_box_width (w, LEFT_MARGIN_AREA)); + dx -= wx; } - else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE) + else if (part == ON_RIGHT_FRINGE) { - posn = (part == ON_LEFT_FRINGE) ? Qleft_fringe : Qright_fringe; + posn = Qright_fringe; rx = 0; dx = wx; - wx = (part == ON_LEFT_FRINGE) ? 0 : window_box_width (w, TEXT_AREA); - if (part == ON_RIGHT_FRINGE) - dx -= (window_box_width (w, LEFT_MARGIN_AREA) - + window_box_width (w, TEXT_AREA) - + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) - ? window_box_width (w, RIGHT_MARGIN_AREA) - : 0)); - else if (!WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) - dx -= window_box_width (w, LEFT_MARGIN_AREA); + wx = (window_box_width (w, LEFT_MARGIN_AREA) + + window_box_width (w, TEXT_AREA) + + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) + ? window_box_width (w, RIGHT_MARGIN_AREA) + : 0)); + dx -= wx; + } + else + { + /* Note: We have no special posn for part == ON_SCROLL_BAR. */ + wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); } if (textpos < 0) @@ -5113,7 +5129,6 @@ make_lispy_position (f, x, y, time) struct display_pos p; int dx2, dy2; int width2, height2; - wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); string2 = buffer_posn_from_coords (w, &wx, &wy, &p, &object2, &dx2, &dy2, &width2, &height2);