diff options
| author | Eli Zaretskii | 2017-06-30 12:24:13 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2017-06-30 12:24:13 +0300 |
| commit | a06dd3b9187489b61f08256d9e9a07745302dc4e (patch) | |
| tree | 060193a481e1e8d6a4d9ac484e00dc68c31fdcd0 /src | |
| parent | dfe1c820d3dca6673aba911a4a37969bbabd0486 (diff) | |
| download | emacs-a06dd3b9187489b61f08256d9e9a07745302dc4e.tar.gz emacs-a06dd3b9187489b61f08256d9e9a07745302dc4e.zip | |
Fix hscrolling with line numbers on TTY frames
* src/xdisp.c (hscroll_window_tree): Correct the X offset
calculations on TTY frames.
* src/term.c (produce_glyphs): Use it->lnum_pixel_width instead of
a kludge using it->lnum_width.
Diffstat (limited to 'src')
| -rw-r--r-- | src/term.c | 10 | ||||
| -rw-r--r-- | src/xdisp.c | 9 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/term.c b/src/term.c index 46d8bff73cc..00a272c3b0b 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -1584,14 +1584,16 @@ produce_glyphs (struct it *it) | |||
| 1584 | { | 1584 | { |
| 1585 | int absolute_x = (it->current_x | 1585 | int absolute_x = (it->current_x |
| 1586 | + it->continuation_lines_width); | 1586 | + it->continuation_lines_width); |
| 1587 | /* Adjust for line numbers. Kludge alert: the "2" below is | 1587 | int x0 = absolute_x; |
| 1588 | because we add 2 blanks to the actual line number. */ | 1588 | /* Adjust for line numbers. */ |
| 1589 | if (!NILP (Vdisplay_line_numbers)) | 1589 | if (!NILP (Vdisplay_line_numbers)) |
| 1590 | absolute_x -= it->lnum_width + 2 - it->w->hscroll; | 1590 | absolute_x -= it->lnum_pixel_width; |
| 1591 | int next_tab_x | 1591 | int next_tab_x |
| 1592 | = (((1 + absolute_x + it->tab_width - 1) | 1592 | = (((1 + absolute_x + it->tab_width - 1) |
| 1593 | / it->tab_width) | 1593 | / it->tab_width) |
| 1594 | * it->tab_width); | 1594 | * it->tab_width); |
| 1595 | if (!NILP (Vdisplay_line_numbers)) | ||
| 1596 | next_tab_x += it->lnum_pixel_width; | ||
| 1595 | int nspaces; | 1597 | int nspaces; |
| 1596 | 1598 | ||
| 1597 | /* If part of the TAB has been displayed on the previous line | 1599 | /* If part of the TAB has been displayed on the previous line |
| @@ -1599,7 +1601,7 @@ produce_glyphs (struct it *it) | |||
| 1599 | been incremented already by the part that fitted on the | 1601 | been incremented already by the part that fitted on the |
| 1600 | continued line. So, we will get the right number of spaces | 1602 | continued line. So, we will get the right number of spaces |
| 1601 | here. */ | 1603 | here. */ |
| 1602 | nspaces = next_tab_x - absolute_x; | 1604 | nspaces = next_tab_x - x0; |
| 1603 | 1605 | ||
| 1604 | if (it->glyph_row) | 1606 | if (it->glyph_row) |
| 1605 | { | 1607 | { |
diff --git a/src/xdisp.c b/src/xdisp.c index 3fc5f29d0c4..26b19eb44fb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -13100,6 +13100,12 @@ hscroll_window_tree (Lisp_Object window) | |||
| 13100 | } | 13100 | } |
| 13101 | } | 13101 | } |
| 13102 | } | 13102 | } |
| 13103 | if (cursor_row->truncated_on_left_p) | ||
| 13104 | { | ||
| 13105 | /* On TTY frames, don't count the left truncation glyph. */ | ||
| 13106 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | ||
| 13107 | x_offset -= (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)); | ||
| 13108 | } | ||
| 13103 | 13109 | ||
| 13104 | text_area_width = window_box_width (w, TEXT_AREA); | 13110 | text_area_width = window_box_width (w, TEXT_AREA); |
| 13105 | 13111 | ||
| @@ -28004,7 +28010,8 @@ x_produce_glyphs (struct it *it) | |||
| 28004 | x -= it->lnum_pixel_width; | 28010 | x -= it->lnum_pixel_width; |
| 28005 | int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; | 28011 | int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; |
| 28006 | if (!NILP (Vdisplay_line_numbers)) | 28012 | if (!NILP (Vdisplay_line_numbers)) |
| 28007 | next_tab_x += it->lnum_pixel_width; | 28013 | next_tab_x += (it->lnum_pixel_width |
| 28014 | - it->w->hscroll * font->space_width); | ||
| 28008 | 28015 | ||
| 28009 | /* If the distance from the current position to the next tab | 28016 | /* If the distance from the current position to the next tab |
| 28010 | stop is less than a space character width, use the | 28017 | stop is less than a space character width, use the |