Mercurial > vim
comparison src/screen.c @ 14081:45c595c0ddaf v8.1.0058
patch 8.1.0058: display problem with margins and scrolling
commit https://github.com/vim/vim/commit/bfa4246768e28335ed9b98f83019ea58b480158e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 16 16:20:52 2018 +0200
patch 8.1.0058: display problem with margins and scrolling
Problem: Display problem with margins and scrolling.
Solution: Place the cursor in the right column. (Kouichi Iwamoto,
closes #3016)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 16 Jun 2018 16:30:06 +0200 |
parents | b5e43a048878 |
children | ae53a9274f50 |
comparison
equal
deleted
inserted
replaced
14080:965f722253b3 | 14081:45c595c0ddaf |
---|---|
9795 { | 9795 { |
9796 int i; | 9796 int i; |
9797 int j; | 9797 int j; |
9798 unsigned temp; | 9798 unsigned temp; |
9799 int cursor_row; | 9799 int cursor_row; |
9800 int cursor_col = 0; | |
9800 int type; | 9801 int type; |
9801 int result_empty; | 9802 int result_empty; |
9802 int can_ce = can_clear(T_CE); | 9803 int can_ce = can_clear(T_CE); |
9803 | 9804 |
9804 /* | 9805 /* |
9891 /* Don't update the GUI cursor here, ScreenLines[] is invalid until the | 9892 /* Don't update the GUI cursor here, ScreenLines[] is invalid until the |
9892 * scrolling is actually carried out. */ | 9893 * scrolling is actually carried out. */ |
9893 gui_dont_update_cursor(row + off <= gui.cursor_row); | 9894 gui_dont_update_cursor(row + off <= gui.cursor_row); |
9894 #endif | 9895 #endif |
9895 | 9896 |
9897 if (wp != NULL && wp->w_wincol != 0 && *T_CSV != NUL && *T_CCS == NUL) | |
9898 cursor_col = wp->w_wincol; | |
9899 | |
9896 if (*T_CCS != NUL) /* cursor relative to region */ | 9900 if (*T_CCS != NUL) /* cursor relative to region */ |
9897 cursor_row = row; | 9901 cursor_row = row; |
9898 else | 9902 else |
9899 cursor_row = row + off; | 9903 cursor_row = row + off; |
9900 | 9904 |
9937 lineinvalid(temp, (int)Columns); | 9941 lineinvalid(temp, (int)Columns); |
9938 } | 9942 } |
9939 } | 9943 } |
9940 | 9944 |
9941 screen_stop_highlight(); | 9945 screen_stop_highlight(); |
9942 windgoto(cursor_row, 0); | 9946 windgoto(cursor_row, cursor_col); |
9943 if (clear_attr != 0) | 9947 if (clear_attr != 0) |
9944 screen_start_highlight(clear_attr); | 9948 screen_start_highlight(clear_attr); |
9945 | 9949 |
9946 /* redraw the characters */ | 9950 /* redraw the characters */ |
9947 if (type == USE_REDRAW) | 9951 if (type == USE_REDRAW) |
9956 for (i = 0; i < line_count; i++) | 9960 for (i = 0; i < line_count; i++) |
9957 { | 9961 { |
9958 if (type == USE_T_AL) | 9962 if (type == USE_T_AL) |
9959 { | 9963 { |
9960 if (i && cursor_row != 0) | 9964 if (i && cursor_row != 0) |
9961 windgoto(cursor_row, 0); | 9965 windgoto(cursor_row, cursor_col); |
9962 out_str(T_AL); | 9966 out_str(T_AL); |
9963 } | 9967 } |
9964 else /* type == USE_T_SR */ | 9968 else /* type == USE_T_SR */ |
9965 out_str(T_SR); | 9969 out_str(T_SR); |
9966 screen_start(); /* don't know where cursor is now */ | 9970 screen_start(); /* don't know where cursor is now */ |
9973 */ | 9977 */ |
9974 if (type == USE_T_SR && *T_DA) | 9978 if (type == USE_T_SR && *T_DA) |
9975 { | 9979 { |
9976 for (i = 0; i < line_count; ++i) | 9980 for (i = 0; i < line_count; ++i) |
9977 { | 9981 { |
9978 windgoto(off + i, 0); | 9982 windgoto(off + i, cursor_col); |
9979 out_str(T_CE); | 9983 out_str(T_CE); |
9980 screen_start(); /* don't know where cursor is now */ | 9984 screen_start(); /* don't know where cursor is now */ |
9981 } | 9985 } |
9982 } | 9986 } |
9983 | 9987 |
10009 { | 10013 { |
10010 int j; | 10014 int j; |
10011 int i; | 10015 int i; |
10012 unsigned temp; | 10016 unsigned temp; |
10013 int cursor_row; | 10017 int cursor_row; |
10018 int cursor_col = 0; | |
10014 int cursor_end; | 10019 int cursor_end; |
10015 int result_empty; /* result is empty until end of region */ | 10020 int result_empty; /* result is empty until end of region */ |
10016 int can_delete; /* deleting line codes can be used */ | 10021 int can_delete; /* deleting line codes can be used */ |
10017 int type; | 10022 int type; |
10018 | 10023 |
10108 * scrolling is actually carried out. */ | 10113 * scrolling is actually carried out. */ |
10109 gui_dont_update_cursor(gui.cursor_row >= row + off | 10114 gui_dont_update_cursor(gui.cursor_row >= row + off |
10110 && gui.cursor_row < end + off); | 10115 && gui.cursor_row < end + off); |
10111 #endif | 10116 #endif |
10112 | 10117 |
10118 if (wp != NULL && wp->w_wincol != 0 && *T_CSV != NUL && *T_CCS == NUL) | |
10119 cursor_col = wp->w_wincol; | |
10120 | |
10113 if (*T_CCS != NUL) /* cursor relative to region */ | 10121 if (*T_CCS != NUL) /* cursor relative to region */ |
10114 { | 10122 { |
10115 cursor_row = row; | 10123 cursor_row = row; |
10116 cursor_end = end; | 10124 cursor_end = end; |
10117 } | 10125 } |
10170 /* redraw the characters */ | 10178 /* redraw the characters */ |
10171 if (type == USE_REDRAW) | 10179 if (type == USE_REDRAW) |
10172 redraw_block(row, end, wp); | 10180 redraw_block(row, end, wp); |
10173 else if (type == USE_T_CD) /* delete the lines */ | 10181 else if (type == USE_T_CD) /* delete the lines */ |
10174 { | 10182 { |
10175 windgoto(cursor_row, 0); | 10183 windgoto(cursor_row, cursor_col); |
10176 out_str(T_CD); | 10184 out_str(T_CD); |
10177 screen_start(); /* don't know where cursor is now */ | 10185 screen_start(); /* don't know where cursor is now */ |
10178 } | 10186 } |
10179 else if (type == USE_T_CDL) | 10187 else if (type == USE_T_CDL) |
10180 { | 10188 { |
10181 windgoto(cursor_row, 0); | 10189 windgoto(cursor_row, cursor_col); |
10182 term_delete_lines(line_count); | 10190 term_delete_lines(line_count); |
10183 screen_start(); /* don't know where cursor is now */ | 10191 screen_start(); /* don't know where cursor is now */ |
10184 } | 10192 } |
10185 /* | 10193 /* |
10186 * Deleting lines at top of the screen or scroll region: Just scroll | 10194 * Deleting lines at top of the screen or scroll region: Just scroll |
10187 * the whole screen (scroll region) up by outputting newlines on the | 10195 * the whole screen (scroll region) up by outputting newlines on the |
10188 * last line. | 10196 * last line. |
10189 */ | 10197 */ |
10190 else if (type == USE_NL) | 10198 else if (type == USE_NL) |
10191 { | 10199 { |
10192 windgoto(cursor_end - 1, 0); | 10200 windgoto(cursor_end - 1, cursor_col); |
10193 for (i = line_count; --i >= 0; ) | 10201 for (i = line_count; --i >= 0; ) |
10194 out_char('\n'); /* cursor will remain on same line */ | 10202 out_char('\n'); /* cursor will remain on same line */ |
10195 } | 10203 } |
10196 else | 10204 else |
10197 { | 10205 { |
10198 for (i = line_count; --i >= 0; ) | 10206 for (i = line_count; --i >= 0; ) |
10199 { | 10207 { |
10200 if (type == USE_T_DL) | 10208 if (type == USE_T_DL) |
10201 { | 10209 { |
10202 windgoto(cursor_row, 0); | 10210 windgoto(cursor_row, cursor_col); |
10203 out_str(T_DL); /* delete a line */ | 10211 out_str(T_DL); /* delete a line */ |
10204 } | 10212 } |
10205 else /* type == USE_T_CE */ | 10213 else /* type == USE_T_CE */ |
10206 { | 10214 { |
10207 windgoto(cursor_row + i, 0); | 10215 windgoto(cursor_row + i, cursor_col); |
10208 out_str(T_CE); /* erase a line */ | 10216 out_str(T_CE); /* erase a line */ |
10209 } | 10217 } |
10210 screen_start(); /* don't know where cursor is now */ | 10218 screen_start(); /* don't know where cursor is now */ |
10211 } | 10219 } |
10212 } | 10220 } |
10217 */ | 10225 */ |
10218 if (*T_DB && (type == USE_T_DL || type == USE_T_CDL)) | 10226 if (*T_DB && (type == USE_T_DL || type == USE_T_CDL)) |
10219 { | 10227 { |
10220 for (i = line_count; i > 0; --i) | 10228 for (i = line_count; i > 0; --i) |
10221 { | 10229 { |
10222 windgoto(cursor_end - i, 0); | 10230 windgoto(cursor_end - i, cursor_col); |
10223 out_str(T_CE); /* erase a line */ | 10231 out_str(T_CE); /* erase a line */ |
10224 screen_start(); /* don't know where cursor is now */ | 10232 screen_start(); /* don't know where cursor is now */ |
10225 } | 10233 } |
10226 } | 10234 } |
10227 | 10235 |