[m-rev.] vim syntax highlighting & line wrapping

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Jan 27 20:17:58 AEDT 2003


On 25-Jan-2003, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> Fix line wrapping.

The following patch should help prevent such problems in future.
(You might all want to update your copy of `mercury.vim'.)

Estimated hours taken: 0.25
Branches: main

vim/syntax/mercury.vim:
	When checking for lines with length > 80 columns,
	handle tabs properly (assuming the tab size 8).

Workspace: /home/ceres/fjh/ws-ceres2/mercury
Index: vim/syntax/mercury.vim
===================================================================
RCS file: /home/mercury1/repository/mercury/vim/syntax/mercury.vim,v
retrieving revision 1.1
diff -u -d -r1.1 mercury.vim
--- vim/syntax/mercury.vim	8 Apr 2002 03:06:57 -0000	1.1
+++ vim/syntax/mercury.vim	27 Jan 2003 09:14:14 -0000
@@ -60,8 +60,12 @@
 syn region  mercuryClauseHead   start=+^[a-zA-Z]+ end=+=\|:-\|\.\s*$\|-->+                    contains=mercuryComment,mercuryCComment,mercuryAtom,mercuryString
 syn region  mercuryCComment     start=+/\*+ end=+\*/+                                         contains=mercuryToDo
 if !exists("mercury_no_highlight_overlong") || !mercury_no_highlight_overlong
-  syn match   mercuryFirst80 +^.\{80}+                                                          contains=ALL
-  syn match   mercuryTooLong +^.\{81,}+                                                         contains=mercuryFirst80
+  " The complicated regexp here matches an 80-column string,
+  " with proper treatment of tabs (assuming the tab size is 8):
+  " each row consists of 10 columns, and each column consists of either 8
+  " non-tab characters, or 0-7 non-tab characters followed by a tab.
+  syn match   mercuryFirst80 +^\([^	]\{8}\|[^	]\{0,7}	\)\{10}+                                contains=ALL
+  syn match   mercuryTooLong +^\([^	]\{8}\|[^	]\{0,7}	\)\{10}..*+                             contains=mercuryFirst80
 endif
 
 syn sync fromstart


-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list