diff options
| author | Joakim Verona | 2011-09-23 22:58:08 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-09-23 22:58:08 +0200 |
| commit | 95cc95eb9715952c743cadbc1f0dd5f959ade608 (patch) | |
| tree | 1a84d8b7cbc0b9b69cce80c952ef245a21d81a13 /src | |
| parent | 00c82a0d8e7fd9578ab0fd5ba9fd7bc8245ce9e2 (diff) | |
| parent | 0a39f27eb9b78ceacdf351eba4549efd3323c88d (diff) | |
| download | emacs-95cc95eb9715952c743cadbc1f0dd5f959ade608.tar.gz emacs-95cc95eb9715952c743cadbc1f0dd5f959ade608.zip | |
upstream
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 24 | ||||
| -rw-r--r-- | src/dispextern.h | 16 | ||||
| -rw-r--r-- | src/emacs.c | 6 | ||||
| -rw-r--r-- | src/xdisp.c | 122 |
4 files changed, 144 insertions, 24 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 12a45918e87..44a76068313 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,27 @@ | |||
| 1 | 2011-09-23 Andreas Schwab <schwab@linux-m68k.org> | ||
| 2 | |||
| 3 | * emacs.c (Fkill_emacs): In noninteractive mode exit | ||
| 4 | non-successfully if a write error occurred on stdout. (Bug#9574) | ||
| 5 | |||
| 6 | 2011-09-21 Eli Zaretskii <eliz@gnu.org> | ||
| 7 | |||
| 8 | * xdisp.c (pop_it): Allow it->object that is a cons cell to pass | ||
| 9 | the xassert test. | ||
| 10 | |||
| 11 | * dispextern.h (struct it): Update the comment documenting what | ||
| 12 | can it->OBJECT be. | ||
| 13 | |||
| 14 | 2011-09-20 Eli Zaretskii <eliz@gnu.org> | ||
| 15 | |||
| 16 | * xdisp.c (set_cursor_from_row): If the row ends in a newline from | ||
| 17 | a display string, extend search for cursor position to end of row. | ||
| 18 | (find_row_edges): If the row ends in a newline from a display | ||
| 19 | string, increment its MATRIX_ROW_END_CHARPOS by one. (Bug#9549) | ||
| 20 | Handle the case of a display string with multiple newlines. | ||
| 21 | (Fcurrent_bidi_paragraph_direction): Fix search for previous | ||
| 22 | non-empty line. Fixes confusing cursor motion with arrow keys at | ||
| 23 | the beginning of a line that starts with whitespace. | ||
| 24 | |||
| 1 | 2011-09-19 Lars Magne Ingebrigtsen <larsi@gnus.org> | 25 | 2011-09-19 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 26 | ||
| 3 | * lread.c (Fread_from_string): Document what FINAL-STRING-INDEX is | 27 | * lread.c (Fread_from_string): Document what FINAL-STRING-INDEX is |
diff --git a/src/dispextern.h b/src/dispextern.h index 8a1d8e7948e..bdc5008c94c 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2426,9 +2426,19 @@ struct it | |||
| 2426 | Lisp_Object font_height; | 2426 | Lisp_Object font_height; |
| 2427 | 2427 | ||
| 2428 | /* Object and position where the current display element came from. | 2428 | /* Object and position where the current display element came from. |
| 2429 | Object can be a Lisp string in case the current display element | 2429 | Object is normally the buffer which is being rendered, but it can |
| 2430 | comes from an overlay string, or it is buffer. It may also be nil | 2430 | also be a Lisp string in case the current display element comes |
| 2431 | during mode-line update. Position is a position in object. */ | 2431 | from an overlay string or from a display string (before- or |
| 2432 | after-string). It may also be nil when a C string is being | ||
| 2433 | rendered, e.g., during mode-line or header-line update. It can | ||
| 2434 | also be a cons cell of the form `(space ...)', when we produce a | ||
| 2435 | stretch glyph from a `display' specification. Finally, it can be | ||
| 2436 | a zero-valued Lisp integer, but only temporarily, when we are | ||
| 2437 | producing special glyphs for display purposes, like truncation | ||
| 2438 | and continuation glyphs, or blanks that extend each line to the | ||
| 2439 | edge of the window on a TTY. | ||
| 2440 | |||
| 2441 | Position is the current iterator position in object. */ | ||
| 2432 | Lisp_Object object; | 2442 | Lisp_Object object; |
| 2433 | struct text_pos position; | 2443 | struct text_pos position; |
| 2434 | 2444 | ||
diff --git a/src/emacs.c b/src/emacs.c index d0e7a748849..bf23643f3f6 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1999,6 +1999,7 @@ all of which are called before Emacs is actually killed. */) | |||
| 1999 | { | 1999 | { |
| 2000 | struct gcpro gcpro1; | 2000 | struct gcpro gcpro1; |
| 2001 | Lisp_Object hook; | 2001 | Lisp_Object hook; |
| 2002 | int exit_code; | ||
| 2002 | 2003 | ||
| 2003 | GCPRO1 (arg); | 2004 | GCPRO1 (arg); |
| 2004 | 2005 | ||
| @@ -2023,7 +2024,10 @@ all of which are called before Emacs is actually killed. */) | |||
| 2023 | if (STRINGP (Vauto_save_list_file_name)) | 2024 | if (STRINGP (Vauto_save_list_file_name)) |
| 2024 | unlink (SSDATA (Vauto_save_list_file_name)); | 2025 | unlink (SSDATA (Vauto_save_list_file_name)); |
| 2025 | 2026 | ||
| 2026 | exit (INTEGERP (arg) ? XINT (arg) : EXIT_SUCCESS); | 2027 | exit_code = EXIT_SUCCESS; |
| 2028 | if (noninteractive && fflush (stdout)) | ||
| 2029 | exit_code = EXIT_FAILURE; | ||
| 2030 | exit (INTEGERP (arg) ? XINT (arg) : exit_code); | ||
| 2027 | } | 2031 | } |
| 2028 | 2032 | ||
| 2029 | 2033 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index e83ad96b6c8..44255c96468 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -5494,7 +5494,8 @@ pop_it (struct it *it) | |||
| 5494 | && IT_BYTEPOS (*it) == it->bidi_it.bytepos) | 5494 | && IT_BYTEPOS (*it) == it->bidi_it.bytepos) |
| 5495 | || (STRINGP (it->object) | 5495 | || (STRINGP (it->object) |
| 5496 | && IT_STRING_CHARPOS (*it) == it->bidi_it.charpos | 5496 | && IT_STRING_CHARPOS (*it) == it->bidi_it.charpos |
| 5497 | && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos)); | 5497 | && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos) |
| 5498 | || (CONSP (it->object) && it->method == GET_FROM_STRETCH)); | ||
| 5498 | } | 5499 | } |
| 5499 | } | 5500 | } |
| 5500 | 5501 | ||
| @@ -13727,6 +13728,17 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13727 | 13728 | ||
| 13728 | x = -1; | 13729 | x = -1; |
| 13729 | 13730 | ||
| 13731 | /* If the row ends in a newline from a display string, | ||
| 13732 | reordering could have moved the glyphs belonging to the | ||
| 13733 | string out of the [GLYPH_BEFORE..GLYPH_AFTER] range. So | ||
| 13734 | in this case we extend the search to the last glyph in | ||
| 13735 | the row that was not inserted by redisplay. */ | ||
| 13736 | if (row->ends_in_newline_from_string_p) | ||
| 13737 | { | ||
| 13738 | glyph_after = end; | ||
| 13739 | pos_after = MATRIX_ROW_END_CHARPOS (row) + delta; | ||
| 13740 | } | ||
| 13741 | |||
| 13730 | /* GLYPH_BEFORE and GLYPH_AFTER are the glyphs that | 13742 | /* GLYPH_BEFORE and GLYPH_AFTER are the glyphs that |
| 13731 | correspond to POS_BEFORE and POS_AFTER, respectively. We | 13743 | correspond to POS_BEFORE and POS_AFTER, respectively. We |
| 13732 | need START and STOP in the order that corresponds to the | 13744 | need START and STOP in the order that corresponds to the |
| @@ -18446,7 +18458,8 @@ find_row_edges (struct it *it, struct glyph_row *row, | |||
| 18446 | Line ends in a newline from buffer eol_pos + 1 | 18458 | Line ends in a newline from buffer eol_pos + 1 |
| 18447 | Line is continued from buffer max_pos + 1 | 18459 | Line is continued from buffer max_pos + 1 |
| 18448 | Line is truncated on right it->current.pos | 18460 | Line is truncated on right it->current.pos |
| 18449 | Line ends in a newline from string max_pos | 18461 | Line ends in a newline from string max_pos + 1(*) |
| 18462 | (*) + 1 only when line ends in a forward scan | ||
| 18450 | Line is continued from string max_pos | 18463 | Line is continued from string max_pos |
| 18451 | Line is continued from display vector max_pos | 18464 | Line is continued from display vector max_pos |
| 18452 | Line is entirely from a string min_pos == max_pos | 18465 | Line is entirely from a string min_pos == max_pos |
| @@ -18459,8 +18472,76 @@ find_row_edges (struct it *it, struct glyph_row *row, | |||
| 18459 | row->maxpos = it->current.pos; | 18472 | row->maxpos = it->current.pos; |
| 18460 | else if (row->used[TEXT_AREA]) | 18473 | else if (row->used[TEXT_AREA]) |
| 18461 | { | 18474 | { |
| 18462 | if (row->ends_in_newline_from_string_p) | 18475 | int seen_this_string = 0; |
| 18463 | SET_TEXT_POS (row->maxpos, max_pos, max_bpos); | 18476 | struct glyph_row *r1 = row - 1; |
| 18477 | |||
| 18478 | /* Did we see the same display string on the previous row? */ | ||
| 18479 | if (STRINGP (it->object) | ||
| 18480 | /* this is not the first row */ | ||
| 18481 | && row > it->w->desired_matrix->rows | ||
| 18482 | /* previous row is not the header line */ | ||
| 18483 | && !r1->mode_line_p | ||
| 18484 | /* previous row also ends in a newline from a string */ | ||
| 18485 | && r1->ends_in_newline_from_string_p) | ||
| 18486 | { | ||
| 18487 | struct glyph *start, *end; | ||
| 18488 | |||
| 18489 | /* Search for the last glyph of the previous row that came | ||
| 18490 | from buffer or string. Depending on whether the row is | ||
| 18491 | L2R or R2L, we need to process it front to back or the | ||
| 18492 | other way round. */ | ||
| 18493 | if (!r1->reversed_p) | ||
| 18494 | { | ||
| 18495 | start = r1->glyphs[TEXT_AREA]; | ||
| 18496 | end = start + r1->used[TEXT_AREA]; | ||
| 18497 | /* Glyphs inserted by redisplay have an integer (zero) | ||
| 18498 | as their object. */ | ||
| 18499 | while (end > start | ||
| 18500 | && INTEGERP ((end - 1)->object) | ||
| 18501 | && (end - 1)->charpos <= 0) | ||
| 18502 | --end; | ||
| 18503 | if (end > start) | ||
| 18504 | { | ||
| 18505 | if (EQ ((end - 1)->object, it->object)) | ||
| 18506 | seen_this_string = 1; | ||
| 18507 | } | ||
| 18508 | else | ||
| 18509 | abort (); | ||
| 18510 | } | ||
| 18511 | else | ||
| 18512 | { | ||
| 18513 | end = r1->glyphs[TEXT_AREA] - 1; | ||
| 18514 | start = end + r1->used[TEXT_AREA]; | ||
| 18515 | while (end < start | ||
| 18516 | && INTEGERP ((end + 1)->object) | ||
| 18517 | && (end + 1)->charpos <= 0) | ||
| 18518 | ++end; | ||
| 18519 | if (end < start) | ||
| 18520 | { | ||
| 18521 | if (EQ ((end + 1)->object, it->object)) | ||
| 18522 | seen_this_string = 1; | ||
| 18523 | } | ||
| 18524 | else | ||
| 18525 | abort (); | ||
| 18526 | } | ||
| 18527 | } | ||
| 18528 | /* Take note of each display string that covers a newline only | ||
| 18529 | once, the first time we see it. This is for when a display | ||
| 18530 | string includes more than one newline in it. */ | ||
| 18531 | if (row->ends_in_newline_from_string_p && !seen_this_string) | ||
| 18532 | { | ||
| 18533 | /* If we were scanning the buffer forward when we displayed | ||
| 18534 | the string, we want to account for at least one buffer | ||
| 18535 | position that belongs to this row (position covered by | ||
| 18536 | the display string), so that cursor positioning will | ||
| 18537 | consider this row as a candidate when point is at the end | ||
| 18538 | of the visual line represented by this row. This is not | ||
| 18539 | required when scanning back, because max_pos will already | ||
| 18540 | have a much larger value. */ | ||
| 18541 | if (CHARPOS (row->end.pos) > max_pos) | ||
| 18542 | INC_BOTH (max_pos, max_bpos); | ||
| 18543 | SET_TEXT_POS (row->maxpos, max_pos, max_bpos); | ||
| 18544 | } | ||
| 18464 | else if (CHARPOS (it->eol_pos) > 0) | 18545 | else if (CHARPOS (it->eol_pos) > 0) |
| 18465 | SET_TEXT_POS (row->maxpos, | 18546 | SET_TEXT_POS (row->maxpos, |
| 18466 | CHARPOS (it->eol_pos) + 1, BYTEPOS (it->eol_pos) + 1); | 18547 | CHARPOS (it->eol_pos) + 1, BYTEPOS (it->eol_pos) + 1); |
| @@ -19230,6 +19311,7 @@ See also `bidi-paragraph-direction'. */) | |||
| 19230 | EMACS_INT pos = BUF_PT (buf); | 19311 | EMACS_INT pos = BUF_PT (buf); |
| 19231 | EMACS_INT bytepos = BUF_PT_BYTE (buf); | 19312 | EMACS_INT bytepos = BUF_PT_BYTE (buf); |
| 19232 | int c; | 19313 | int c; |
| 19314 | void *itb_data = bidi_shelve_cache (); | ||
| 19233 | 19315 | ||
| 19234 | set_buffer_temp (buf); | 19316 | set_buffer_temp (buf); |
| 19235 | /* bidi_paragraph_init finds the base direction of the paragraph | 19317 | /* bidi_paragraph_init finds the base direction of the paragraph |
| @@ -19242,27 +19324,27 @@ See also `bidi-paragraph-direction'. */) | |||
| 19242 | pos--; | 19324 | pos--; |
| 19243 | bytepos = CHAR_TO_BYTE (pos); | 19325 | bytepos = CHAR_TO_BYTE (pos); |
| 19244 | } | 19326 | } |
| 19245 | while ((c = FETCH_BYTE (bytepos)) == '\n' | 19327 | if (fast_looking_at (build_string ("[\f\t ]*\n"), |
| 19246 | || c == ' ' || c == '\t' || c == '\f') | 19328 | pos, bytepos, ZV, ZV_BYTE, Qnil) > 0) |
| 19247 | { | 19329 | { |
| 19248 | if (bytepos <= BEGV_BYTE) | 19330 | while ((c = FETCH_BYTE (bytepos)) == '\n' |
| 19249 | break; | 19331 | || c == ' ' || c == '\t' || c == '\f') |
| 19250 | bytepos--; | 19332 | { |
| 19251 | pos--; | 19333 | if (bytepos <= BEGV_BYTE) |
| 19334 | break; | ||
| 19335 | bytepos--; | ||
| 19336 | pos--; | ||
| 19337 | } | ||
| 19338 | while (!CHAR_HEAD_P (FETCH_BYTE (bytepos))) | ||
| 19339 | bytepos--; | ||
| 19252 | } | 19340 | } |
| 19253 | while (!CHAR_HEAD_P (FETCH_BYTE (bytepos))) | 19341 | bidi_init_it (pos, bytepos, FRAME_WINDOW_P (SELECTED_FRAME ()), &itb); |
| 19254 | bytepos--; | ||
| 19255 | itb.charpos = pos; | ||
| 19256 | itb.bytepos = bytepos; | ||
| 19257 | itb.nchars = -1; | ||
| 19258 | itb.string.s = NULL; | 19342 | itb.string.s = NULL; |
| 19259 | itb.string.lstring = Qnil; | 19343 | itb.string.lstring = Qnil; |
| 19260 | itb.frame_window_p = FRAME_WINDOW_P (SELECTED_FRAME ()); /* guesswork */ | 19344 | itb.string.bufpos = 0; |
| 19261 | itb.first_elt = 1; | 19345 | itb.string.unibyte = 0; |
| 19262 | itb.separator_limit = -1; | ||
| 19263 | itb.paragraph_dir = NEUTRAL_DIR; | ||
| 19264 | |||
| 19265 | bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); | 19346 | bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); |
| 19347 | bidi_unshelve_cache (itb_data, 0); | ||
| 19266 | set_buffer_temp (old); | 19348 | set_buffer_temp (old); |
| 19267 | switch (itb.paragraph_dir) | 19349 | switch (itb.paragraph_dir) |
| 19268 | { | 19350 | { |