diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/xdisp.c | 25 |
2 files changed, 31 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1ec148b30c8..adfa363e253 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2012-03-18 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (cursor_row_p): Even if the glyph row ends in a string | ||
| 4 | that is not from display property, accept the row as a "cursor | ||
| 5 | row" if one of the string's character has a non-nil `cursor' | ||
| 6 | property. Fixes cursor positioning when there are newlines in | ||
| 7 | overlay strings, e.g. in icomplete.el. (Bug#11035) | ||
| 8 | |||
| 1 | 2012-03-12 Paul Eggert <eggert@cs.ucla.edu> | 9 | 2012-03-12 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 10 | ||
| 3 | * buffer.c (compare_overlays): Don't assume args differ (Bug#6830). | 11 | * buffer.c (compare_overlays): Don't assume args differ (Bug#6830). |
diff --git a/src/xdisp.c b/src/xdisp.c index 62d0d187a19..71162960faa 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -18456,9 +18456,11 @@ cursor_row_p (struct glyph_row *row) | |||
| 18456 | /* Suppose the row ends on a string. | 18456 | /* Suppose the row ends on a string. |
| 18457 | Unless the row is continued, that means it ends on a newline | 18457 | Unless the row is continued, that means it ends on a newline |
| 18458 | in the string. If it's anything other than a display string | 18458 | in the string. If it's anything other than a display string |
| 18459 | (e.g. a before-string from an overlay), we don't want the | 18459 | (e.g., a before-string from an overlay), we don't want the |
| 18460 | cursor there. (This heuristic seems to give the optimal | 18460 | cursor there. (This heuristic seems to give the optimal |
| 18461 | behavior for the various types of multi-line strings.) */ | 18461 | behavior for the various types of multi-line strings.) |
| 18462 | One exception: if the string has `cursor' property on one of | ||
| 18463 | its characters, we _do_ want the cursor there. */ | ||
| 18462 | if (CHARPOS (row->end.string_pos) >= 0) | 18464 | if (CHARPOS (row->end.string_pos) >= 0) |
| 18463 | { | 18465 | { |
| 18464 | if (row->continued_p) | 18466 | if (row->continued_p) |
| @@ -18480,6 +18482,25 @@ cursor_row_p (struct glyph_row *row) | |||
| 18480 | result = | 18482 | result = |
| 18481 | (!NILP (prop) | 18483 | (!NILP (prop) |
| 18482 | && display_prop_string_p (prop, glyph->object)); | 18484 | && display_prop_string_p (prop, glyph->object)); |
| 18485 | /* If there's a `cursor' property on one of the | ||
| 18486 | string's characters, this row is a cursor row, | ||
| 18487 | even though this is not a display string. */ | ||
| 18488 | if (!result) | ||
| 18489 | { | ||
| 18490 | Lisp_Object s = glyph->object; | ||
| 18491 | |||
| 18492 | for ( ; glyph >= beg && EQ (glyph->object, s); --glyph) | ||
| 18493 | { | ||
| 18494 | EMACS_INT gpos = glyph->charpos; | ||
| 18495 | |||
| 18496 | if (!NILP (Fget_char_property (make_number (gpos), | ||
| 18497 | Qcursor, s))) | ||
| 18498 | { | ||
| 18499 | result = 1; | ||
| 18500 | break; | ||
| 18501 | } | ||
| 18502 | } | ||
| 18503 | } | ||
| 18483 | break; | 18504 | break; |
| 18484 | } | 18505 | } |
| 18485 | } | 18506 | } |