aboutsummaryrefslogtreecommitdiffstats
path: root/src/indent.c
diff options
context:
space:
mode:
authorPaul Eggert2012-04-09 15:54:59 -0700
committerPaul Eggert2012-04-09 15:54:59 -0700
commit45e9f7da84c1bd3fc0d36d05c5708ed3b2d3a193 (patch)
tree5bc87a8b5a3c754b8eb44a612cc6c03561d6b968 /src/indent.c
parent9d6b4d53469a9ffd67bd770fabc6fe254e35c21d (diff)
parent05920a43fc18e696b464387e781e7cfdcea5b5af (diff)
downloademacs-45e9f7da84c1bd3fc0d36d05c5708ed3b2d3a193.tar.gz
emacs-45e9f7da84c1bd3fc0d36d05c5708ed3b2d3a193.zip
Merge from trunk.
Diffstat (limited to 'src/indent.c')
-rw-r--r--src/indent.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/indent.c b/src/indent.c
index b1c86c3ab13..22b0bb2c668 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -2021,6 +2021,7 @@ whether or not it is currently displayed in some window. */)
2021 ptrdiff_t it_start, it_overshoot_count = 0; 2021 ptrdiff_t it_start, it_overshoot_count = 0;
2022 int first_x; 2022 int first_x;
2023 int overshoot_handled = 0; 2023 int overshoot_handled = 0;
2024 int disp_string_at_start_p = 0;
2024 2025
2025 itdata = bidi_shelve_cache (); 2026 itdata = bidi_shelve_cache ();
2026 SET_TEXT_POS (pt, PT, PT_BYTE); 2027 SET_TEXT_POS (pt, PT, PT_BYTE);
@@ -2035,6 +2036,8 @@ whether or not it is currently displayed in some window. */)
2035 { 2036 {
2036 const char *s = SSDATA (it.string); 2037 const char *s = SSDATA (it.string);
2037 const char *e = s + SBYTES (it.string); 2038 const char *e = s + SBYTES (it.string);
2039
2040 disp_string_at_start_p = it.string_from_display_prop_p;
2038 while (s < e) 2041 while (s < e)
2039 { 2042 {
2040 if (*s++ == '\n') 2043 if (*s++ == '\n')
@@ -2062,7 +2065,8 @@ whether or not it is currently displayed in some window. */)
2062 /* IT may move too far if truncate-lines is on and PT lies 2065 /* IT may move too far if truncate-lines is on and PT lies
2063 beyond the right margin. IT may also move too far if the 2066 beyond the right margin. IT may also move too far if the
2064 starting point is on a Lisp string that has embedded 2067 starting point is on a Lisp string that has embedded
2065 newlines. In these cases, backtrack. */ 2068 newlines, or spans several screen lines. In these cases,
2069 backtrack. */
2066 if (IT_CHARPOS (it) > it_start) 2070 if (IT_CHARPOS (it) > it_start)
2067 { 2071 {
2068 /* We need to backtrack also if the Lisp string contains no 2072 /* We need to backtrack also if the Lisp string contains no
@@ -2073,6 +2077,14 @@ whether or not it is currently displayed in some window. */)
2073 && it.method == GET_FROM_BUFFER 2077 && it.method == GET_FROM_BUFFER
2074 && it.c == '\n') 2078 && it.c == '\n')
2075 it_overshoot_count = 1; 2079 it_overshoot_count = 1;
2080 else if (disp_string_at_start_p && it.vpos > 0)
2081 {
2082 /* This is the case of a display string that spans
2083 several screen lines. In that case, we end up at the
2084 end of the string, and it.vpos tells us how many
2085 screen lines we need to backtrack. */
2086 it_overshoot_count = it.vpos;
2087 }
2076 if (it_overshoot_count > 0) 2088 if (it_overshoot_count > 0)
2077 move_it_by_lines (&it, -it_overshoot_count); 2089 move_it_by_lines (&it, -it_overshoot_count);
2078 2090
@@ -2151,7 +2163,7 @@ void
2151syms_of_indent (void) 2163syms_of_indent (void)
2152{ 2164{
2153 DEFVAR_BOOL ("indent-tabs-mode", indent_tabs_mode, 2165 DEFVAR_BOOL ("indent-tabs-mode", indent_tabs_mode,
2154 doc: /* *Indentation can insert tabs if this is non-nil. */); 2166 doc: /* Indentation can insert tabs if this is non-nil. */);
2155 indent_tabs_mode = 1; 2167 indent_tabs_mode = 1;
2156 2168
2157 defsubr (&Scurrent_indentation); 2169 defsubr (&Scurrent_indentation);