Mercurial > emacs
comparison src/xdisp.c @ 107603:0e2486128193
Retrospective commit from 2009-11-21.
Fix cursor positioning on empty lines with overlays.
xdisp.c (set_cursor_from_row): Fix cursor positioning on empty
lines when integer values of `cursor' property is used on display
strings.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Fri, 01 Jan 2010 07:01:23 -0500 |
parents | d44bdcba4457 |
children | 9e8415b885ee |
comparison
equal
deleted
inserted
replaced
107602:d44bdcba4457 | 107603:0e2486128193 |
---|---|
12466 glyph has the avoid_cursor_p flag set. */ | 12466 glyph has the avoid_cursor_p flag set. */ |
12467 int match_with_avoid_cursor = 0; | 12467 int match_with_avoid_cursor = 0; |
12468 /* Non-zero means we've seen at least one glyph that came from a | 12468 /* Non-zero means we've seen at least one glyph that came from a |
12469 display string. */ | 12469 display string. */ |
12470 int string_seen = 0; | 12470 int string_seen = 0; |
12471 /* Largest buffer position seen during scan of glyph row. */ | 12471 /* Largest buffer position seen so far during scan of glyph row. */ |
12472 EMACS_INT bpos_max = 0; | 12472 EMACS_INT bpos_max = last_pos; |
12473 /* Last buffer position covered by an overlay string with an integer | 12473 /* Last buffer position covered by an overlay string with an integer |
12474 `cursor' property. */ | 12474 `cursor' property. */ |
12475 EMACS_INT bpos_covered = 0; | 12475 EMACS_INT bpos_covered = 0; |
12476 | 12476 |
12477 /* Skip over glyphs not having an object at the start and the end of | 12477 /* Skip over glyphs not having an object at the start and the end of |
12594 { | 12594 { |
12595 bpos_covered = bpos_max + XINT (chprop); | 12595 bpos_covered = bpos_max + XINT (chprop); |
12596 /* If the `cursor' property covers buffer positions up | 12596 /* If the `cursor' property covers buffer positions up |
12597 to and including point, we should display cursor on | 12597 to and including point, we should display cursor on |
12598 this glyph. */ | 12598 this glyph. */ |
12599 if (bpos_covered >= pt_old) | 12599 /* Implementation note: bpos_max == pt_old when, e.g., |
12600 we are in an empty line, where bpos_max is set to | |
12601 MATRIX_ROW_START_CHARPOS, see above. */ | |
12602 if (bpos_max <= pt_old && bpos_covered >= pt_old) | |
12600 { | 12603 { |
12601 cursor = glyph; | 12604 cursor = glyph; |
12602 break; | 12605 break; |
12603 } | 12606 } |
12604 } | 12607 } |
12649 { | 12652 { |
12650 bpos_covered = bpos_max + XINT (chprop); | 12653 bpos_covered = bpos_max + XINT (chprop); |
12651 /* If the `cursor' property covers buffer positions up | 12654 /* If the `cursor' property covers buffer positions up |
12652 to and including point, we should display cursor on | 12655 to and including point, we should display cursor on |
12653 this glyph. */ | 12656 this glyph. */ |
12654 if (bpos_covered >= pt_old) | 12657 if (bpos_max <= pt_old && bpos_covered >= pt_old) |
12655 { | 12658 { |
12656 cursor = glyph; | 12659 cursor = glyph; |
12657 break; | 12660 break; |
12658 } | 12661 } |
12659 } | 12662 } |