To: vim-dev@vim.org Subject: Patch 5.6a.006 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6a.006 Problem: Using a backwards range inside ":if 0" gave an error message. Solution: Don't complain about a range when it is not going to be used. (Stefan Roemer) Files: src/ex_docmd.c *** ../vim-5.6a.5/src/ex_docmd.c Tue Dec 21 13:03:08 1999 --- src/ex_docmd.c Tue Dec 21 21:32:50 1999 *************** *** 1040,1069 **** } /* ! * If the range is backwards, ask for confirmation and, if given, swap ! * ea.line1 & ea.line2 so it's forwards again. ! * When global command is busy, don't ask, will fail below. */ ! if (!global_busy && ea.line1 > ea.line2) { ! if (sourcing) { ! errormsg = (char_u *)"Backwards range given"; ! goto doend; ! } ! else if (ask_yesno((char_u *) "Backwards range given, OK to swap", FALSE) != 'y') goto doend; - lnum = ea.line1; - ea.line1 = ea.line2; - ea.line2 = lnum; } - /* - * don't complain about the range if it is not used - * (could happen if line_count is accidently set to 0) - */ - if (!ea.skip && (errormsg = invalid_range(&ea)) != NULL) - goto doend; if ((ea.argt & NOTADR) && ea.addr_count == 0) /* default is 1, not cursor */ ea.line2 = 1; --- 1040,1072 ---- } /* ! * Don't complain about the range if it is not used ! * (could happen if line_count is accidentally set to 0). */ ! if (!ea.skip) { ! /* ! * If the range is backwards, ask for confirmation and, if given, swap ! * ea.line1 & ea.line2 so it's forwards again. ! * When global command is busy, don't ask, will fail below. ! */ ! if (!global_busy && ea.line1 > ea.line2) { ! if (sourcing) ! { ! errormsg = (char_u *)"Backwards range given"; ! goto doend; ! } ! else if (ask_yesno((char_u *) "Backwards range given, OK to swap", FALSE) != 'y') + goto doend; + lnum = ea.line1; + ea.line1 = ea.line2; + ea.line2 = lnum; + } + if ((errormsg = invalid_range(&ea)) != NULL) goto doend; } if ((ea.argt & NOTADR) && ea.addr_count == 0) /* default is 1, not cursor */ ea.line2 = 1; *** ../vim-5.6a.5/src/version.c Tue Dec 21 16:19:46 1999 --- src/version.c Tue Dec 21 21:30:53 1999 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 6, /**/ -- No children may attend school with their breath smelling of "wild onions." [real standing law in West Virginia, United States of America] --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /