diff options
| author | Eli Zaretskii | 2014-02-19 19:32:29 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2014-02-19 19:32:29 +0200 |
| commit | d34f67dae3caa277bfebe0aa9f60e83a22bce0eb (patch) | |
| tree | 60aaa93a0d278989576ce05f61167cc4467ca139 /src | |
| parent | c021382022a9b5d1e61415f219eaa2b31a8c1a29 (diff) | |
| download | emacs-d34f67dae3caa277bfebe0aa9f60e83a22bce0eb.tar.gz emacs-d34f67dae3caa277bfebe0aa9f60e83a22bce0eb.zip | |
Fix bug #16806 with horizontal scrolling of images when fringes are disabled.
src/xdisp.c (display_line): Fix horizontal scrolling of large images
when fringes are turned off. This comes at a price of not
displaying the truncation/continuation glyphs in this case.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 41 |
2 files changed, 33 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index cbc48a75469..f89f7e084ff 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2014-02-19 Eli Zaretskii <eliz@gnu.org> | 1 | 2014-02-19 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * xdisp.c (display_line): Fix horizontal scrolling of large images | ||
| 4 | when fringes are turned off. This comes at a price of not | ||
| 5 | displaying the truncation/continuation glyphs in this case. | ||
| 6 | (Bug#16806) | ||
| 7 | |||
| 3 | * image.c (x_create_x_image_and_pixmap) [HAVE_NTGUI]: If | 8 | * image.c (x_create_x_image_and_pixmap) [HAVE_NTGUI]: If |
| 4 | CreateDIBSection returns an error indication, zero out *ximg after | 9 | CreateDIBSection returns an error indication, zero out *ximg after |
| 5 | destroying the image. This avoids crashes in memory allocations | 10 | destroying the image. This avoids crashes in memory allocations |
diff --git a/src/xdisp.c b/src/xdisp.c index d941c7b1086..b9908c6c9c6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -20119,7 +20119,12 @@ display_line (struct it *it) | |||
| 20119 | /* If we truncate lines, we are done when the last displayed | 20119 | /* If we truncate lines, we are done when the last displayed |
| 20120 | glyphs reach past the right margin of the window. */ | 20120 | glyphs reach past the right margin of the window. */ |
| 20121 | if (it->line_wrap == TRUNCATE | 20121 | if (it->line_wrap == TRUNCATE |
| 20122 | && (FRAME_WINDOW_P (it->f) && WINDOW_RIGHT_FRINGE_WIDTH (it->w) | 20122 | && ((FRAME_WINDOW_P (it->f) |
| 20123 | /* Images are preprocessed in produce_image_glyph such | ||
| 20124 | that they are cropped at the right edge of the | ||
| 20125 | window, so an image glyph will always end exactly at | ||
| 20126 | last_visible_x, even if there's no right fringe. */ | ||
| 20127 | && (WINDOW_RIGHT_FRINGE_WIDTH (it->w) || it->what == IT_IMAGE)) | ||
| 20123 | ? (it->current_x >= it->last_visible_x) | 20128 | ? (it->current_x >= it->last_visible_x) |
| 20124 | : (it->current_x > it->last_visible_x))) | 20129 | : (it->current_x > it->last_visible_x))) |
| 20125 | { | 20130 | { |
| @@ -20152,19 +20157,26 @@ display_line (struct it *it) | |||
| 20152 | i = row->used[TEXT_AREA] - (i + 1); | 20157 | i = row->used[TEXT_AREA] - (i + 1); |
| 20153 | } | 20158 | } |
| 20154 | 20159 | ||
| 20155 | it->current_x = x_before; | 20160 | /* produce_special_glyphs overwrites the last glyph, so |
| 20156 | if (!FRAME_WINDOW_P (it->f)) | 20161 | we don't want that if we want to keep that last |
| 20162 | glyph, which means it's an image. */ | ||
| 20163 | if (it->current_x > it->last_visible_x) | ||
| 20157 | { | 20164 | { |
| 20158 | for (n = row->used[TEXT_AREA]; i < n; ++i) | 20165 | it->current_x = x_before; |
| 20166 | if (!FRAME_WINDOW_P (it->f)) | ||
| 20167 | { | ||
| 20168 | for (n = row->used[TEXT_AREA]; i < n; ++i) | ||
| 20169 | { | ||
| 20170 | row->used[TEXT_AREA] = i; | ||
| 20171 | produce_special_glyphs (it, IT_TRUNCATION); | ||
| 20172 | } | ||
| 20173 | } | ||
| 20174 | else | ||
| 20159 | { | 20175 | { |
| 20160 | row->used[TEXT_AREA] = i; | 20176 | row->used[TEXT_AREA] = i; |
| 20161 | produce_special_glyphs (it, IT_TRUNCATION); | 20177 | produce_special_glyphs (it, IT_TRUNCATION); |
| 20162 | } | 20178 | } |
| 20163 | } | 20179 | it->hpos = hpos_before; |
| 20164 | else | ||
| 20165 | { | ||
| 20166 | row->used[TEXT_AREA] = i; | ||
| 20167 | produce_special_glyphs (it, IT_TRUNCATION); | ||
| 20168 | } | 20180 | } |
| 20169 | } | 20181 | } |
| 20170 | else if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) | 20182 | else if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) |
| @@ -20183,13 +20195,13 @@ display_line (struct it *it) | |||
| 20183 | goto at_end_of_line; | 20195 | goto at_end_of_line; |
| 20184 | } | 20196 | } |
| 20185 | it->current_x = x_before; | 20197 | it->current_x = x_before; |
| 20198 | it->hpos = hpos_before; | ||
| 20186 | } | 20199 | } |
| 20187 | 20200 | ||
| 20188 | row->truncated_on_right_p = 1; | 20201 | row->truncated_on_right_p = 1; |
| 20189 | it->continuation_lines_width = 0; | 20202 | it->continuation_lines_width = 0; |
| 20190 | reseat_at_next_visible_line_start (it, 0); | 20203 | reseat_at_next_visible_line_start (it, 0); |
| 20191 | row->ends_at_zv_p = FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n'; | 20204 | row->ends_at_zv_p = FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n'; |
| 20192 | it->hpos = hpos_before; | ||
| 20193 | break; | 20205 | break; |
| 20194 | } | 20206 | } |
| 20195 | } | 20207 | } |
| @@ -20203,9 +20215,12 @@ display_line (struct it *it) | |||
| 20203 | && IT_CHARPOS (*it) != CHARPOS (row->start.pos)) | 20215 | && IT_CHARPOS (*it) != CHARPOS (row->start.pos)) |
| 20204 | { | 20216 | { |
| 20205 | if (!FRAME_WINDOW_P (it->f) | 20217 | if (!FRAME_WINDOW_P (it->f) |
| 20206 | || (row->reversed_p | 20218 | || (((row->reversed_p |
| 20207 | ? WINDOW_RIGHT_FRINGE_WIDTH (it->w) | 20219 | ? WINDOW_RIGHT_FRINGE_WIDTH (it->w) |
| 20208 | : WINDOW_LEFT_FRINGE_WIDTH (it->w)) == 0) | 20220 | : WINDOW_LEFT_FRINGE_WIDTH (it->w)) == 0) |
| 20221 | /* Don't let insert_left_trunc_glyphs overwrite the | ||
| 20222 | first glyph of the row if it is an image. */ | ||
| 20223 | && row->glyphs[TEXT_AREA]->type != IMAGE_GLYPH)) | ||
| 20209 | insert_left_trunc_glyphs (it); | 20224 | insert_left_trunc_glyphs (it); |
| 20210 | row->truncated_on_left_p = 1; | 20225 | row->truncated_on_left_p = 1; |
| 20211 | } | 20226 | } |