]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0907: printoptions:portrait does not change postscript Orientation v9.1.0907
authorChristian Brabandt <cb@256bit.org>
Fri, 6 Dec 2024 16:19:25 +0000 (17:19 +0100)
committerChristian Brabandt <cb@256bit.org>
Fri, 6 Dec 2024 16:19:25 +0000 (17:19 +0100)
Problem:  printoptions:portrait does not change postscript Orientation
Solution: Set Orientation depending on portrait suboption.

fixes: #16156
closes: #16174

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/hardcopy.c
src/testdir/test_hardcopy.vim
src/version.c

index 8abfff210737711ffb686122c26d01f16e2c64dd..785a3f55434775caa715276d042b5850a3d78e6d 100644 (file)
@@ -2742,7 +2742,7 @@ mch_print_begin(prt_settings_T *psettings)
 
     prt_dsc_textline("CreationDate", get_ctime(time(NULL), FALSE));
     prt_dsc_textline("DocumentData", "Clean8Bit");
-    prt_dsc_textline("Orientation", "Portrait");
+    prt_dsc_textline("Orientation", prt_portrait ? "Portrait" : "Landscape");
     prt_dsc_atend("Pages");
     prt_dsc_textline("PageOrder", "Ascend");
     // The bbox does not change with orientation - it is always in the default
index be83728b4f950c532952792d106d813de9089903..926ff8f97d08b0ce189f69cec34fa1d2f7371842 100644 (file)
@@ -209,4 +209,31 @@ func Test_illegal_byte()
   call delete('Xpstest')
 endfunc
 
+func Test_printoptions_portrait()
+  CheckFeature postscript
+  edit test_hardcopy.vim
+  syn on
+
+  set printoptions=portrait:y
+  1,50hardcopy > Xhardcopy_printoptions_portrait
+  let lines = readfile('Xhardcopy_printoptions_portrait')
+  call assert_match('Orientation: Portrait', lines[6])
+  call assert_match('BoundingBox: 59 49 564 800', lines[9])
+  call assert_match('DocumentMedia: A4', lines[10])
+  call assert_match('PageMedia: A4', lines[24])
+  call delete('Xhardcopy_printoptions')
+
+  set printoptions=portrait:n
+  1,50hardcopy > Xhardcopy_printoptions_portrait
+  let lines = readfile('Xhardcopy_printoptions_portrait')
+  call assert_match('Orientation: Landscape', lines[6])
+  call assert_match('BoundingBox: 59 42 590 756', lines[9])
+  call assert_match('DocumentMedia: A4', lines[10])
+  call assert_match('PageMedia: A4', lines[24])
+  call delete('Xhardcopy_printoptions')
+
+  set printoptions&
+  bwipe
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index c230d4f9d03dacc6c39203fe8ba3d6baaeac9ac9..bdd605317fbe54530e0e67418bcb834cf7872167 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    907,
 /**/
     906,
 /**/