diff options
| author | Richard M. Stallman | 2001-12-28 05:12:42 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-12-28 05:12:42 +0000 |
| commit | 1d14d232ddf738ffb019560444536b5a9eedc90c (patch) | |
| tree | 2f48b4caa80129621d6c6f7943807f567bb34a53 /src | |
| parent | 6480c8b4e2074c6c25e66eb046193f12103ad40b (diff) | |
| download | emacs-1d14d232ddf738ffb019560444536b5a9eedc90c.tar.gz emacs-1d14d232ddf738ffb019560444536b5a9eedc90c.zip | |
(set_point_both): The position after an invisible, intangible
character is not an acceptable stopping point.
Diffstat (limited to 'src')
| -rw-r--r-- | src/intervals.c | 59 |
1 files changed, 45 insertions, 14 deletions
diff --git a/src/intervals.c b/src/intervals.c index 5a6ff4f47d5..09a9bc512b1 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -1975,38 +1975,69 @@ set_point_both (buffer, charpos, bytepos) | |||
| 1975 | or end of the buffer, so don't bother checking in that case. */ | 1975 | or end of the buffer, so don't bother checking in that case. */ |
| 1976 | && charpos != BEGV && charpos != ZV) | 1976 | && charpos != BEGV && charpos != ZV) |
| 1977 | { | 1977 | { |
| 1978 | Lisp_Object intangible_propval; | 1978 | Lisp_Object intangible_propval, invisible_propval; |
| 1979 | Lisp_Object pos; | 1979 | Lisp_Object pos; |
| 1980 | int invis_p; | ||
| 1980 | 1981 | ||
| 1981 | XSETINT (pos, charpos); | 1982 | XSETINT (pos, charpos); |
| 1982 | 1983 | ||
| 1983 | if (backwards) | 1984 | if (backwards) |
| 1984 | { | 1985 | { |
| 1985 | intangible_propval = Fget_char_property (make_number (charpos), | 1986 | /* If the preceding char is both invisible and intangible, |
| 1986 | Qintangible, Qnil); | 1987 | start backing up from just before that one. */ |
| 1988 | |||
| 1989 | intangible_propval | ||
| 1990 | = Fget_char_property (make_number (charpos - 1), | ||
| 1991 | Qintangible, Qnil); | ||
| 1992 | invisible_propval | ||
| 1993 | = Fget_char_property (make_number (charpos - 1), Qinvisible, Qnil); | ||
| 1994 | invis_p = TEXT_PROP_MEANS_INVISIBLE (invisible_propval); | ||
| 1995 | |||
| 1996 | if (! NILP (intangible_propval) && invis_p) | ||
| 1997 | XSETINT (pos, --charpos); | ||
| 1987 | 1998 | ||
| 1988 | /* If following char is intangible, | 1999 | /* If following char is intangible, |
| 1989 | skip back over all chars with matching intangible property. */ | 2000 | skip back over all chars with matching intangible property. */ |
| 2001 | |||
| 2002 | intangible_propval = Fget_char_property (pos, Qintangible, Qnil); | ||
| 2003 | |||
| 1990 | if (! NILP (intangible_propval)) | 2004 | if (! NILP (intangible_propval)) |
| 1991 | while (XINT (pos) > BUF_BEGV (buffer) | 2005 | { |
| 1992 | && EQ (Fget_char_property (make_number (XINT (pos) - 1), | 2006 | while (XINT (pos) > BUF_BEGV (buffer) |
| 1993 | Qintangible, Qnil), | 2007 | && EQ (Fget_char_property (make_number (XINT (pos) - 1), |
| 1994 | intangible_propval)) | 2008 | Qintangible, Qnil), |
| 1995 | pos = Fprevious_char_property_change (pos, Qnil); | 2009 | intangible_propval)) |
| 2010 | pos = Fprevious_char_property_change (pos, Qnil); | ||
| 2011 | } | ||
| 1996 | } | 2012 | } |
| 1997 | else | 2013 | else |
| 1998 | { | 2014 | { |
| 2015 | /* If preceding char is intangible, | ||
| 2016 | skip forward over all chars with matching intangible property. */ | ||
| 2017 | |||
| 1999 | intangible_propval = Fget_char_property (make_number (charpos - 1), | 2018 | intangible_propval = Fget_char_property (make_number (charpos - 1), |
| 2000 | Qintangible, Qnil); | 2019 | Qintangible, Qnil); |
| 2001 | 2020 | ||
| 2002 | /* If following char is intangible, | ||
| 2003 | skip forward over all chars with matching intangible property. */ | ||
| 2004 | if (! NILP (intangible_propval)) | 2021 | if (! NILP (intangible_propval)) |
| 2005 | while (XINT (pos) < BUF_ZV (buffer) | 2022 | { |
| 2006 | && EQ (Fget_char_property (pos, Qintangible, Qnil), | 2023 | while (XINT (pos) < BUF_ZV (buffer) |
| 2007 | intangible_propval)) | 2024 | && EQ (Fget_char_property (pos, Qintangible, Qnil), |
| 2008 | pos = Fnext_char_property_change (pos, Qnil); | 2025 | intangible_propval)) |
| 2026 | pos = Fnext_char_property_change (pos, Qnil); | ||
| 2009 | 2027 | ||
| 2028 | /* Is the last one invisible as well as intangible? */ | ||
| 2029 | |||
| 2030 | invisible_propval | ||
| 2031 | = Fget_char_property (make_number (XINT (pos) - 1), | ||
| 2032 | Qinvisible, Qnil); | ||
| 2033 | invis_p = TEXT_PROP_MEANS_INVISIBLE (invisible_propval); | ||
| 2034 | |||
| 2035 | /* If so, advance one character more: | ||
| 2036 | don't stop after an invisible, intangible character. */ | ||
| 2037 | |||
| 2038 | if (invis_p && XINT (pos) < BUF_ZV (buffer)) | ||
| 2039 | XSETINT (pos, XINT (pos) + 1); | ||
| 2040 | } | ||
| 2010 | } | 2041 | } |
| 2011 | 2042 | ||
| 2012 | charpos = XINT (pos); | 2043 | charpos = XINT (pos); |