On Mi, 20 Jun 2012, [email protected] wrote:
> Status: New
> Owner: ----
> Labels: Type-Defect Priority-Medium
>
> New issue 65 by [email protected]: Auto-wrap inside comments with
> numbered list is broken (regression)
> http://code.google.com/p/vim/issues/detail?id=65
>
> What steps will reproduce the problem?
>
> vim -N -u NONE
> :setl tw=80 fo+=nc comments=:#
> :call setline(1, '# 1 ' . repeat('x', 70))
> :normal! A foobar
>
>
> What is the expected output?
>
> # 1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> # foobar
>
> What do you see instead?
>
> # 1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> # foorba
>
>
> What version of the product are you using? On what operating system?
>
> This is the latest Vim on Ubuntu/x86. The problem does not occur
> with Vim 7.3.0 on Windows/x86 or Vim 7.1.138 on Ubuntu/x86.
>
> :version
> VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 20 2012 16:55:09)
> Included patches: 1-562
> Big version with GTK2 GUI. Features included (+) or not (-):
>
>
> Please provide any additional information below.
>
> I encountered this when editing a shell script header (ft=sh), and
> whittled it down to the steps above. There must be both a comment
> leader (#) and a number following it for the bug to occur, together
> with "n" and "c" in 'formatoptions'.
The bug was introduced with patch 7.3.552. The attached patch fixes it
(test included).
regards,
Christian
--
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
diff --git a/src/edit.c b/src/edit.c
--- a/src/edit.c
+++ b/src/edit.c
@@ -6311,7 +6311,7 @@
replace_offset = 0;
if (first_line)
{
- if (!(flags & INSCHAR_COM_LIST))
+ if (!(flags & INSCHAR_COM_LIST) && !has_format_option(FO_Q_COMS))
{
/*
* This section is for numeric lists w/o comments. If comment
diff --git a/src/testdir/test68.in b/src/testdir/test68.in
--- a/src/testdir/test68.in
+++ b/src/testdir/test68.in
@@ -83,6 +83,14 @@
}
STARTTEST
+/^#/
+:setl tw=12 fo=tqnc comments=:#
+A foobar
+ENDTEST
+
+# 1 xxxxx
+
+STARTTEST
:g/^STARTTEST/.,/^ENDTEST/d
:1;/^Results/,$wq! test.out
ENDTEST
diff --git a/src/testdir/test68.ok b/src/testdir/test68.ok
--- a/src/testdir/test68.ok
+++ b/src/testdir/test68.ok
@@ -48,3 +48,7 @@
{ 1aa ^^2bb }
+
+# 1 xxxxx
+# foobar
+