To: vim_dev@googlegroups.com Subject: Patch 9.0.0534 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0534 Problem: Line number is displayed at virtual text "above". Solution: Show the line number at the text line. Files: src/drawline.c, src/testdir/dumps/Test_prop_with_text_above_4.dump, src/testdir/dumps/Test_prop_with_text_above_5.dump, src/testdir/dumps/Test_prop_with_text_above_6.dump, src/testdir/dumps/Test_prop_with_text_above_7.dump, src/testdir/dumps/Test_prop_with_text_above_8.dump *** ../vim-9.0.0533/src/drawline.c 2022-09-21 15:41:23.554448278 +0100 --- src/drawline.c 2022-09-21 16:28:09.155770335 +0100 *************** *** 117,122 **** --- 117,125 ---- int need_showbreak; // overlong line, skipping first x chars int dont_use_showbreak; // do not use 'showbreak' #endif + #ifdef FEAT_PROP_POPUP + int text_prop_above_count; + #endif // TRUE when 'cursorlineopt' has "screenline" and cursor is in this line int cul_screenline; *************** *** 357,412 **** #endif { // Draw the line number (empty space after wrapping). ! if (wlv->row == wlv->startrow + wlv->filler_lines) { ! long num; ! char *fmt = "%*ld "; ! if (wp->w_p_nu && !wp->w_p_rnu) ! // 'number' + 'norelativenumber' ! num = (long)wlv->lnum; ! else ! { ! // 'relativenumber', don't use negative numbers ! num = labs((long)get_cursor_rel_lnum(wp, wlv->lnum)); ! if (num == 0 && wp->w_p_nu && wp->w_p_rnu) ! { ! // 'number' + 'relativenumber' ! num = wlv->lnum; ! fmt = "%-*ld "; ! } ! } ! ! sprintf((char *)wlv->extra, fmt, number_width(wp), num); ! if (wp->w_skipcol > 0) ! for (wlv->p_extra = wlv->extra; *wlv->p_extra == ' '; ! ++wlv->p_extra) ! *wlv->p_extra = '-'; #ifdef FEAT_RIGHTLEFT ! if (wp->w_p_rl) // reverse line numbers ! { ! char_u *p1, *p2; ! int t; ! ! // like rl_mirror(), but keep the space at the end ! p2 = skipwhite(wlv->extra); ! p2 = skiptowhite(p2) - 1; ! for (p1 = skipwhite(wlv->extra); p1 < p2; ++p1, --p2) ! { ! t = *p1; ! *p1 = *p2; ! *p2 = t; ! } ! } ! #endif ! wlv->p_extra = wlv->extra; ! wlv->c_extra = NUL; ! wlv->c_final = NUL; } else { ! wlv->c_extra = ' '; ! wlv->c_final = NUL; } wlv->n_extra = number_width(wp) + 1; wlv->char_attr = hl_combine_attr(wlv->wcr_attr, HL_ATTR(HLF_N)); --- 360,421 ---- #endif { // Draw the line number (empty space after wrapping). ! // When there are text properties above the line put the line number ! // below them. ! if (wlv->row == wlv->startrow + wlv->filler_lines ! #ifdef FEAT_PROP_POPUP ! + wlv->text_prop_above_count ! #endif ! ) { ! long num; ! char *fmt = "%*ld "; ! if (wp->w_p_nu && !wp->w_p_rnu) ! // 'number' + 'norelativenumber' ! num = (long)wlv->lnum; ! else ! { ! // 'relativenumber', don't use negative numbers ! num = labs((long)get_cursor_rel_lnum(wp, wlv->lnum)); ! if (num == 0 && wp->w_p_nu && wp->w_p_rnu) ! { ! // 'number' + 'relativenumber' ! num = wlv->lnum; ! fmt = "%-*ld "; ! } ! } ! ! sprintf((char *)wlv->extra, fmt, number_width(wp), num); ! if (wp->w_skipcol > 0) ! for (wlv->p_extra = wlv->extra; *wlv->p_extra == ' '; ! ++wlv->p_extra) ! *wlv->p_extra = '-'; #ifdef FEAT_RIGHTLEFT ! if (wp->w_p_rl) // reverse line numbers ! { ! char_u *p1, *p2; ! int t; ! ! // like rl_mirror(), but keep the space at the end ! p2 = skipwhite(wlv->extra); ! p2 = skiptowhite(p2) - 1; ! for (p1 = skipwhite(wlv->extra); p1 < p2; ++p1, --p2) ! { ! t = *p1; ! *p1 = *p2; ! *p2 = t; ! } ! } ! #endif ! wlv->p_extra = wlv->extra; ! wlv->c_extra = NUL; ! wlv->c_final = NUL; } else { ! wlv->c_extra = ' '; ! wlv->c_final = NUL; } wlv->n_extra = number_width(wp) + 1; wlv->char_attr = hl_combine_attr(wlv->wcr_attr, HL_ATTR(HLF_N)); *************** *** 1610,1617 **** if (text_prop_idxs == NULL) VIM_CLEAR(text_props); ! area_highlighting = TRUE; ! extra_check = TRUE; } } #endif --- 1619,1632 ---- if (text_prop_idxs == NULL) VIM_CLEAR(text_props); ! if (text_props != NULL) ! { ! area_highlighting = TRUE; ! extra_check = TRUE; ! for (int i = 0; i < text_prop_count; ++i) ! if (text_props[i].tp_flags & TP_FLAG_ALIGN_ABOVE) ! ++wlv.text_prop_above_count; ! } } } #endif *** ../vim-9.0.0533/src/testdir/dumps/Test_prop_with_text_above_4.dump 2022-09-20 16:15:25.804584428 +0100 --- src/testdir/dumps/Test_prop_with_text_above_4.dump 2022-09-21 16:28:33.591670499 +0100 *************** *** 1,9 **** ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |f+0#0000000#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@36 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|s+0#0000000#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@35 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|i+0#0000000&|n|s|e|r|t|e|d> |o|n|e| |t|w|o| @37 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| |t+0#0000000&|h|r|e@1| |f|o|u|r| @43 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| | +0#0000000&@2|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| +0&#ffffff0@37 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|f+0#0000000&|i|v|e| |s|i|x| @45 |~+0#4040ff13&| @58 |~| @58 | +0#0000000&@41|1|,|9|-|1@1|7| @6|A|l@1| --- 1,9 ---- ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|f+0#0000000#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@36 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|s+0#0000000#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@35 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |i+0#0000000&|n|s|e|r|t|e|d> |o|n|e| |t|w|o| @37 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| |t+0#0000000&|h|r|e@1| |f|o|u|r| @43 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3| +0#0000000&@2|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| +0&#ffffff0@37 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |f+0#0000000&|i|v|e| |s|i|x| @45 |~+0#4040ff13&| @58 |~| @58 | +0#0000000&@41|1|,|9|-|1@1|7| @6|A|l@1| *** ../vim-9.0.0533/src/testdir/dumps/Test_prop_with_text_above_5.dump 2022-09-20 16:15:25.804584428 +0100 --- src/testdir/dumps/Test_prop_with_text_above_5.dump 2022-09-21 16:28:34.747665834 +0100 *************** *** 1,9 **** ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |f+0#0000000#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@36 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|s+0#0000000#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@35 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|i+0#0000000&|n|s|e|r|t|e|d| |o|n|e| |t|w|o| @37 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| |t+0#0000000&|h|r|e@1| |f|o|u>r| @43 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| | +0#0000000&@2|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| +0&#ffffff0@37 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|f+0#0000000&|i|v|e| |s|i|x| @45 |~+0#4040ff13&| @58 |~| @58 |:+0#0000000&|s|e|t| |n|o|w|r|a|p| @30|2|,|1|0| @9|A|l@1| --- 1,9 ---- ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|f+0#0000000#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@36 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|s+0#0000000#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@35 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |i+0#0000000&|n|s|e|r|t|e|d| |o|n|e| |t|w|o| @37 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| |t+0#0000000&|h|r|e@1| |f|o|u>r| @43 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3| +0#0000000&@2|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| +0&#ffffff0@37 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |f+0#0000000&|i|v|e| |s|i|x| @45 |~+0#4040ff13&| @58 |~| @58 |:+0#0000000&|s|e|t| |n|o|w|r|a|p| @30|2|,|1|0| @9|A|l@1| *** ../vim-9.0.0533/src/testdir/dumps/Test_prop_with_text_above_6.dump 2022-09-20 16:15:25.804584428 +0100 --- src/testdir/dumps/Test_prop_with_text_above_6.dump 2022-09-21 16:28:35.907661160 +0100 *************** *** 1,9 **** ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |f+0#0000000#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@36 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|s+0#0000000#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@35 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|i+0#0000000#e0e0e08|n|s|e|r|t|e>d+0&#ffffff0| |o|n|e| |t|w|o| @37 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|b+0#0000000#5fd7ff255|e|l|o|w| +0&#ffffff0@48 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| |t+0#0000000&|h|r|e@1| |f|o|u|r| @43 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| | +0#0000000&@2|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| +0&#ffffff0@37 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|f+0#0000000&|i|v|e| |s|i|x| @45 |~+0#4040ff13&| @58 |-+2#0000000&@1| |V|I|S|U|A|L| |-@1| +0&&@19|8| @8|1|,|8|-|1@1|6| @6|A|l@1| --- 1,9 ---- ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|f+0#0000000#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@36 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|s+0#0000000#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@35 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |i+0#0000000#e0e0e08|n|s|e|r|t|e>d+0&#ffffff0| |o|n|e| |t|w|o| @37 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|b+0#0000000#5fd7ff255|e|l|o|w| +0&#ffffff0@48 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| |t+0#0000000&|h|r|e@1| |f|o|u|r| @43 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3| +0#0000000&@2|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| +0&#ffffff0@37 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |f+0#0000000&|i|v|e| |s|i|x| @45 |~+0#4040ff13&| @58 |-+2#0000000&@1| |V|I|S|U|A|L| |-@1| +0&&@19|8| @8|1|,|8|-|1@1|6| @6|A|l@1| *** ../vim-9.0.0533/src/testdir/dumps/Test_prop_with_text_above_7.dump 2022-09-20 16:15:25.804584428 +0100 --- src/testdir/dumps/Test_prop_with_text_above_7.dump 2022-09-21 16:28:37.067656491 +0100 *************** *** 1,9 **** ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |f+0#0000000#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@36 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|s+0#0000000#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@35 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|i+0#0000000#e0e0e08|n|s|e|r|t|e>d+0&#ffffff0| +0&#e0e0e08|o|n|e| |t|w|o| +0&#ffffff0@37 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|b+0#0000000#5fd7ff255|e|l|o|w| +0#4040ff13#ffffff0| +0#0000000&@47 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| |t+0#0000000&|h|r|e@1| |f|o|u|r| @43 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| | +0#0000000&@2|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| +0&#ffffff0@37 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|f+0#0000000&|i|v|e| |s|i|x| @45 |~+0#4040ff13&| @58 |-+2#0000000&@1| |V|I|S|U|A|L| |L|I|N|E| |-@1| +0&&@14|1| @8|1|,|8|-|1@1|6| @6|A|l@1| --- 1,9 ---- ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|f+0#0000000#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@36 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|s+0#0000000#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@35 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |i+0#0000000#e0e0e08|n|s|e|r|t|e>d+0&#ffffff0| +0&#e0e0e08|o|n|e| |t|w|o| +0&#ffffff0@37 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|b+0#0000000#5fd7ff255|e|l|o|w| +0#4040ff13#ffffff0| +0#0000000&@47 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| |t+0#0000000&|h|r|e@1| |f|o|u|r| @43 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3| +0#0000000&@2|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| +0&#ffffff0@37 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |f+0#0000000&|i|v|e| |s|i|x| @45 |~+0#4040ff13&| @58 |-+2#0000000&@1| |V|I|S|U|A|L| |L|I|N|E| |-@1| +0&&@14|1| @8|1|,|8|-|1@1|6| @6|A|l@1| *** ../vim-9.0.0533/src/testdir/dumps/Test_prop_with_text_above_8.dump 2022-09-20 16:15:25.804584428 +0100 --- src/testdir/dumps/Test_prop_with_text_above_8.dump 2022-09-21 16:28:38.227651828 +0100 *************** *** 1,9 **** ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |f+0#0000000#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@36 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|s+0#0000000#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@35 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|i+0#0000000&|n|s|e|r|t|e|d| @45 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| >o+0#0000000&|n|e| |t|w|o| @46 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|b+0#0000000#5fd7ff255|e|l|o|w| +0&#ffffff0@48 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |t+0#0000000&|h|r|e@1| |f|o|u|r| @43 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|4| | +0#0000000&@2|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| +0&#ffffff0@37 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|f+0#0000000&|i|v|e| |s|i|x| @45 @42|2|,|1| @10|A|l@1| --- 1,9 ---- ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|f+0#0000000#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@36 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|s+0#0000000#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| +0&#ffffff0@35 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |i+0#0000000&|n|s|e|r|t|e|d| @45 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| >o+0#0000000&|n|e| |t|w|o| @46 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|b+0#0000000#5fd7ff255|e|l|o|w| +0&#ffffff0@48 | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| |t+0#0000000&|h|r|e@1| |f|o|u|r| @43 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3| +0#0000000&@2|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| +0&#ffffff0@37 ! | +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|4| |f+0#0000000&|i|v|e| |s|i|x| @45 @42|2|,|1| @10|A|l@1| *** ../vim-9.0.0533/src/version.c 2022-09-21 15:41:23.554448278 +0100 --- src/version.c 2022-09-21 16:26:53.464095846 +0100 *************** *** 701,702 **** --- 701,704 ---- { /* Add new patch number below this line */ + /**/ + 534, /**/ -- hundred-and-one symptoms of being an internet addict: 124. You begin conversations with, "Who is your internet service provider?" /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///