aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2006-09-06 07:30:39 +0000
committerMiles Bader2006-09-06 07:30:39 +0000
commitfae22cbf7f66b7adc732e46a27b821114c812fdd (patch)
treea1c7545e4579d1da9d7d00d98287b1bff4dd0c26 /src
parentaf6ea8ad8d62810d901561ae4a56d89f22ebacf0 (diff)
parent04e28558df772845d83d5e870300b755b2528b57 (diff)
downloademacs-fae22cbf7f66b7adc732e46a27b821114c812fdd.tar.gz
emacs-fae22cbf7f66b7adc732e46a27b821114c812fdd.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 423-426) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 131-133) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-109
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog26
-rw-r--r--src/editfns.c2
-rw-r--r--src/lisp.h2
-rw-r--r--src/window.c92
-rw-r--r--src/xdisp.c51
5 files changed, 126 insertions, 47 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 64b3b884bfa..a1194906fbb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,29 @@
12006-09-06 Kenichi Handa <handa@m17n.org>
2
3 * editfns.c (Fformat_time_string): Use make_unibyte_string to make
4 a Lisp string from the result of emacs_memftimeu call.
5
62006-09-06 Kim F. Storm <storm@cua.dk>
7
8 * xdisp.c (pos_visible_p): Remove exact_mode_line_heights_p arg;
9 so always calculate heights even when pos-visible-in-window-p is
10 called with partially = t. Don't overshoot last_visible_y in move_it_to.
11 Return row height and row number in new rowh and vpos args.
12 (cursor_row_fully_visible_p): First line is always "fully visible".
13 (try_window): Don't clear matrix if vscrolled.
14
15 * lisp.h (pos_visible_p): Update prototype.
16
17 * window.c (Fpos_visible_in_window_p): Adapt to new pos_visible_p.
18 Return row height and row number for partially visible rows.
19 Modify return value to a 2 element list for fully visible rows
20 and 6 for partially visible row.
21 (window_scroll_pixel_based): Use pos_visible_p directly instead of
22 Fpos_visible_in_window_p. Fix auto vscrolling for partially visible lines.
23 Only vscroll backwards if already vscrolled forwards. Unconditionally
24 vscroll forwards if PT is first (and only) line. Set new window start
25 instead of scrolling at start/end of tall line.
26
12006-09-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 272006-09-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 28
3 * macterm.c (install_window_handler, mac_handle_window_event) 29 * macterm.c (install_window_handler, mac_handle_window_event)
diff --git a/src/editfns.c b/src/editfns.c
index 2fcacc16901..10c5cbe1153 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1692,7 +1692,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */)
1692 SBYTES (format_string), 1692 SBYTES (format_string),
1693 tm, ut); 1693 tm, ut);
1694 if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0')) 1694 if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0'))
1695 return code_convert_string_norecord (make_string (buf, result), 1695 return code_convert_string_norecord (make_unibyte_string (buf, result),
1696 Vlocale_coding_system, 0); 1696 Vlocale_coding_system, 0);
1697 1697
1698 /* If buffer was too small, make it bigger and try again. */ 1698 /* If buffer was too small, make it bigger and try again. */
diff --git a/src/lisp.h b/src/lisp.h
index 7c6826d7bda..4421dfedf95 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2551,7 +2551,7 @@ extern void syms_of_xdisp P_ ((void));
2551extern void init_xdisp P_ ((void)); 2551extern void init_xdisp P_ ((void));
2552extern Lisp_Object safe_eval P_ ((Lisp_Object)); 2552extern Lisp_Object safe_eval P_ ((Lisp_Object));
2553extern int pos_visible_p P_ ((struct window *, int, int *, 2553extern int pos_visible_p P_ ((struct window *, int, int *,
2554 int *, int *, int *, int)); 2554 int *, int *, int *, int *, int *));
2555 2555
2556/* Defined in vm-limit.c. */ 2556/* Defined in vm-limit.c. */
2557extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ())); 2557extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ()));
diff --git a/src/window.c b/src/window.c
index 7f3e71ec145..4208323eab3 100644
--- a/src/window.c
+++ b/src/window.c
@@ -336,10 +336,12 @@ If POS is only out of view because of horizontal scrolling, return non-nil.
336POS defaults to point in WINDOW; WINDOW defaults to the selected window. 336POS defaults to point in WINDOW; WINDOW defaults to the selected window.
337 337
338If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, 338If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
339return value is a list (X Y PARTIAL) where X and Y are the pixel coordinates 339return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]),
340relative to the top left corner of the window. PARTIAL is nil if the character 340where X and Y are the pixel coordinates relative to the top left corner
341after POS is fully visible; otherwise it is a cons (RTOP . RBOT) where RTOP 341of the window. The remaining elements are omitted if the character after
342and RBOT are the number of pixels invisible at the top and bottom of the row. */) 342POS is fully visible; otherwise, RTOP and RBOT are the number of pixels
343invisible at the top and bottom of the row, ROWH is the height of the display
344row, and VPOS is the row number (0-based) containing POS. */)
343 (pos, window, partially) 345 (pos, window, partially)
344 Lisp_Object pos, window, partially; 346 Lisp_Object pos, window, partially;
345{ 347{
@@ -348,7 +350,7 @@ and RBOT are the number of pixels invisible at the top and bottom of the row. *
348 register struct buffer *buf; 350 register struct buffer *buf;
349 struct text_pos top; 351 struct text_pos top;
350 Lisp_Object in_window = Qnil; 352 Lisp_Object in_window = Qnil;
351 int rtop, rbot, fully_p = 1; 353 int rtop, rbot, rowh, vpos, fully_p = 1;
352 int x, y; 354 int x, y;
353 355
354 w = decode_window (window); 356 w = decode_window (window);
@@ -371,17 +373,20 @@ and RBOT are the number of pixels invisible at the top and bottom of the row. *
371 && posint <= BUF_ZV (buf) 373 && posint <= BUF_ZV (buf)
372 && CHARPOS (top) >= BUF_BEGV (buf) 374 && CHARPOS (top) >= BUF_BEGV (buf)
373 && CHARPOS (top) <= BUF_ZV (buf) 375 && CHARPOS (top) <= BUF_ZV (buf)
374 && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, NILP (partially)) 376 && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, &rowh, &vpos)
375 && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p))) 377 && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p)))
376 in_window = Qt; 378 in_window = Qt;
377 379
378 if (!NILP (in_window) && !NILP (partially)) 380 if (!NILP (in_window) && !NILP (partially))
379 in_window = Fcons (make_number (x), 381 {
380 Fcons (make_number (y), 382 Lisp_Object part = Qnil;
381 Fcons ((fully_p ? Qnil 383 if (!fully_p)
382 : Fcons (make_number (rtop), 384 part = list4 (make_number (rtop), make_number (rbot),
383 make_number (rbot))), 385 make_number (rowh), make_number (vpos));
384 Qnil))); 386 in_window = Fcons (make_number (x),
387 Fcons (make_number (y), part));
388 }
389
385 return in_window; 390 return in_window;
386} 391}
387 392
@@ -4818,10 +4823,10 @@ window_scroll_pixel_based (window, n, whole, noerror)
4818 struct it it; 4823 struct it it;
4819 struct window *w = XWINDOW (window); 4824 struct window *w = XWINDOW (window);
4820 struct text_pos start; 4825 struct text_pos start;
4821 Lisp_Object tem;
4822 int this_scroll_margin; 4826 int this_scroll_margin;
4823 /* True if we fiddled the window vscroll field without really scrolling. */ 4827 /* True if we fiddled the window vscroll field without really scrolling. */
4824 int vscrolled = 0; 4828 int vscrolled = 0;
4829 int x, y, rtop, rbot, rowh, vpos;
4825 4830
4826 SET_TEXT_POS_FROM_MARKER (start, w->start); 4831 SET_TEXT_POS_FROM_MARKER (start, w->start);
4827 4832
@@ -4829,8 +4834,8 @@ window_scroll_pixel_based (window, n, whole, noerror)
4829 the screen. Allow PT to be partially visible, otherwise 4834 the screen. Allow PT to be partially visible, otherwise
4830 something like (scroll-down 1) with PT in the line before 4835 something like (scroll-down 1) with PT in the line before
4831 the partially visible one would recenter. */ 4836 the partially visible one would recenter. */
4832 tem = Fpos_visible_in_window_p (make_number (PT), window, Qt); 4837
4833 if (NILP (tem)) 4838 if (!pos_visible_p (w, PT, &x, &y, &rtop, &rbot, &rowh, &vpos))
4834 { 4839 {
4835 /* Move backward half the height of the window. Performance note: 4840 /* Move backward half the height of the window. Performance note:
4836 vmotion used here is about 10% faster, but would give wrong 4841 vmotion used here is about 10% faster, but would give wrong
@@ -4855,7 +4860,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
4855 } 4860 }
4856 else if (auto_window_vscroll_p) 4861 else if (auto_window_vscroll_p)
4857 { 4862 {
4858 if (tem = XCAR (XCDR (XCDR (tem))), CONSP (tem)) 4863 if (rtop || rbot) /* partially visible */
4859 { 4864 {
4860 int px; 4865 int px;
4861 int dy = WINDOW_FRAME_LINE_HEIGHT (w); 4866 int dy = WINDOW_FRAME_LINE_HEIGHT (w);
@@ -4865,19 +4870,52 @@ window_scroll_pixel_based (window, n, whole, noerror)
4865 dy); 4870 dy);
4866 dy *= n; 4871 dy *= n;
4867 4872
4868 if (n < 0 && (px = XINT (XCAR (tem))) > 0) 4873 if (n < 0)
4869 { 4874 {
4870 px = max (0, -w->vscroll - min (px, -dy)); 4875 /* Only vscroll backwards if already vscrolled forwards. */
4871 Fset_window_vscroll (window, make_number (px), Qt); 4876 if (w->vscroll < 0 && rtop > 0)
4872 return; 4877 {
4878 px = max (0, -w->vscroll - min (rtop, -dy));
4879 Fset_window_vscroll (window, make_number (px), Qt);
4880 return;
4881 }
4873 } 4882 }
4874 if (n > 0 && (px = XINT (XCDR (tem))) > 0) 4883 if (n > 0)
4875 { 4884 {
4876 px = max (0, -w->vscroll + min (px, dy)); 4885 /* Do vscroll if already vscrolled or only display line. */
4877 Fset_window_vscroll (window, make_number (px), Qt); 4886 if (rbot > 0 && (w->vscroll < 0 || vpos == 0))
4878 return; 4887 {
4888 px = max (0, -w->vscroll + min (rbot, dy));
4889 Fset_window_vscroll (window, make_number (px), Qt);
4890 return;
4891 }
4892
4893 /* Maybe modify window start instead of scrolling. */
4894 if (rbot > 0 || w->vscroll < 0)
4895 {
4896 int spos;
4897
4898 Fset_window_vscroll (window, make_number (0), Qt);
4899 /* If there are other text lines above the current row,
4900 move window start to current row. Else to next row. */
4901 if (rbot > 0)
4902 spos = XINT (Fline_beginning_position (Qnil));
4903 else
4904 spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV);
4905 set_marker_restricted (w->start, make_number (spos),
4906 w->buffer);
4907 w->start_at_line_beg = Qt;
4908 w->update_mode_line = Qt;
4909 XSETFASTINT (w->last_modified, 0);
4910 XSETFASTINT (w->last_overlay_modified, 0);
4911 /* Set force_start so that redisplay_window will run the
4912 window-scroll-functions. */
4913 w->force_start = Qt;
4914 return;
4915 }
4879 } 4916 }
4880 } 4917 }
4918 /* Cancel previous vscroll. */
4881 Fset_window_vscroll (window, make_number (0), Qt); 4919 Fset_window_vscroll (window, make_number (0), Qt);
4882 } 4920 }
4883 4921
@@ -4918,7 +4956,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
4918 if (dy <= 0) 4956 if (dy <= 0)
4919 { 4957 {
4920 move_it_vertically_backward (&it, -dy); 4958 move_it_vertically_backward (&it, -dy);
4921 /* Ensure we actually does move, e.g. in case we are currently 4959 /* Ensure we actually do move, e.g. in case we are currently
4922 looking at an image that is taller that the window height. */ 4960 looking at an image that is taller that the window height. */
4923 while (start_pos == IT_CHARPOS (it) 4961 while (start_pos == IT_CHARPOS (it)
4924 && start_pos > BEGV) 4962 && start_pos > BEGV)
@@ -4928,7 +4966,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
4928 { 4966 {
4929 move_it_to (&it, ZV, -1, it.current_y + dy, -1, 4967 move_it_to (&it, ZV, -1, it.current_y + dy, -1,
4930 MOVE_TO_POS | MOVE_TO_Y); 4968 MOVE_TO_POS | MOVE_TO_Y);
4931 /* Ensure we actually does move, e.g. in case we are currently 4969 /* Ensure we actually do move, e.g. in case we are currently
4932 looking at an image that is taller that the window height. */ 4970 looking at an image that is taller that the window height. */
4933 while (start_pos == IT_CHARPOS (it) 4971 while (start_pos == IT_CHARPOS (it)
4934 && start_pos < ZV) 4972 && start_pos < ZV)
@@ -6656,7 +6694,7 @@ display marginal areas and the text area. */)
6656 CHECK_NATNUM (left_width); 6694 CHECK_NATNUM (left_width);
6657 if (!NILP (right_width)) 6695 if (!NILP (right_width))
6658 CHECK_NATNUM (right_width); 6696 CHECK_NATNUM (right_width);
6659 6697
6660 /* Do nothing on a tty. */ 6698 /* Do nothing on a tty. */
6661 if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) 6699 if (FRAME_WINDOW_P (WINDOW_XFRAME (w))
6662 && (!EQ (w->left_fringe_width, left_width) 6700 && (!EQ (w->left_fringe_width, left_width)
diff --git a/src/xdisp.c b/src/xdisp.c
index 0e60020f110..f26a4231e9d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1281,13 +1281,12 @@ line_bottom_y (it)
1281/* Return 1 if position CHARPOS is visible in window W. 1281/* Return 1 if position CHARPOS is visible in window W.
1282 If visible, set *X and *Y to pixel coordinates of top left corner. 1282 If visible, set *X and *Y to pixel coordinates of top left corner.
1283 Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS. 1283 Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS.
1284 EXACT_MODE_LINE_HEIGHTS_P non-zero means compute exact mode-line 1284 Set *ROWH and *VPOS to row's visible height and VPOS (row number). */
1285 and header-lines heights. */
1286 1285
1287int 1286int
1288pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) 1287pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos)
1289 struct window *w; 1288 struct window *w;
1290 int charpos, *x, *y, *rtop, *rbot, exact_mode_line_heights_p; 1289 int charpos, *x, *y, *rtop, *rbot, *rowh, *vpos;
1291{ 1290{
1292 struct it it; 1291 struct it it;
1293 struct text_pos top; 1292 struct text_pos top;
@@ -1305,22 +1304,19 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1305 1304
1306 SET_TEXT_POS_FROM_MARKER (top, w->start); 1305 SET_TEXT_POS_FROM_MARKER (top, w->start);
1307 1306
1308 /* Compute exact mode line heights, if requested. */ 1307 /* Compute exact mode line heights. */
1309 if (exact_mode_line_heights_p) 1308 if (WINDOW_WANTS_MODELINE_P (w))
1310 { 1309 current_mode_line_height
1311 if (WINDOW_WANTS_MODELINE_P (w)) 1310 = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
1312 current_mode_line_height 1311 current_buffer->mode_line_format);
1313 = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
1314 current_buffer->mode_line_format);
1315 1312
1316 if (WINDOW_WANTS_HEADER_LINE_P (w)) 1313 if (WINDOW_WANTS_HEADER_LINE_P (w))
1317 current_header_line_height 1314 current_header_line_height
1318 = display_mode_line (w, HEADER_LINE_FACE_ID, 1315 = display_mode_line (w, HEADER_LINE_FACE_ID,
1319 current_buffer->header_line_format); 1316 current_buffer->header_line_format);
1320 }
1321 1317
1322 start_display (&it, w, top); 1318 start_display (&it, w, top);
1323 move_it_to (&it, charpos, -1, it.last_visible_y, -1, 1319 move_it_to (&it, charpos, -1, it.last_visible_y-1, -1,
1324 MOVE_TO_POS | MOVE_TO_Y); 1320 MOVE_TO_POS | MOVE_TO_Y);
1325 1321
1326 /* Note that we may overshoot because of invisible text. */ 1322 /* Note that we may overshoot because of invisible text. */
@@ -1341,6 +1337,9 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1341 *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y); 1337 *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y);
1342 *rtop = max (0, window_top_y - top_y); 1338 *rtop = max (0, window_top_y - top_y);
1343 *rbot = max (0, bottom_y - it.last_visible_y); 1339 *rbot = max (0, bottom_y - it.last_visible_y);
1340 *rowh = max (0, (min (bottom_y, it.last_visible_y)
1341 - max (top_y, window_top_y)));
1342 *vpos = it.vpos;
1344 } 1343 }
1345 } 1344 }
1346 else 1345 else
@@ -1359,6 +1358,11 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1359 *rtop = max (0, -it2.current_y); 1358 *rtop = max (0, -it2.current_y);
1360 *rbot = max (0, ((it2.current_y + it2.max_ascent + it2.max_descent) 1359 *rbot = max (0, ((it2.current_y + it2.max_ascent + it2.max_descent)
1361 - it.last_visible_y)); 1360 - it.last_visible_y));
1361 *rowh = max (0, (min (it2.current_y + it2.max_ascent + it2.max_descent,
1362 it.last_visible_y)
1363 - max (it2.current_y,
1364 WINDOW_HEADER_LINE_HEIGHT (w))));
1365 *vpos = it2.vpos;
1362 } 1366 }
1363 } 1367 }
1364 1368
@@ -1370,6 +1374,15 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1370 if (visible_p && XFASTINT (w->hscroll) > 0) 1374 if (visible_p && XFASTINT (w->hscroll) > 0)
1371 *x -= XFASTINT (w->hscroll) * WINDOW_FRAME_COLUMN_WIDTH (w); 1375 *x -= XFASTINT (w->hscroll) * WINDOW_FRAME_COLUMN_WIDTH (w);
1372 1376
1377#if 0
1378 /* Debugging code. */
1379 if (visible_p)
1380 fprintf (stderr, "+pv pt=%d vs=%d --> x=%d y=%d rt=%d rb=%d rh=%d vp=%d\n",
1381 charpos, w->vscroll, *x, *y, *rtop, *rbot, *rowh, *vpos);
1382 else
1383 fprintf (stderr, "-pv pt=%d vs=%d\n", charpos, w->vscroll);
1384#endif
1385
1373 return visible_p; 1386 return visible_p;
1374} 1387}
1375 1388
@@ -12166,7 +12179,8 @@ cursor_row_fully_visible_p (w, force_p, current_matrix_p)
12166 window_height = window_box_height (w); 12179 window_height = window_box_height (w);
12167 if (row->height >= window_height) 12180 if (row->height >= window_height)
12168 { 12181 {
12169 if (!force_p || MINI_WINDOW_P (w) || w->vscroll) 12182 if (!force_p || MINI_WINDOW_P (w)
12183 || w->vscroll || w->cursor.vpos == 0)
12170 return 1; 12184 return 1;
12171 } 12185 }
12172 return 0; 12186 return 0;
@@ -13650,7 +13664,8 @@ try_window (window, pos, check_margins)
13650 this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); 13664 this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
13651 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); 13665 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
13652 13666
13653 if ((w->cursor.y < this_scroll_margin 13667 if ((w->cursor.y >= 0 /* not vscrolled */
13668 && w->cursor.y < this_scroll_margin
13654 && CHARPOS (pos) > BEGV 13669 && CHARPOS (pos) > BEGV
13655 && IT_CHARPOS (it) < ZV) 13670 && IT_CHARPOS (it) < ZV)
13656 /* rms: considering make_cursor_line_fully_visible_p here 13671 /* rms: considering make_cursor_line_fully_visible_p here