Patch 9.0.1461
Problem:    Ruler not drawn correctly when using 'rulerformat'.
Solution:   Adjust formatting depending on whether the ruler is drawn in the
            statusline or the command line. (Sean Dewar, closes #12246)
Files:      src/screen.c, src/testdir/test_cmdline.vim,
            src/testdir/dumps/Test_rulerformat_position.dump


*** ../vim-9.0.1460/src/screen.c        2023-03-03 12:26:11.553759303 +0000
--- src/screen.c        2023-04-17 16:39:08.380832581 +0100
***************
*** 1043,1049 ****
      {
        row = statusline_row(wp);
        fillchar = fillchar_status(&attr, wp);
!       maxwidth = wp->w_width;
  
        if (draw_ruler)
        {
--- 1043,1050 ----
      {
        row = statusline_row(wp);
        fillchar = fillchar_status(&attr, wp);
!       int in_status_line = wp->w_status_height != 0;
!       maxwidth = in_status_line ? wp->w_width : Columns;
  
        if (draw_ruler)
        {
***************
*** 1060,1070 ****
                if (*stl++ != '(')
                    stl = p_ruf;
            }
!           col = ru_col - (Columns - wp->w_width);
!           if (col < (wp->w_width + 1) / 2)
!               col = (wp->w_width + 1) / 2;
!           maxwidth = wp->w_width - col;
!           if (!wp->w_status_height)
            {
                row = Rows - 1;
                --maxwidth;     // writing in last column may cause scrolling
--- 1061,1071 ----
                if (*stl++ != '(')
                    stl = p_ruf;
            }
!           col = ru_col - (Columns - maxwidth);
!           if (col < (maxwidth + 1) / 2)
!               col = (maxwidth + 1) / 2;
!           maxwidth -= col;
!           if (!in_status_line)
            {
                row = Rows - 1;
                --maxwidth;     // writing in last column may cause scrolling
***************
*** 1084,1090 ****
                stl = p_stl;
        }
  
!       col += wp->w_wincol;
      }
  
      if (maxwidth <= 0)
--- 1085,1092 ----
                stl = p_stl;
        }
  
!       if (in_status_line)
!           col += wp->w_wincol;
      }
  
      if (maxwidth <= 0)
*** ../vim-9.0.1460/src/testdir/test_cmdline.vim        2023-04-17 
15:53:20.353762946 +0100
--- src/testdir/test_cmdline.vim        2023-04-17 16:34:39.925477881 +0100
***************
*** 3459,3462 ****
--- 3459,3475 ----
    cunmap a
  endfunc
  
+ func Test_rulerformat_position()
+   CheckScreendump
+ 
+   let buf = RunVimInTerminal('', #{rows: 2, cols: 20})
+   call term_sendkeys(buf, ":set ruler rulerformat=longish\<CR>")
+   call term_sendkeys(buf, ":set laststatus=0 winwidth=1\<CR>")
+   call term_sendkeys(buf, "\<C-W>v\<C-W>|\<C-W>p")
+   call VerifyScreenDump(buf, 'Test_rulerformat_position', {})
+ 
+   " clean up
+   call StopVimInTerminal(buf)
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.1460/src/testdir/dumps/Test_rulerformat_position.dump    
2023-04-17 16:40:08.100693633 +0100
--- src/testdir/dumps/Test_rulerformat_position.dump    2023-04-17 
16:34:39.925477881 +0100
***************
*** 0 ****
--- 1,2 ----
+ | +0&#ffffff0@17||+1&&> +0&&
+ @10|l|o|n|g|i|s|h| @2
*** ../vim-9.0.1460/src/version.c       2023-04-17 15:53:20.353762946 +0100
--- src/version.c       2023-04-17 16:36:35.037196408 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1461,
  /**/

-- 
It is illegal for anyone to give lighted cigars to dogs, cats, and other
domesticated animal kept as pets.
                [real standing law in Illinois, United States of America]

 /// Bram Moolenaar -- b...@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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230417154211.21AF91C0423%40moolenaar.net.

Raspunde prin e-mail lui