diff options
| author | Eli Zaretskii | 2012-06-16 12:57:56 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2012-06-16 12:57:56 +0300 |
| commit | 2f07e6afc932d0be7256c7700e9c11d61075aeaf (patch) | |
| tree | 13975fa5691768d214e290ba66ff14c352e37e26 /src | |
| parent | 771e3eae1e110cbf1ba50ae25bfcf560fdb0822c (diff) | |
| download | emacs-2f07e6afc932d0be7256c7700e9c11d61075aeaf.tar.gz emacs-2f07e6afc932d0be7256c7700e9c11d61075aeaf.zip | |
Fix bug #11653 with cursor positioning in a row that has only strings.
src/xdisp.c (set_cursor_from_row): Don't dereference glyphs_end. If
all the glyphs of the glyph row came from strings, and we have no
cursor positioning clues, put the cursor on the first glyph of the
row.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/xdisp.c | 16 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b5a22a0ebce..3138bea28fa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-06-16 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (set_cursor_from_row): Don't dereference glyphs_end. If | ||
| 4 | all the glyphs of the glyph row came from strings, and we have no | ||
| 5 | cursor positioning clues, put the cursor on the first glyph of the | ||
| 6 | row. (Bug#11653) | ||
| 7 | |||
| 1 | 2012-06-16 Andreas Schwab <schwab@linux-m68k.org> | 8 | 2012-06-16 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 9 | ||
| 3 | * category.h (CHAR_HAS_CATEGORY): Define as inline. | 10 | * category.h (CHAR_HAS_CATEGORY): Define as inline. |
diff --git a/src/xdisp.c b/src/xdisp.c index 0eae25de54a..e09116fe0ca 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -14260,6 +14260,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 14260 | the cursor is not on this line. */ | 14260 | the cursor is not on this line. */ |
| 14261 | if (cursor == NULL | 14261 | if (cursor == NULL |
| 14262 | && (row->reversed_p ? glyph <= end : glyph >= end) | 14262 | && (row->reversed_p ? glyph <= end : glyph >= end) |
| 14263 | && (row->reversed_p ? end > glyphs_end : end < glyphs_end) | ||
| 14263 | && STRINGP (end->object) | 14264 | && STRINGP (end->object) |
| 14264 | && row->continued_p) | 14265 | && row->continued_p) |
| 14265 | return 0; | 14266 | return 0; |
| @@ -14289,6 +14290,21 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 14289 | compute_x: | 14290 | compute_x: |
| 14290 | if (cursor != NULL) | 14291 | if (cursor != NULL) |
| 14291 | glyph = cursor; | 14292 | glyph = cursor; |
| 14293 | else if (glyph == glyphs_end | ||
| 14294 | && pos_before == pos_after | ||
| 14295 | && STRINGP ((row->reversed_p | ||
| 14296 | ? row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1 | ||
| 14297 | : row->glyphs[TEXT_AREA])->object)) | ||
| 14298 | { | ||
| 14299 | /* If all the glyphs of this row came from strings, put the | ||
| 14300 | cursor on the first glyph of the row. This avoids having the | ||
| 14301 | cursor outside of the text area in this very rare and hard | ||
| 14302 | use case. */ | ||
| 14303 | glyph = | ||
| 14304 | row->reversed_p | ||
| 14305 | ? row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1 | ||
| 14306 | : row->glyphs[TEXT_AREA]; | ||
| 14307 | } | ||
| 14292 | if (x < 0) | 14308 | if (x < 0) |
| 14293 | { | 14309 | { |
| 14294 | struct glyph *g; | 14310 | struct glyph *g; |