diff options
| author | Joakim Verona | 2015-02-08 21:55:28 +0100 |
|---|---|---|
| committer | Joakim Verona | 2015-02-08 21:55:28 +0100 |
| commit | 5e1d5ef39ca0d2fbff26d659f2ec6ce863b14529 (patch) | |
| tree | 860e0d53399626aee6249ebb5f972879f403b228 /src/dispnew.c | |
| parent | 148262ce3db990ed16989341345e232570b3a338 (diff) | |
| parent | 7d631aa0ffab875e4979727f632703ad5b4100a2 (diff) | |
| download | emacs-5e1d5ef39ca0d2fbff26d659f2ec6ce863b14529.tar.gz emacs-5e1d5ef39ca0d2fbff26d659f2ec6ce863b14529.zip | |
merge masterxwidget
Diffstat (limited to 'src/dispnew.c')
| -rw-r--r-- | src/dispnew.c | 135 |
1 files changed, 55 insertions, 80 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index e614ceef122..6ee4ccedf0b 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -3911,45 +3911,35 @@ set_window_cursor_after_update (struct window *w) | |||
| 3911 | { | 3911 | { |
| 3912 | cx = cy = vpos = hpos = 0; | 3912 | cx = cy = vpos = hpos = 0; |
| 3913 | 3913 | ||
| 3914 | if (cursor_in_echo_area >= 0) | 3914 | /* If the mini-buffer is several lines high, find the last |
| 3915 | line that has any text on it. Note: either all lines | ||
| 3916 | are enabled or none. Otherwise we wouldn't be able to | ||
| 3917 | determine Y. */ | ||
| 3918 | struct glyph_row *last_row = NULL; | ||
| 3919 | int yb = window_text_bottom_y (w); | ||
| 3920 | |||
| 3921 | for (struct glyph_row *row = w->current_matrix->rows; | ||
| 3922 | row->enabled_p && (!last_row || MATRIX_ROW_BOTTOM_Y (row) <= yb); | ||
| 3923 | row++) | ||
| 3924 | if (row->used[TEXT_AREA] && row->glyphs[TEXT_AREA][0].charpos >= 0) | ||
| 3925 | last_row = row; | ||
| 3926 | |||
| 3927 | if (last_row) | ||
| 3915 | { | 3928 | { |
| 3916 | /* If the mini-buffer is several lines high, find the last | 3929 | struct glyph *start = last_row->glyphs[TEXT_AREA]; |
| 3917 | line that has any text on it. Note: either all lines | 3930 | struct glyph *last = start + last_row->used[TEXT_AREA] - 1; |
| 3918 | are enabled or none. Otherwise we wouldn't be able to | ||
| 3919 | determine Y. */ | ||
| 3920 | struct glyph_row *row, *last_row; | ||
| 3921 | struct glyph *glyph; | ||
| 3922 | int yb = window_text_bottom_y (w); | ||
| 3923 | |||
| 3924 | last_row = NULL; | ||
| 3925 | row = w->current_matrix->rows; | ||
| 3926 | while (row->enabled_p | ||
| 3927 | && (last_row == NULL | ||
| 3928 | || MATRIX_ROW_BOTTOM_Y (row) <= yb)) | ||
| 3929 | { | ||
| 3930 | if (row->used[TEXT_AREA] | ||
| 3931 | && row->glyphs[TEXT_AREA][0].charpos >= 0) | ||
| 3932 | last_row = row; | ||
| 3933 | ++row; | ||
| 3934 | } | ||
| 3935 | 3931 | ||
| 3936 | if (last_row) | 3932 | while (last > start && last->charpos < 0) |
| 3937 | { | 3933 | --last; |
| 3938 | struct glyph *start = last_row->glyphs[TEXT_AREA]; | ||
| 3939 | struct glyph *last = start + last_row->used[TEXT_AREA] - 1; | ||
| 3940 | |||
| 3941 | while (last > start && last->charpos < 0) | ||
| 3942 | --last; | ||
| 3943 | 3934 | ||
| 3944 | for (glyph = start; glyph < last; ++glyph) | 3935 | for (struct glyph *glyph = start; glyph < last; glyph++) |
| 3945 | { | 3936 | { |
| 3946 | cx += glyph->pixel_width; | 3937 | cx += glyph->pixel_width; |
| 3947 | ++hpos; | 3938 | hpos++; |
| 3948 | } | ||
| 3949 | |||
| 3950 | cy = last_row->y; | ||
| 3951 | vpos = MATRIX_ROW_VPOS (last_row, w->current_matrix); | ||
| 3952 | } | 3939 | } |
| 3940 | |||
| 3941 | cy = last_row->y; | ||
| 3942 | vpos = MATRIX_ROW_VPOS (last_row, w->current_matrix); | ||
| 3953 | } | 3943 | } |
| 3954 | } | 3944 | } |
| 3955 | else | 3945 | else |
| @@ -4569,58 +4559,43 @@ update_frame_1 (struct frame *f, bool force_p, bool inhibit_id_p, | |||
| 4569 | && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window)) | 4559 | && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window)) |
| 4570 | { | 4560 | { |
| 4571 | int top = WINDOW_TOP_EDGE_LINE (XWINDOW (FRAME_MINIBUF_WINDOW (f))); | 4561 | int top = WINDOW_TOP_EDGE_LINE (XWINDOW (FRAME_MINIBUF_WINDOW (f))); |
| 4572 | int row, col; | 4562 | int col; |
| 4573 | 4563 | ||
| 4574 | if (cursor_in_echo_area < 0) | 4564 | /* Put cursor at the end of the prompt. If the mini-buffer |
| 4565 | is several lines high, find the last line that has | ||
| 4566 | any text on it. */ | ||
| 4567 | int row = FRAME_TOTAL_LINES (f); | ||
| 4568 | do | ||
| 4575 | { | 4569 | { |
| 4576 | /* Negative value of cursor_in_echo_area means put | 4570 | row--; |
| 4577 | cursor at beginning of line. */ | ||
| 4578 | row = top; | ||
| 4579 | col = 0; | 4571 | col = 0; |
| 4580 | } | ||
| 4581 | else | ||
| 4582 | { | ||
| 4583 | /* Positive value of cursor_in_echo_area means put | ||
| 4584 | cursor at the end of the prompt. If the mini-buffer | ||
| 4585 | is several lines high, find the last line that has | ||
| 4586 | any text on it. */ | ||
| 4587 | row = FRAME_TOTAL_LINES (f); | ||
| 4588 | do | ||
| 4589 | { | ||
| 4590 | --row; | ||
| 4591 | col = 0; | ||
| 4592 | 4572 | ||
| 4593 | if (MATRIX_ROW_ENABLED_P (current_matrix, row)) | 4573 | if (MATRIX_ROW_ENABLED_P (current_matrix, row)) |
| 4594 | { | 4574 | { |
| 4595 | /* Frame rows are filled up with spaces that | 4575 | /* Frame rows are filled up with spaces that |
| 4596 | must be ignored here. */ | 4576 | must be ignored here. */ |
| 4597 | struct glyph_row *r = MATRIX_ROW (current_matrix, | 4577 | struct glyph_row *r = MATRIX_ROW (current_matrix, row); |
| 4598 | row); | 4578 | struct glyph *start = r->glyphs[TEXT_AREA]; |
| 4599 | struct glyph *start = r->glyphs[TEXT_AREA]; | 4579 | |
| 4600 | struct glyph *last = start + r->used[TEXT_AREA]; | 4580 | col = r->used[TEXT_AREA]; |
| 4601 | 4581 | while (0 < col && start[col - 1].charpos < 0) | |
| 4602 | while (last > start | 4582 | col--; |
| 4603 | && (last - 1)->charpos < 0) | ||
| 4604 | --last; | ||
| 4605 | |||
| 4606 | col = last - start; | ||
| 4607 | } | ||
| 4608 | } | 4583 | } |
| 4609 | while (row > top && col == 0); | 4584 | } |
| 4585 | while (row > top && col == 0); | ||
| 4610 | 4586 | ||
| 4611 | /* Make sure COL is not out of range. */ | 4587 | /* Make sure COL is not out of range. */ |
| 4612 | if (col >= FRAME_CURSOR_X_LIMIT (f)) | 4588 | if (col >= FRAME_CURSOR_X_LIMIT (f)) |
| 4589 | { | ||
| 4590 | /* If we have another row, advance cursor into it. */ | ||
| 4591 | if (row < FRAME_TOTAL_LINES (f) - 1) | ||
| 4613 | { | 4592 | { |
| 4614 | /* If we have another row, advance cursor into it. */ | 4593 | col = FRAME_LEFT_SCROLL_BAR_COLS (f); |
| 4615 | if (row < FRAME_TOTAL_LINES (f) - 1) | 4594 | row++; |
| 4616 | { | ||
| 4617 | col = FRAME_LEFT_SCROLL_BAR_COLS (f); | ||
| 4618 | row++; | ||
| 4619 | } | ||
| 4620 | /* Otherwise move it back in range. */ | ||
| 4621 | else | ||
| 4622 | col = FRAME_CURSOR_X_LIMIT (f) - 1; | ||
| 4623 | } | 4595 | } |
| 4596 | /* Otherwise move it back in range. */ | ||
| 4597 | else | ||
| 4598 | col = FRAME_CURSOR_X_LIMIT (f) - 1; | ||
| 4624 | } | 4599 | } |
| 4625 | 4600 | ||
| 4626 | cursor_to (f, row, col); | 4601 | cursor_to (f, row, col); |
| @@ -5966,7 +5941,7 @@ init_display (void) | |||
| 5966 | space_glyph.charpos = -1; | 5941 | space_glyph.charpos = -1; |
| 5967 | 5942 | ||
| 5968 | inverse_video = 0; | 5943 | inverse_video = 0; |
| 5969 | cursor_in_echo_area = 0; | 5944 | cursor_in_echo_area = false; |
| 5970 | 5945 | ||
| 5971 | /* Now is the time to initialize this; it's used by init_sys_modes | 5946 | /* Now is the time to initialize this; it's used by init_sys_modes |
| 5972 | during startup. */ | 5947 | during startup. */ |