Commit 266821b0 authored by Martin Rudalics's avatar Martin Rudalics

Preliminary attempt to fix horizontal scroll bar dragging with bidi text.

* w32term.c (w32_horizontal_scroll_bar_handle_click): In y part
of emacs_event return length from si.nPage to si.nMax.
* xdisp.c (set_horizontal_scroll_bar): For right-to-left text
interchange start and end of thumb.
* scroll-bar.el (scroll-bar-horizontal-drag-1): Use cdr of
portion-whole for scrolling right-to-left text.
parent ed30c57c
2014-08-16 Martin Rudalics <rudalics@gmx.at>
* scroll-bar.el (scroll-bar-horizontal-drag-1): Use cdr of
portion-whole for scrolling right-to-left text.
2014-08-15 Leo Liu <sdl.web@gmail.com>
* speedbar.el (speedbar-generic-list-tag-p): Allow special
......
......@@ -327,8 +327,11 @@ If you click outside the slider, the window scrolls to bring the slider there."
(window (nth 0 start-position))
(portion-whole (nth 2 start-position))
(unit (frame-char-width (window-frame window))))
(set-window-hscroll
window (/ (1- (+ (car portion-whole) unit)) unit))))
(if (eq (current-bidi-paragraph-direction) 'left-to-right)
(set-window-hscroll
window (/ (1- (+ (car portion-whole) unit)) unit))
(set-window-hscroll
window (/ (1- (+ (cdr portion-whole) unit)) unit)))))
(defun scroll-bar-horizontal-drag (event)
"Scroll the window horizontally by dragging the scroll bar slider.
......
2014-08-16 Martin Rudalics <rudalics@gmx.at>
* w32term.c (w32_horizontal_scroll_bar_handle_click): In y part
of emacs_event return length from si.nPage to si.nMax.
* xdisp.c (set_horizontal_scroll_bar): For right-to-left text
interchange start and end of thumb.
2014-08-15 Ken Brown <kbrown@cornell.edu>
* gmalloc.c (_malloc_mutex, _aligned_blocks_mutex) [CYGWIN]: Use
......
......@@ -4272,15 +4272,15 @@ w32_horizontal_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg,
{
int left_range = HORIZONTAL_SCROLL_BAR_LEFT_RANGE (f, bar->width);
int x;
int x, y;
int dragging = bar->dragging;
SCROLLINFO si;
si.cbSize = sizeof (si);
si.fMask = SIF_POS;
si.fMask = SIF_POS | SIF_PAGE | SIF_RANGE;
GetScrollInfo ((HWND) msg->msg.lParam, SB_CTL, &si);
x = si.nPos;
y = si.nMax - si.nPos - si.nPage;
bar->dragging = 0;
FRAME_DISPLAY_INFO (f)->last_mouse_scroll_bar_pos = msg->msg.wParam;
......@@ -4354,7 +4354,7 @@ w32_horizontal_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg,
}
XSETINT (emacs_event->x, x);
XSETINT (emacs_event->y, left_range);
XSETINT (emacs_event->y, y);
return TRUE;
}
......
......@@ -15779,7 +15779,7 @@ set_vertical_scroll_bar (struct window *w)
void
set_horizontal_scroll_bar (struct window *w)
{
int start, end, whole, box_width;
int start, end, whole, portion;
if (!MINI_WINDOW_P (w)
|| (w == XWINDOW (minibuf_window)
......@@ -15806,14 +15806,25 @@ set_horizontal_scroll_bar (struct window *w)
MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); */
start = w->hscroll * FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w));
box_width = window_box_width (w, TEXT_AREA);
end = start + box_width;
end = start + window_box_width (w, TEXT_AREA);
portion = end - start;
/* After enlarging a horizontally scrolled window such that it
gets at least as wide as the text it contains, make sure that
the thumb doesn't fill the entire scroll bar so we can still
drag it back to see the entire text. */
whole = max (whole, end);
/* The following is needed to ensure that if after maximizing a
window we get hscroll > 0, we can still drag the thumb to the
left. */
whole = max (whole, w->hscroll + box_width);
whole = max (whole, end - start);
if (it.bidi_p)
{
Lisp_Object pdir;
pdir = Fcurrent_bidi_paragraph_direction (Qnil);
if (EQ (pdir, Qright_to_left))
{
start = whole - end;
end = start + portion;
}
}
if (old_buffer)
set_buffer_internal (old_buffer);
......@@ -15826,7 +15837,7 @@ set_horizontal_scroll_bar (struct window *w)
/* Indicate what this scroll bar ought to be displaying now. */
if (FRAME_TERMINAL (XFRAME (w->frame))->set_horizontal_scroll_bar_hook)
(*FRAME_TERMINAL (XFRAME (w->frame))->set_horizontal_scroll_bar_hook)
(w, end - start, whole, start);
(w, portion, whole, start);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment