diff options
| author | Dmitry Antipov | 2013-03-07 08:42:59 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-03-07 08:42:59 +0400 |
| commit | c54aa1668ec5c2626b3f9a84513b00d90dcf24c1 (patch) | |
| tree | 0277b558a7de2dece38c62056884d4bfdec8b2b3 /src | |
| parent | 3de717bdb483f7c6e23cd7701ee4ebd77eccb8b9 (diff) | |
| download | emacs-c54aa1668ec5c2626b3f9a84513b00d90dcf24c1.tar.gz emacs-c54aa1668ec5c2626b3f9a84513b00d90dcf24c1.zip | |
Avoid character to byte conversions in motion subroutines.
* indent.h (compute_motion, vmotion): Add byte position argument.
* indent.c (compute_motion): Use it and avoid CHAR_TO_BYTE.
Add eassert.
(Fcompute_motion): Break long line. Adjust call to compute_motion.
Use list5 for return value.
(vmotion): Use byte position argument and avoid call to CHAR_TO_BYTE.
Adjust comments, style and calls to compute_motion.
(Fvertical_motion): Adjust call to vmotion.
* window.c (Fdelete_other_windows_internal): Record window start
byte position and adjust call to vmotion.
(window_scroll_line_based): Likewise with call to compute_motion.
Use SET_PT_BOTH.
(Frecenter): Adjust calls to vmotion.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 17 | ||||
| -rw-r--r-- | src/indent.c | 75 | ||||
| -rw-r--r-- | src/indent.h | 12 | ||||
| -rw-r--r-- | src/window.c | 23 |
4 files changed, 66 insertions, 61 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index eee20d998dd..bc106df0cb2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,22 @@ | |||
| 1 | 2013-03-07 Dmitry Antipov <dmantipov@yandex.ru> | 1 | 2013-03-07 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 2 | ||
| 3 | Avoid character to byte conversions in motion subroutines. | ||
| 4 | * indent.h (compute_motion, vmotion): Add byte position argument. | ||
| 5 | * indent.c (compute_motion): Use it and avoid CHAR_TO_BYTE. | ||
| 6 | Add eassert. | ||
| 7 | (Fcompute_motion): Break long line. Adjust call to compute_motion. | ||
| 8 | Use list5 for return value. | ||
| 9 | (vmotion): Use byte position argument and avoid call to CHAR_TO_BYTE. | ||
| 10 | Adjust comments, style and calls to compute_motion. | ||
| 11 | (Fvertical_motion): Adjust call to vmotion. | ||
| 12 | * window.c (Fdelete_other_windows_internal): Record window start | ||
| 13 | byte position and adjust call to vmotion. | ||
| 14 | (window_scroll_line_based): Likewise with call to compute_motion. | ||
| 15 | Use SET_PT_BOTH. | ||
| 16 | (Frecenter): Adjust calls to vmotion. | ||
| 17 | |||
| 18 | 2013-03-07 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 19 | |||
| 3 | * lisp.h (list2i, list3i): New functions. | 20 | * lisp.h (list2i, list3i): New functions. |
| 4 | (list4i): Move from window.c and make LISP_INLINE. | 21 | (list4i): Move from window.c and make LISP_INLINE. |
| 5 | * editfns.c (make_lisp_time): | 22 | * editfns.c (make_lisp_time): |
diff --git a/src/indent.c b/src/indent.c index abb4e08ad08..fd692f0b149 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -1102,8 +1102,8 @@ static struct position val_compute_motion; | |||
| 1102 | the scroll bars if they are turned on. */ | 1102 | the scroll bars if they are turned on. */ |
| 1103 | 1103 | ||
| 1104 | struct position * | 1104 | struct position * |
| 1105 | compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, | 1105 | compute_motion (ptrdiff_t from, ptrdiff_t frombyte, EMACS_INT fromvpos, |
| 1106 | bool did_motion, ptrdiff_t to, | 1106 | EMACS_INT fromhpos, bool did_motion, ptrdiff_t to, |
| 1107 | EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width, | 1107 | EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width, |
| 1108 | ptrdiff_t hscroll, int tab_offset, struct window *win) | 1108 | ptrdiff_t hscroll, int tab_offset, struct window *win) |
| 1109 | { | 1109 | { |
| @@ -1186,8 +1186,11 @@ compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, | |||
| 1186 | immediate_quit = 1; | 1186 | immediate_quit = 1; |
| 1187 | QUIT; | 1187 | QUIT; |
| 1188 | 1188 | ||
| 1189 | /* It's just impossible to be too paranoid here. */ | ||
| 1190 | eassert (from == BYTE_TO_CHAR (frombyte) && frombyte == CHAR_TO_BYTE (from)); | ||
| 1191 | |||
| 1189 | pos = prev_pos = from; | 1192 | pos = prev_pos = from; |
| 1190 | pos_byte = prev_pos_byte = CHAR_TO_BYTE (from); | 1193 | pos_byte = prev_pos_byte = frombyte; |
| 1191 | contin_hpos = 0; | 1194 | contin_hpos = 0; |
| 1192 | prev_tab_offset = tab_offset; | 1195 | prev_tab_offset = tab_offset; |
| 1193 | memset (&cmp_it, 0, sizeof cmp_it); | 1196 | memset (&cmp_it, 0, sizeof cmp_it); |
| @@ -1724,7 +1727,8 @@ of a certain window, pass the window's starting location as FROM | |||
| 1724 | and the window's upper-left coordinates as FROMPOS. | 1727 | and the window's upper-left coordinates as FROMPOS. |
| 1725 | Pass the buffer's (point-max) as TO, to limit the scan to the end of the | 1728 | Pass the buffer's (point-max) as TO, to limit the scan to the end of the |
| 1726 | visible section of the buffer, and pass LINE and COL as TOPOS. */) | 1729 | visible section of the buffer, and pass LINE and COL as TOPOS. */) |
| 1727 | (Lisp_Object from, Lisp_Object frompos, Lisp_Object to, Lisp_Object topos, Lisp_Object width, Lisp_Object offsets, Lisp_Object window) | 1730 | (Lisp_Object from, Lisp_Object frompos, Lisp_Object to, Lisp_Object topos, |
| 1731 | Lisp_Object width, Lisp_Object offsets, Lisp_Object window) | ||
| 1728 | { | 1732 | { |
| 1729 | struct window *w; | 1733 | struct window *w; |
| 1730 | Lisp_Object bufpos, hpos, vpos, prevhpos; | 1734 | Lisp_Object bufpos, hpos, vpos, prevhpos; |
| @@ -1767,7 +1771,8 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */) | |||
| 1767 | if (XINT (to) < BEGV || XINT (to) > ZV) | 1771 | if (XINT (to) < BEGV || XINT (to) > ZV) |
| 1768 | args_out_of_range_3 (to, make_number (BEGV), make_number (ZV)); | 1772 | args_out_of_range_3 (to, make_number (BEGV), make_number (ZV)); |
| 1769 | 1773 | ||
| 1770 | pos = compute_motion (XINT (from), XINT (XCDR (frompos)), | 1774 | pos = compute_motion (XINT (from), CHAR_TO_BYTE (XINT (from)), |
| 1775 | XINT (XCDR (frompos)), | ||
| 1771 | XINT (XCAR (frompos)), 0, | 1776 | XINT (XCAR (frompos)), 0, |
| 1772 | XINT (to), | 1777 | XINT (to), |
| 1773 | (NILP (topos) | 1778 | (NILP (topos) |
| @@ -1789,28 +1794,23 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */) | |||
| 1789 | XSETINT (vpos, pos->vpos); | 1794 | XSETINT (vpos, pos->vpos); |
| 1790 | XSETINT (prevhpos, pos->prevhpos); | 1795 | XSETINT (prevhpos, pos->prevhpos); |
| 1791 | 1796 | ||
| 1792 | return Fcons (bufpos, | 1797 | return list5 (bufpos, hpos, vpos, prevhpos, pos->contin ? Qt : Qnil); |
| 1793 | Fcons (hpos, | ||
| 1794 | Fcons (vpos, | ||
| 1795 | Fcons (prevhpos, | ||
| 1796 | Fcons (pos->contin ? Qt : Qnil, Qnil))))); | ||
| 1797 | |||
| 1798 | } | 1798 | } |
| 1799 | 1799 | ||
| 1800 | /* Fvertical_motion and vmotion */ | 1800 | /* Fvertical_motion and vmotion. */ |
| 1801 | 1801 | ||
| 1802 | static struct position val_vmotion; | 1802 | static struct position val_vmotion; |
| 1803 | 1803 | ||
| 1804 | struct position * | 1804 | struct position * |
| 1805 | vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w) | 1805 | vmotion (register ptrdiff_t from, register ptrdiff_t from_byte, |
| 1806 | register EMACS_INT vtarget, struct window *w) | ||
| 1806 | { | 1807 | { |
| 1807 | ptrdiff_t hscroll = w->hscroll; | 1808 | ptrdiff_t hscroll = w->hscroll; |
| 1808 | struct position pos; | 1809 | struct position pos; |
| 1809 | /* vpos is cumulative vertical position, changed as from is changed */ | 1810 | /* VPOS is cumulative vertical position, changed as from is changed. */ |
| 1810 | register EMACS_INT vpos = 0; | 1811 | register EMACS_INT vpos = 0; |
| 1811 | ptrdiff_t prevline; | 1812 | ptrdiff_t prevline; |
| 1812 | register ptrdiff_t first; | 1813 | register ptrdiff_t first; |
| 1813 | ptrdiff_t from_byte; | ||
| 1814 | ptrdiff_t lmargin = hscroll > 0 ? 1 - hscroll : 0; | 1814 | ptrdiff_t lmargin = hscroll > 0 ? 1 - hscroll : 0; |
| 1815 | ptrdiff_t selective | 1815 | ptrdiff_t selective |
| 1816 | = (INTEGERP (BVAR (current_buffer, selective_display)) | 1816 | = (INTEGERP (BVAR (current_buffer, selective_display)) |
| @@ -1854,29 +1854,24 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w) | |||
| 1854 | text_prop_object), | 1854 | text_prop_object), |
| 1855 | TEXT_PROP_MEANS_INVISIBLE (propval)))) | 1855 | TEXT_PROP_MEANS_INVISIBLE (propval)))) |
| 1856 | prevline = find_newline_no_quit (prevline - 1, -1, &bytepos); | 1856 | prevline = find_newline_no_quit (prevline - 1, -1, &bytepos); |
| 1857 | pos = *compute_motion (prevline, 0, | 1857 | pos = *compute_motion (prevline, bytepos, 0, lmargin, 0, from, |
| 1858 | lmargin, | ||
| 1859 | 0, | ||
| 1860 | from, | ||
| 1861 | /* Don't care for VPOS... */ | 1858 | /* Don't care for VPOS... */ |
| 1862 | 1 << (BITS_PER_SHORT - 1), | 1859 | 1 << (BITS_PER_SHORT - 1), |
| 1863 | /* ... nor HPOS. */ | 1860 | /* ... nor HPOS. */ |
| 1864 | 1 << (BITS_PER_SHORT - 1), | 1861 | 1 << (BITS_PER_SHORT - 1), |
| 1865 | -1, hscroll, | 1862 | -1, hscroll, 0, w); |
| 1866 | 0, | ||
| 1867 | w); | ||
| 1868 | vpos -= pos.vpos; | 1863 | vpos -= pos.vpos; |
| 1869 | first = 0; | 1864 | first = 0; |
| 1870 | from = prevline; | 1865 | from = prevline; |
| 1866 | from_byte = bytepos; | ||
| 1871 | } | 1867 | } |
| 1872 | 1868 | ||
| 1873 | /* If we made exactly the desired vertical distance, | 1869 | /* If we made exactly the desired vertical distance, or |
| 1874 | or if we hit beginning of buffer, | 1870 | if we hit beginning of buffer, return point found. */ |
| 1875 | return point found */ | ||
| 1876 | if (vpos >= vtarget) | 1871 | if (vpos >= vtarget) |
| 1877 | { | 1872 | { |
| 1878 | val_vmotion.bufpos = from; | 1873 | val_vmotion.bufpos = from; |
| 1879 | val_vmotion.bytepos = CHAR_TO_BYTE (from); | 1874 | val_vmotion.bytepos = from_byte; |
| 1880 | val_vmotion.vpos = vpos; | 1875 | val_vmotion.vpos = vpos; |
| 1881 | val_vmotion.hpos = lmargin; | 1876 | val_vmotion.hpos = lmargin; |
| 1882 | val_vmotion.contin = 0; | 1877 | val_vmotion.contin = 0; |
| @@ -1884,11 +1879,12 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w) | |||
| 1884 | return &val_vmotion; | 1879 | return &val_vmotion; |
| 1885 | } | 1880 | } |
| 1886 | 1881 | ||
| 1887 | /* Otherwise find the correct spot by moving down */ | 1882 | /* Otherwise find the correct spot by moving down. */ |
| 1888 | } | 1883 | } |
| 1889 | /* Moving downward is simple, but must calculate from beg of line | 1884 | |
| 1890 | to determine hpos of starting point */ | 1885 | /* Moving downward is simple, but must calculate from |
| 1891 | from_byte = CHAR_TO_BYTE (from); | 1886 | beg of line to determine hpos of starting point. */ |
| 1887 | |||
| 1892 | if (from > BEGV && FETCH_BYTE (from_byte - 1) != '\n') | 1888 | if (from > BEGV && FETCH_BYTE (from_byte - 1) != '\n') |
| 1893 | { | 1889 | { |
| 1894 | ptrdiff_t bytepos; | 1890 | ptrdiff_t bytepos; |
| @@ -1905,17 +1901,12 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w) | |||
| 1905 | text_prop_object), | 1901 | text_prop_object), |
| 1906 | TEXT_PROP_MEANS_INVISIBLE (propval)))) | 1902 | TEXT_PROP_MEANS_INVISIBLE (propval)))) |
| 1907 | prevline = find_newline_no_quit (prevline - 1, -1, &bytepos); | 1903 | prevline = find_newline_no_quit (prevline - 1, -1, &bytepos); |
| 1908 | pos = *compute_motion (prevline, 0, | 1904 | pos = *compute_motion (prevline, bytepos, 0, lmargin, 0, from, |
| 1909 | lmargin, | ||
| 1910 | 0, | ||
| 1911 | from, | ||
| 1912 | /* Don't care for VPOS... */ | 1905 | /* Don't care for VPOS... */ |
| 1913 | 1 << (BITS_PER_SHORT - 1), | 1906 | 1 << (BITS_PER_SHORT - 1), |
| 1914 | /* ... nor HPOS. */ | 1907 | /* ... nor HPOS. */ |
| 1915 | 1 << (BITS_PER_SHORT - 1), | 1908 | 1 << (BITS_PER_SHORT - 1), |
| 1916 | -1, hscroll, | 1909 | -1, hscroll, 0, w); |
| 1917 | 0, | ||
| 1918 | w); | ||
| 1919 | did_motion = 1; | 1910 | did_motion = 1; |
| 1920 | } | 1911 | } |
| 1921 | else | 1912 | else |
| @@ -1924,11 +1915,9 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w) | |||
| 1924 | pos.vpos = 0; | 1915 | pos.vpos = 0; |
| 1925 | did_motion = 0; | 1916 | did_motion = 0; |
| 1926 | } | 1917 | } |
| 1927 | return compute_motion (from, vpos, pos.hpos, did_motion, | 1918 | return compute_motion (from, from_byte, vpos, pos.hpos, did_motion, |
| 1928 | ZV, vtarget, - (1 << (BITS_PER_SHORT - 1)), | 1919 | ZV, vtarget, - (1 << (BITS_PER_SHORT - 1)), |
| 1929 | -1, hscroll, | 1920 | -1, hscroll, 0, w); |
| 1930 | 0, | ||
| 1931 | w); | ||
| 1932 | } | 1921 | } |
| 1933 | 1922 | ||
| 1934 | DEFUN ("vertical-motion", Fvertical_motion, Svertical_motion, 1, 2, 0, | 1923 | DEFUN ("vertical-motion", Fvertical_motion, Svertical_motion, 1, 2, 0, |
| @@ -1995,7 +1984,7 @@ whether or not it is currently displayed in some window. */) | |||
| 1995 | if (noninteractive) | 1984 | if (noninteractive) |
| 1996 | { | 1985 | { |
| 1997 | struct position pos; | 1986 | struct position pos; |
| 1998 | pos = *vmotion (PT, XINT (lines), w); | 1987 | pos = *vmotion (PT, PT_BYTE, XINT (lines), w); |
| 1999 | SET_PT_BOTH (pos.bufpos, pos.bytepos); | 1988 | SET_PT_BOTH (pos.bufpos, pos.bytepos); |
| 2000 | } | 1989 | } |
| 2001 | else | 1990 | else |
diff --git a/src/indent.h b/src/indent.h index acfd952754e..4eb3fed6a11 100644 --- a/src/indent.h +++ b/src/indent.h | |||
| @@ -26,14 +26,14 @@ struct position | |||
| 26 | int contin; | 26 | int contin; |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | struct position *compute_motion (ptrdiff_t from, EMACS_INT fromvpos, | 29 | struct position *compute_motion (ptrdiff_t from, ptrdiff_t frombyte, |
| 30 | EMACS_INT fromhpos, bool did_motion, | 30 | EMACS_INT fromvpos, EMACS_INT fromhpos, |
| 31 | ptrdiff_t to, EMACS_INT tovpos, | 31 | bool did_motion, ptrdiff_t to, |
| 32 | EMACS_INT tohpos, | 32 | EMACS_INT tovpos, EMACS_INT tohpos, |
| 33 | EMACS_INT width, ptrdiff_t hscroll, | 33 | EMACS_INT width, ptrdiff_t hscroll, |
| 34 | int tab_offset, struct window *); | 34 | int tab_offset, struct window *); |
| 35 | struct position *vmotion (ptrdiff_t from, EMACS_INT vtarget, | 35 | struct position *vmotion (ptrdiff_t from, ptrdiff_t from_byte, |
| 36 | struct window *); | 36 | EMACS_INT vtarget, struct window *); |
| 37 | ptrdiff_t skip_invisible (ptrdiff_t pos, ptrdiff_t *next_boundary_p, | 37 | ptrdiff_t skip_invisible (ptrdiff_t pos, ptrdiff_t *next_boundary_p, |
| 38 | ptrdiff_t to, Lisp_Object window); | 38 | ptrdiff_t to, Lisp_Object window); |
| 39 | 39 | ||
diff --git a/src/window.c b/src/window.c index ed0c1283abe..77696131512 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -2743,7 +2743,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2743 | struct window *w, *r, *s; | 2743 | struct window *w, *r, *s; |
| 2744 | struct frame *f; | 2744 | struct frame *f; |
| 2745 | Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta; | 2745 | Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta; |
| 2746 | ptrdiff_t startpos IF_LINT (= 0); | 2746 | ptrdiff_t startpos IF_LINT (= 0), startbyte IF_LINT (= 0); |
| 2747 | int top IF_LINT (= 0), new_top, resize_failed; | 2747 | int top IF_LINT (= 0), new_top, resize_failed; |
| 2748 | 2748 | ||
| 2749 | w = decode_valid_window (window); | 2749 | w = decode_valid_window (window); |
| @@ -2782,6 +2782,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2782 | if (!NILP (w->buffer)) | 2782 | if (!NILP (w->buffer)) |
| 2783 | { | 2783 | { |
| 2784 | startpos = marker_position (w->start); | 2784 | startpos = marker_position (w->start); |
| 2785 | startbyte = marker_byte_position (w->start); | ||
| 2785 | top = WINDOW_TOP_EDGE_LINE (w) | 2786 | top = WINDOW_TOP_EDGE_LINE (w) |
| 2786 | - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); | 2787 | - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); |
| 2787 | /* Make sure WINDOW is the frame's selected window. */ | 2788 | /* Make sure WINDOW is the frame's selected window. */ |
| @@ -2951,7 +2952,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2951 | Fset_buffer (w->buffer); | 2952 | Fset_buffer (w->buffer); |
| 2952 | /* This computation used to temporarily move point, but that | 2953 | /* This computation used to temporarily move point, but that |
| 2953 | can have unwanted side effects due to text properties. */ | 2954 | can have unwanted side effects due to text properties. */ |
| 2954 | pos = *vmotion (startpos, -top, w); | 2955 | pos = *vmotion (startpos, startbyte, -top, w); |
| 2955 | 2956 | ||
| 2956 | set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); | 2957 | set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); |
| 2957 | w->window_end_valid = 0; | 2958 | w->window_end_valid = 0; |
| @@ -4748,7 +4749,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4748 | register Lisp_Object tem; | 4749 | register Lisp_Object tem; |
| 4749 | int lose; | 4750 | int lose; |
| 4750 | Lisp_Object bolp; | 4751 | Lisp_Object bolp; |
| 4751 | ptrdiff_t startpos; | 4752 | ptrdiff_t startpos = marker_position (w->start); |
| 4753 | ptrdiff_t startbyte = marker_byte_position (w->start); | ||
| 4752 | Lisp_Object original_pos = Qnil; | 4754 | Lisp_Object original_pos = Qnil; |
| 4753 | 4755 | ||
| 4754 | /* If scrolling screen-fulls, compute the number of lines to | 4756 | /* If scrolling screen-fulls, compute the number of lines to |
| @@ -4756,8 +4758,6 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4756 | if (whole) | 4758 | if (whole) |
| 4757 | n *= max (1, ht - next_screen_context_lines); | 4759 | n *= max (1, ht - next_screen_context_lines); |
| 4758 | 4760 | ||
| 4759 | startpos = marker_position (w->start); | ||
| 4760 | |||
| 4761 | if (!NILP (Vscroll_preserve_screen_position)) | 4761 | if (!NILP (Vscroll_preserve_screen_position)) |
| 4762 | { | 4762 | { |
| 4763 | if (window_scroll_preserve_vpos <= 0 | 4763 | if (window_scroll_preserve_vpos <= 0 |
| @@ -4765,10 +4765,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4765 | || NILP (Fget (KVAR (current_kboard, Vlast_command), Qscroll_command))) | 4765 | || NILP (Fget (KVAR (current_kboard, Vlast_command), Qscroll_command))) |
| 4766 | { | 4766 | { |
| 4767 | struct position posit | 4767 | struct position posit |
| 4768 | = *compute_motion (startpos, 0, 0, 0, | 4768 | = *compute_motion (startpos, startbyte, 0, 0, 0, |
| 4769 | PT, ht, 0, | 4769 | PT, ht, 0, -1, w->hscroll, 0, w); |
| 4770 | -1, w->hscroll, | ||
| 4771 | 0, w); | ||
| 4772 | window_scroll_preserve_vpos = posit.vpos; | 4770 | window_scroll_preserve_vpos = posit.vpos; |
| 4773 | window_scroll_preserve_hpos = posit.hpos + w->hscroll; | 4771 | window_scroll_preserve_hpos = posit.hpos + w->hscroll; |
| 4774 | } | 4772 | } |
| @@ -4784,9 +4782,10 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4784 | { | 4782 | { |
| 4785 | Fvertical_motion (make_number (- (ht / 2)), window); | 4783 | Fvertical_motion (make_number (- (ht / 2)), window); |
| 4786 | startpos = PT; | 4784 | startpos = PT; |
| 4785 | startbyte = PT_BYTE; | ||
| 4787 | } | 4786 | } |
| 4788 | 4787 | ||
| 4789 | SET_PT (startpos); | 4788 | SET_PT_BOTH (startpos, startbyte); |
| 4790 | lose = n < 0 && PT == BEGV; | 4789 | lose = n < 0 && PT == BEGV; |
| 4791 | Fvertical_motion (make_number (n), window); | 4790 | Fvertical_motion (make_number (n), window); |
| 4792 | pos = PT; | 4791 | pos = PT; |
| @@ -5321,7 +5320,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5321 | 5320 | ||
| 5322 | iarg = max (iarg, this_scroll_margin); | 5321 | iarg = max (iarg, this_scroll_margin); |
| 5323 | 5322 | ||
| 5324 | pos = *vmotion (PT, -iarg, w); | 5323 | pos = *vmotion (PT, PT_BYTE, -iarg, w); |
| 5325 | charpos = pos.bufpos; | 5324 | charpos = pos.bufpos; |
| 5326 | bytepos = pos.bytepos; | 5325 | bytepos = pos.bytepos; |
| 5327 | } | 5326 | } |
| @@ -5340,7 +5339,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5340 | iarg = clip_to_bounds (this_scroll_margin, iarg, | 5339 | iarg = clip_to_bounds (this_scroll_margin, iarg, |
| 5341 | ht - this_scroll_margin - 1); | 5340 | ht - this_scroll_margin - 1); |
| 5342 | 5341 | ||
| 5343 | pos = *vmotion (PT, - iarg, w); | 5342 | pos = *vmotion (PT, PT_BYTE, - iarg, w); |
| 5344 | charpos = pos.bufpos; | 5343 | charpos = pos.bufpos; |
| 5345 | bytepos = pos.bytepos; | 5344 | bytepos = pos.bytepos; |
| 5346 | } | 5345 | } |