• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisão4ac1dce8dd5e8d8e97e3e7b921f3ada9db2fe2de (tree)
Hora2004-07-26 21:53:41
Autorvimboss
Commitervimboss

Mensagem de Log

updated for version 7.0012

Mudança Sumário

Diff

diff -r a81bc802c17c -r 4ac1dce8dd5e Filelist
--- a/Filelist Mon Jul 19 20:55:54 2004 +0000
+++ b/Filelist Mon Jul 26 12:53:41 2004 +0000
@@ -148,8 +148,8 @@
148148 src/gui_gtk_f.h \
149149 src/gui_gtk_x11.c \
150150 src/gui_kde.cc \
151- src/gui_kde_widget.cc \
152- src/gui_kde_widget.h \
151+ src/gui_kde_wid.cc \
152+ src/gui_kde_wid.h \
153153 src/gui_kde_x11.cc \
154154 src/kvim_iface.h \
155155 src/gui_motif.c \
@@ -365,7 +365,7 @@
365365 src/os_mac.sit.hqx \
366366 src/os_mac_conv.c \
367367 src/os_macosx.c \
368- src/os_mac.pbproj/project.pbxproj
368+ src/os_mac.pbproj/project.pbxproj \
369369 src/proto/gui_mac.pro \
370370 src/proto/os_mac.pro \
371371
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/doc/diff.txt
--- a/runtime/doc/diff.txt Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/doc/diff.txt Mon Jul 26 12:53:41 2004 +0000
@@ -1,4 +1,4 @@
1-*diff.txt* For Vim version 7.0aa. Last change: 2004 Jul 11
1+*diff.txt* For Vim version 7.0aa. Last change: 2004 Jul 20
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -344,6 +344,10 @@
344344 If it's not clear what the problem is set the 'verbose' option to see more
345345 messages.
346346
347+The self-installing Vim includes a diff program. If you don't have it you
348+might want to download a diff.exe. For example from
349+http://jlb.twu.net/code/unixkit.php.
350+
347351
348352 USING PATCHES *diff-patchexpr*
349353
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/doc/eval.txt
--- a/runtime/doc/eval.txt Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/doc/eval.txt Mon Jul 26 12:53:41 2004 +0000
@@ -1,4 +1,4 @@
1-*eval.txt* For Vim version 7.0aa. Last change: 2004 Jul 19
1+*eval.txt* For Vim version 7.0aa. Last change: 2004 Jul 25
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -846,8 +846,10 @@
846846 getcmdline() String return the current command-line
847847 getcmdpos() Number return cursor position in command-line
848848 getcwd() String the current working directory
849-getfsize( {fname}) Number size in bytes of file
849+getfperm( {fname}) String file permissions of file {fname}
850+getfsize( {fname}) Number size in bytes of file {fname}
850851 getftime( {fname}) Number last modification time of file
852+getftype( {fname}) String description of type of file {fname}
851853 getline( {lnum}) String line {lnum} from current buffer
852854 getreg( [{regname}]) String contents of register
853855 getregtype( [{regname}]) String type of register
@@ -1580,6 +1582,20 @@
15801582 If {fname} is a directory, 0 is returned.
15811583 If the file {fname} can't be found, -1 is returned.
15821584
1585+getfperm({fname}) *getfperm()*
1586+ The result is a String, which is the read, write, and execute
1587+ permissions of the given file {fname}.
1588+ If {fname} does not exist or its directory cannot be read, an
1589+ empty string is returned.
1590+ The result is of the form "rwxrwxrwx", where each group of
1591+ "rwx" flags represent, in turn, the permissions of the owner
1592+ of the file, the group the file belongs to, and other users.
1593+ If a user does not have a given permission the flag for this
1594+ is replaced with the string "-". Example: >
1595+ :echo getfperm("/etc/passwd")
1596+< This will hopefully (from a security point of view) display
1597+ the string "rw-r--r--" or even "rw-------".
1598+
15831599 getftime({fname}) *getftime()*
15841600 The result is a Number, which is the last modification time of
15851601 the given file {fname}. The value is measured as seconds
@@ -1587,6 +1603,26 @@
15871603 |localtime()| and |strftime()|.
15881604 If the file {fname} can't be found -1 is returned.
15891605
1606+getftype({fname}) *getftype()*
1607+ The result is a String, which is a description of the kind of
1608+ file of the given file {fname}.
1609+ If {fname} does not exist an empty string is returned.
1610+ Here is a table over different kinds of files and their
1611+ results:
1612+ Normal file "file"
1613+ Directory "dir"
1614+ Symbolic link "link"
1615+ Block device "bdev"
1616+ Character device "cdev"
1617+ Socket "socket"
1618+ FIFO "fifo"
1619+ All other "other"
1620+ Example: >
1621+ getftype("/home")
1622+< Note that a type such as "link" will only be returned on
1623+ systems that support it. On some systems only "dir" and
1624+ "file" are returned.
1625+
15901626 *getline()*
15911627 getline({lnum}) The result is a String, which is line {lnum} from the current
15921628 buffer. Example: >
@@ -2246,14 +2282,16 @@
22462282 cursor position.
22472283 {flags} is a String, which can contain these character flags:
22482284 'b' search backward instead of forward
2285+ 'n' do Not move the cursor
22492286 'w' wrap around the end of the file
22502287 'W' don't wrap around the end of the file
22512288 If neither 'w' or 'W' is given, the 'wrapscan' option applies.
22522289
2253- When a match has been found its line number is returned, and
2254- the cursor will be positioned at the match. If there is no
2255- match a 0 is returned and the cursor doesn't move. No error
2256- message is given.
2290+ When a match has been found its line number is returned.
2291+ The cursor will be positioned at the match, unless the 'n'
2292+ flag is used).
2293+ If there is no match a 0 is returned and the cursor doesn't
2294+ move. No error message is given.
22572295
22582296 Example (goes over all files in the argument list): >
22592297 :let n = 1
@@ -2747,9 +2785,15 @@
27472785 the window. The first line is one.
27482786
27492787 *winnr()*
2750-winnr() The result is a Number, which is the number of the current
2751- window. The top window has number 1. The number can be used
2752- with |CTRL-W_w| and ":wincmd w" |:wincmd|.
2788+winnr([{arg}]) The result is a Number, which is the number of the current
2789+ window. The top window has number 1.
2790+ When the optional argument is "$", the number of the
2791+ last window is returnd (the window count).
2792+ When the optional argument is "#", the number of the last
2793+ accessed window is returned (where |CTRL-W_p| goes to).
2794+ If there is no previous window 0 is returned.
2795+ The number can be used with |CTRL-W_w| and ":wincmd w"
2796+ |:wincmd|.
27532797
27542798 *winrestcmd()*
27552799 winrestcmd() Returns a sequence of |:resize| commands that should restore
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/doc/if_cscop.txt
--- a/runtime/doc/if_cscop.txt Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/doc/if_cscop.txt Mon Jul 26 12:53:41 2004 +0000
@@ -1,4 +1,4 @@
1-*if_cscop.txt* For Vim version 7.0aa. Last change: 2004 Jan 17
1+*if_cscop.txt* For Vim version 7.0aa. Last change: 2004 Jul 23
22
33
44 VIM REFERENCE MANUAL by Andy Kahn
@@ -335,6 +335,9 @@
335335
336336 http://iamphet.nm.ru/cscope/index.html
337337
338+The DJGPP-built version from http://cscope.sourceforge.net is known to not
339+work with Vim.
340+
338341 There are a couple of hard-coded limitations:
339342
340343 1. The maximum number of cscope connections allowed is 8. Do you
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/doc/if_pyth.txt
--- a/runtime/doc/if_pyth.txt Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/doc/if_pyth.txt Mon Jul 26 12:53:41 2004 +0000
@@ -1,4 +1,4 @@
1-*if_pyth.txt* For Vim version 7.0aa. Last change: 2004 Feb 28
1+*if_pyth.txt* For Vim version 7.0aa. Last change: 2004 Jul 25
22
33
44 VIM REFERENCE MANUAL by Paul Moore
@@ -91,23 +91,23 @@
9191 :python import vim
9292
9393 Overview >
94- print "Hello" # displays a message
95- vim.command(cmd) # execute an ex command
96- w = vim.windows[n] # gets window "n"
97- cw = vim.current.window # gets the current window
98- b = vim.buffers[n] # gets buffer "n"
99- cb = vim.current.buffer # gets the current buffer
100- w.height = lines # sets the window height
101- w.cursor = (row, col) # sets the window cursor position
102- pos = w.cursor # gets a tuple (row, col)
103- name = b.name # gets the buffer file name
104- line = b[n] # gets a line from the buffer
105- lines = b[n:m] # gets a list of lines
106- num = len(b) # gets the number of lines
107- b[n] = str # sets a line in the buffer
108- b[n:m] = [str1, str2, str3] # sets a number of lines at once
109- del b[n] # deletes a line
110- del b[n:m] # deletes a number of lines
94+ :py print "Hello" # displays a message
95+ :py vim.command(cmd) # execute an ex command
96+ :py w = vim.windows[n] # gets window "n"
97+ :py cw = vim.current.window # gets the current window
98+ :py b = vim.buffers[n] # gets buffer "n"
99+ :py cb = vim.current.buffer # gets the current buffer
100+ :py w.height = lines # sets the window height
101+ :py w.cursor = (row, col) # sets the window cursor position
102+ :py pos = w.cursor # gets a tuple (row, col)
103+ :py name = b.name # gets the buffer file name
104+ :py line = b[n] # gets a line from the buffer
105+ :py lines = b[n:m] # gets a list of lines
106+ :py num = len(b) # gets the number of lines
107+ :py b[n] = str # sets a line in the buffer
108+ :py b[n:m] = [str1, str2, str3] # sets a number of lines at once
109+ :py del b[n] # deletes a line
110+ :py del b[n:m] # deletes a number of lines
111111
112112
113113 Methods of the "vim" module
@@ -115,8 +115,8 @@
115115 vim.command(str) *python-command*
116116 Executes the vim (ex-mode) command str. Returns None.
117117 Examples: >
118- vim.command("set tw=72")
119- vim.command("%s/aaa/bbb/g")
118+ :py vim.command("set tw=72")
119+ :py vim.command("%s/aaa/bbb/g")
120120 < The following definition executes Normal mode commands: >
121121 def normal(str):
122122 vim.command("normal "+str)
@@ -126,15 +126,15 @@
126126 < *E659*
127127 The ":python" command cannot be used recursively with Python 2.2 and
128128 older. This only works with Python 2.3 and later: >
129- :python vim.command("python print 'Hello again Python'")
129+ :py vim.command("python print 'Hello again Python'")
130130
131131 vim.eval(str) *python-eval*
132132 Evaluates the expression str using the vim internal expression
133133 evaluator (see |expression|). Returns the expression result as a
134134 string.
135135 Examples: >
136- text_width = vim.eval("&tw")
137- str = vim.eval("12+12") # NB result is a string! Use
136+ :py text_width = vim.eval("&tw")
137+ :py str = vim.eval("12+12") # NB result is a string! Use
138138 # string.atoi() to convert to
139139 # a number.
140140
@@ -158,18 +158,18 @@
158158 vim.buffers *python-buffers*
159159 A sequence object providing access to the list of vim buffers. The
160160 object supports the following operations: >
161- b = vim.buffers[i] # Indexing (read-only)
162- b in vim.buffers # Membership test
163- n = len(vim.buffers) # Number of elements
164- for b in vim.buffers: # Sequential access
161+ :py b = vim.buffers[i] # Indexing (read-only)
162+ :py b in vim.buffers # Membership test
163+ :py n = len(vim.buffers) # Number of elements
164+ :py for b in vim.buffers: # Sequential access
165165 <
166166 vim.windows *python-windows*
167167 A sequence object providing access to the list of vim windows. The
168168 object supports the following operations: >
169- w = vim.windows[i] # Indexing (read-only)
170- w in vim.windows # Membership test
171- n = len(vim.windows) # Number of elements
172- for w in vim.windows: # Sequential access
169+ :py w = vim.windows[i] # Indexing (read-only)
170+ :py w in vim.windows # Membership test
171+ :py n = len(vim.windows) # Number of elements
172+ :py for w in vim.windows: # Sequential access
173173 <
174174 vim.current *python-current*
175175 An object providing access (via specific attributes) to various
@@ -236,17 +236,21 @@
236236 represents the part of the given buffer between line
237237 numbers s and e |inclusive|.
238238
239+Note that when adding a line it must not contain a line break character '\n'.
240+A trailing '\n' is allowed and ignored, so that you can do: >
241+ :py b.append(f.readlines())
242+
239243 Examples (assume b is the current buffer) >
240- print b.name # write the buffer file name
241- b[0] = "hello!!!" # replace the top line
242- b[:] = None # delete the whole buffer
243- del b[:] # delete the whole buffer (same as above)
244- b[0:0] = [ "a line" ] # add a line at the top
245- del b[2] # delete a line (the third)
246- b.append("bottom") # add a line at the bottom
247- n = len(b) # number of lines
248- (row,col) = b.mark('a') # named mark
249- r = b.range(1,5) # a sub-range of the buffer
244+ :py print b.name # write the buffer file name
245+ :py b[0] = "hello!!!" # replace the top line
246+ :py b[:] = None # delete the whole buffer
247+ :py del b[:] # delete the whole buffer
248+ :py b[0:0] = [ "a line" ] # add a line at the top
249+ :py del b[2] # delete a line (the third)
250+ :py b.append("bottom") # add a line at the bottom
251+ :py n = len(b) # number of lines
252+ :py (row,col) = b.mark('a') # named mark
253+ :py r = b.range(1,5) # a sub-range of the buffer
250254
251255 ==============================================================================
252256 4. Range objects *python-range*
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/doc/message.txt
--- a/runtime/doc/message.txt Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/doc/message.txt Mon Jul 26 12:53:41 2004 +0000
@@ -1,4 +1,4 @@
1-*message.txt* For Vim version 7.0aa. Last change: 2004 Jan 17
1+*message.txt* For Vim version 7.0aa. Last change: 2004 Jul 23
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -643,6 +643,7 @@
643643 A command line started with a backslash or the range of a command contained a
644644 backslash in a wrong place. This is often caused by command-line continuation
645645 being disabled. Remove the 'C' flag from the 'cpoptions' option to enable it.
646+Or use ":set nocp".
646647
647648 *E471* >
648649 Argument required
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/doc/motion.txt
--- a/runtime/doc/motion.txt Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/doc/motion.txt Mon Jul 26 12:53:41 2004 +0000
@@ -1,4 +1,4 @@
1-*motion.txt* For Vim version 7.0aa. Last change: 2004 Jul 02
1+*motion.txt* For Vim version 7.0aa. Last change: 2004 Jul 25
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -83,6 +83,7 @@
8383 end of the motion is moved to the end of the previous line and the motion
8484 becomes inclusive. Example: "}" moves to the first line after a paragraph,
8585 but "d}" will not include that line.
86+ *exclusive-linewise*
8687 2. If the motion is exclusive, the end of the motion is in column 1 and the
8788 start of the motion was at or before the first non-blank in the line, the
8889 motion becomes linewise. Example: If a paragraph begins with some blanks
@@ -424,20 +425,24 @@
424425
425426 *]]*
426427 ]] [count] sections forward or to the next '{' in the
427- first column. When used after an operator, then the
428- '}' in the first column. |linewise|
428+ first column. When used after an operator, then also
429+ stops below a '}' in the first column. |exclusive|
430+ Note that |exclusive-linewise| often applies.
429431
430432 *][*
431433 ][ [count] sections forward or to the next '}' in the
432- first column. |linewise|
434+ first column. |exclusive|
435+ Note that |exclusive-linewise| often applies.
433436
434437 *[[*
435438 [[ [count] sections backward or to the previous '{' in
436- the first column. |linewise|
439+ the first column. |exclusive|
440+ Note that |exclusive-linewise| often applies.
437441
438442 *[]*
439443 [] [count] sections backward or to the previous '}' in
440- the first column. |linewise|
444+ the first column. |exclusive|
445+ Note that |exclusive-linewise| often applies.
441446
442447 These commands move over three kinds of text objects.
443448
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/doc/options.txt
--- a/runtime/doc/options.txt Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/doc/options.txt Mon Jul 26 12:53:41 2004 +0000
@@ -1,4 +1,4 @@
1-*options.txt* For Vim version 7.0aa. Last change: 2004 Jul 15
1+*options.txt* For Vim version 7.0aa. Last change: 2004 Jul 24
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3924,7 +3924,7 @@
39243924 NOTE: To avoid portability problems with using patterns, always keep
39253925 this option at the default "on". Only switch it off when working with
39263926 old Vi scripts. In any other situation write patterns that work when
3927- 'magic' is on.
3927+ 'magic' is on. Include "\M" when you want to |/\M|.
39283928
39293929 *'makeef'* *'mef'*
39303930 'makeef' 'mef' string (default: "")
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/doc/pattern.txt
--- a/runtime/doc/pattern.txt Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/doc/pattern.txt Mon Jul 26 12:53:41 2004 +0000
@@ -1,4 +1,4 @@
1-*pattern.txt* For Vim version 7.0aa. Last change: 2004 May 09
1+*pattern.txt* For Vim version 7.0aa. Last change: 2004 Jul 24
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -382,7 +382,7 @@
382382 |/\%c| \%23c \%23c in column 23 |/zero-width|
383383 |/\%v| \%23v \%23v in virtual column 23 |/zero-width|
384384
385-Character classes {not in Vi}:
385+Character classes {not in Vi}: */character-classes*
386386 |/\i| \i \i identifier character (see 'isident' option)
387387 |/\I| \I \I like "\i", but excluding digits
388388 |/\k| \k \k keyword character (see 'iskeyword' option)
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/doc/tags
--- a/runtime/doc/tags Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/doc/tags Mon Jul 26 12:53:41 2004 +0000
@@ -1337,6 +1337,7 @@
13371337 /atom pattern.txt /*\/atom*
13381338 /bar pattern.txt /*\/bar*
13391339 /branch pattern.txt /*\/branch*
1340+/character-classes pattern.txt /*\/character-classes*
13401341 /collection pattern.txt /*\/collection*
13411342 /concat pattern.txt /*\/concat*
13421343 /dyn various.txt /*\/dyn*
@@ -3570,6 +3571,7 @@
35703571 Eterm syntax.txt /*Eterm*
35713572 Ex intro.txt /*Ex*
35723573 Ex-mode intro.txt /*Ex-mode*
3574+Exuberant_ctags tagsrch.txt /*Exuberant_ctags*
35733575 F motion.txt /*F*
35743576 FAQ intro.txt /*FAQ*
35753577 Farsi farsi.txt /*Farsi*
@@ -4518,6 +4520,7 @@
45184520 exception-handling eval.txt /*exception-handling*
45194521 exception-variable eval.txt /*exception-variable*
45204522 exclusive motion.txt /*exclusive*
4523+exclusive-linewise motion.txt /*exclusive-linewise*
45214524 executable() eval.txt /*executable()*
45224525 execute-menus gui.txt /*execute-menus*
45234526 exim starting.txt /*exim*
@@ -4625,6 +4628,7 @@
46254628 filter change.txt /*filter*
46264629 find-manpage usr_12.txt /*find-manpage*
46274630 find-replace usr_10.txt /*find-replace*
4631+finddir() eval.txt /*finddir()*
46284632 findfile() eval.txt /*findfile()*
46294633 fixed-5.1 version5.txt /*fixed-5.1*
46304634 fixed-5.2 version5.txt /*fixed-5.2*
@@ -4773,8 +4777,10 @@
47734777 getcmdline() eval.txt /*getcmdline()*
47744778 getcmdpos() eval.txt /*getcmdpos()*
47754779 getcwd() eval.txt /*getcwd()*
4780+getfperm() eval.txt /*getfperm()*
47764781 getfsize() eval.txt /*getfsize()*
47774782 getftime() eval.txt /*getftime()*
4783+getftype() eval.txt /*getftype()*
47784784 getline() eval.txt /*getline()*
47794785 getreg() eval.txt /*getreg()*
47804786 getregtype() eval.txt /*getregtype()*
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/doc/tagsrch.txt
--- a/runtime/doc/tagsrch.txt Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/doc/tagsrch.txt Mon Jul 26 12:53:41 2004 +0000
@@ -1,4 +1,4 @@
1-*tagsrch.txt* For Vim version 7.0aa. Last change: 2004 Apr 29
1+*tagsrch.txt* For Vim version 7.0aa. Last change: 2004 Jul 23
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -468,6 +468,7 @@
468468 Some programs that generate tags files:
469469 ctags As found on most Unix systems. Only supports C. Only
470470 does the basic work.
471+ *Exuberant_ctags*
471472 exuberant ctags This a very good one. It works for C, C++, Java,
472473 Fortran, Eiffel and others. It can generate tags for
473474 many items. See http://ctags.sourceforge.net.
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/doc/todo.txt
--- a/runtime/doc/todo.txt Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/doc/todo.txt Mon Jul 26 12:53:41 2004 +0000
@@ -1,4 +1,4 @@
1-*todo.txt* For Vim version 7.0aa. Last change: 2004 Jul 19
1+*todo.txt* For Vim version 7.0aa. Last change: 2004 Jul 26
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -30,27 +30,18 @@
3030 *known-bugs*
3131 -------------------- Known bugs and current work -----------------------
3232
33-Add fix for zh_cn to Vim 6.3? (Liang)
33+Aborting at the ATTENTION prompt causes trouble:
34+ buffer remains active, nwindows isn't closed (fixed in buffer.c)
35+ alternate buffer gets "read error" flag.
36+ ":sbuf" and ":ball" leave an empty window behind.
37+Change in handle_swap_exists() also in 6.3?
3438
3539
3640 For version 7.0:
3741 - Include many PATCHES:
3842 8 Add functions:
39- realname() Get user name (first, last, full)
40- user_fullname() patch by Nikolai Weibull, Nov
41- 3 2002)
42- getfperm() file permissions, in form "rwxrwxrwx"
43- (patch from Nikolai Weibull 2003 Jan 13)
44- getftype() "file", "dir", "link", "other"?
45- (patch from Nikolai Weibull 2003 Jan 13)
4643 setbufline() set line in any buffer (patch from Yegappan
4744 Lakshmanan, 2003 Jan 21)
48- winnr("$") Get number of windows. (patch from Nikolai
49- Weibull 2003 Jan 13) (another patch from
50- Yegappan Lakshmanan, 2004 Jul 11)
51- search() Add optional offset argument.
52- Add 'n' flag. (patch from Nikolai Weibull
53- 2003 Jan 13)
5445 filter() Patch from Yegappan Lakshmanan, 2004 Jul 11
5546 8 Make it possible to delete marks. Charles Campbell has a patch that
5647 does this with the markclear() function (2004 Jan 9).
@@ -63,6 +54,7 @@
6354 When "filename" has no wildcards and there is no matching buffer, add
6455 the buffer (unlisted).
6556 Patch for \xnn (Ciaran McCreesh) 2004 Jul 10
57+ http://dev.gentoo.org/~ciaranm/patches/vim/vim-7.00a-regexp-numbered-characters-r5.patch
6658 7 Add 'taglistfiles' option, show file name and type when listing matching
6759 tags name with CTRL-D completion. Patch from Yegappan Lakshmanan.
6860 2004 Jul 11
@@ -72,6 +64,15 @@
7264 8 Make 'statusline' local, so that each window can have a different
7365 value. But should it also be local to a buffer? (Yegappan Lakshmanan
7466 has a patch, 2004 Jul 11)
67+ 8 Add buffer-local autocommands? Reduces overhead for autocommands that
68+ trigger often (inserting a character, switching mode).
69+ :au Event <buffer> do-something
70+ E.g.:
71+ :au BufEnter <buffer> menu enable ...
72+ :au BufLeave <buffer> menu disable ...
73+ Patch from Yakov Lerner, including test (2004 Jan 7).
74+ VimResized - When the Vim window has been resized (SIGWINCH)
75+ patch from Yakov Lerner, 2003 July 24.
7576 --- awaiting updated patch ---
7677 7 Add patch from Wall for this one ( ~/Mail/oldmail/wall/in.00019 ):
7778 'flipcase' variable: upper/lowercase pairs.
@@ -84,18 +85,7 @@
8485 8 Add ":n" to fnamemodify(): normalize path, remove "../" when possible.
8586 Aric Blumer has a patch for this.
8687 He will update the patch for 6.3.
87- 8 Add buffer-local autocommands? Reduces overhead for autocommands that
88- trigger often (inserting a character, switching mode).
89- :au Event <buffer> do-something
90- E.g.:
91- :au BufEnter <buffer> menu enable ...
92- :au BufLeave <buffer> menu disable ...
93- Patch from Yakov Lerner, including test (2004 Jan 7).
94- He'll send updated patch.
9588 Autocommands:
96- VimResized - When the Vim window has been resized (SIGWINCH)
97- patch from Yakov Lerner, 2003 July 24.
98- He'll write documentation and send updated patch.
9989 7 Completion of network shares, patch by Yasuhiro Matsumoto.
10090 Update 2004 Jun 17.
10191 How does this work? Missing comments.
@@ -1458,6 +1448,14 @@
14581448 7 Add argument to winwidth() to subtract the space taken by 'foldcolumn',
14591449 signs and/or 'number'.
14601450 8 Add functions:
1451+ search() Add optional offset argument.
1452+ realname() Get user name (first, last, full)
1453+ user_fullname() patch by Nikolai Weibull, Nov
1454+ 3 2002
1455+ Only add this when also implemented for
1456+ non-Unix systems, otherwise a shell cmd could
1457+ be used.
1458+ get_user_name() gets login name.
14611459 menuprop({name}, {idx}, {what})
14621460 Get menu property of menu {name} item {idx}.
14631461 menuprop("", 1, "name") returns "File".
@@ -3196,6 +3194,7 @@
31963194 column number. Can use the code of ":helpgrep".
31973195 Also support using "**" in filename, so that a directory tree can be
31983196 searched.
3197+ Also see the "minigrep.vim" script on www.vim.org.
31993198 - Change ":fixdel" into option 'fixdel', t_del will be adjusted each time
32003199 t_bs is set? (Webb)
32013200 - "gc": goto character, move absolute character positions forward, also
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/doc/version7.txt
--- a/runtime/doc/version7.txt Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/doc/version7.txt Mon Jul 26 12:53:41 2004 +0000
@@ -1,4 +1,4 @@
1-*version7.txt* For Vim version 7.0aa. Last change: 2004 Jul 19
1+*version7.txt* For Vim version 7.0aa. Last change: 2004 Jul 25
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -127,6 +127,9 @@
127127 finddir(name) |finddir()| Find a directory in 'path'.
128128 findfile(name) |findfile()| Find a file in 'path'. (Johannes
129129 Zellner)
130+getfperm(fname) |getfperm()| Get file permission string. (Nikolai
131+ Weibull)
132+getftype(fname) |getftype()| Get type of file. (Nikolai Weibull)
130133 repeat(expr, count) |repeat()| Repeat "expr" "count" times.
131134 (Christophe Poucet)
132135 tr(expr, from, to) |tr()| Translate characters. (Ron Aaron)
@@ -187,6 +190,11 @@
187190
188191 Added the "count" argument to match(), matchend() and matchstr(). (Ilya Sher)
189192
193+winnr() takes an optional "$" and "#" arguments. (Nikolai Weibull, Yegappan
194+Lakshmanan)
195+
196+Added 'n' flag to search(): don't move the cursor. (Nikolai Weibull)
197+
190198 ==============================================================================
191199 COMPILE TIME CHANGES *compile-changes-7*
192200
@@ -272,4 +280,13 @@
272280 The default for 'helplang' was "zh" for both "zh_cn" and "zh_tw". Now use
273281 "cn" or "tw" as intended.
274282
283+When 'bin' is set and 'eol' is not set then line2byte() added the line break
284+after the last line while it's not there.
285+
286+Using foldlevel() in a WinEnter autocommand may not work. Noticed when
287+resizing the GUI shell upon startup.
288+
289+Python: Using buffer.append(f.readlines()) didn't work. Allow appending a
290+string with a trailing newline. The newline is ignored.
291+
275292 vim:tw=78:ts=8:ft=help:norl:
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/ftplugin/lprolog.vim
--- a/runtime/ftplugin/lprolog.vim Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/ftplugin/lprolog.vim Mon Jul 26 12:53:41 2004 +0000
@@ -1,10 +1,10 @@
11 " Vim settings file
22 " Language: LambdaProlog (Teyjus)
33 " Maintainer: Markus Mottl <markus@oefai.at>
4-" URL: http://www.ai.univie.ac.at/~markus/vim/ftplugin/lprolog.vim
5-" Last Change: 2003 May 11
6-" 2001 Sep 16 - fixed 'no_mail_maps'-bug (MM)
7-" 2001 Sep 02 - initial release (MM)
4+" URL: http://www.oefai.at/~markus/vim/ftplugin/lprolog.vim
5+" Last Change: 2001 Oct 02 - fixed uncommenting bug (MM)
6+" 2001 Sep 16 - fixed 'no_mail_maps'-bug (MM)
7+" 2001 Sep 02 - initial release (MM)
88
99 " Only do these settings when not done yet for this buffer
1010 if exists("b:did_ftplugin")
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/ftplugin/ocaml.vim
--- a/runtime/ftplugin/ocaml.vim Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/ftplugin/ocaml.vim Mon Jul 26 12:53:41 2004 +0000
@@ -1,12 +1,14 @@
11 " Vim settings file
22 " Language: OCaml
3-" Maintainers: Mike Leary <leary@nwlink.com>
4-" Markus Mottl <markus@oefai.at>
5-" URL: http://www.ai.univie.ac.at/~markus/vim/ftplugin/ocaml.vim
6-" Last Change: 2003 May 11
7-" 2001 Nov 01 - added local bindings for inserting
8-" type holes using 'assert false' (MM)
9-" 2001 Oct 02 - insert spaces in line comments (MM)
3+" Maintainers: Mike Leary <leary@nwlink.com>
4+" Markus Mottl <markus@oefai.at>
5+" Stefano Zacchiroli <zack@bononia.it>
6+" URL: http://www.oefai.at/~markus/vim/ftplugin/ocaml.vim
7+" Last Change: 2004 Apr 12 - better .ml/.mli-switching without Python (SZ)
8+" 2003 Nov 21 - match_words-patterns and .ml/.mli-switching (MM)
9+" 2003 Oct 16 - re-entered variable 'did_ocaml_dtypes' (MM)
10+" 2003 Oct 15 - added Stefano Zacchirolis (SZ) Python-code for
11+" displaying type annotations (MM)
1012
1113 " Only do these settings when not done yet for this buffer
1214 if exists("b:did_ftplugin")
@@ -47,3 +49,253 @@
4749 iabbrev <buffer> ASS (assert false)
4850 endif
4951 endif
52+
53+" Let % jump between structure elements (due to Issac Trotts)
54+let b:mw='\<let\>:\<and\>:\(\<in\>\|;;\),'
55+let b:mw=b:mw . '\<if\>:\<then\>:\<else\>,\<do\>:\<done\>,'
56+let b:mw=b:mw . '\<\(object\|sig\|struct\|begin\)\>:\<end\>'
57+let b:match_words=b:mw
58+
59+" switching between interfaces (.mli) and implementations (.ml)
60+if !exists("g:did_ocaml_switch")
61+ let g:did_ocaml_switch = 1
62+ map ,s :call OCaml_switch(0)<CR>
63+ map ,S :call OCaml_switch(1)<CR>
64+ fun OCaml_switch(newwin)
65+ if (match(bufname(""), "\\.mli$") >= 0)
66+ let fname = substitute(bufname(""), "\\.mli$", ".ml", "")
67+ if (a:newwin == 1)
68+ exec "new " . fname
69+ else
70+ exec "arge " . fname
71+ endif
72+ elseif (match(bufname(""), "\\.ml$") >= 0)
73+ let fname = bufname("") . "i"
74+ if (a:newwin == 1)
75+ exec "new " . fname
76+ else
77+ exec "arge " . fname
78+ endif
79+ endif
80+ endfun
81+endif
82+
83+" Vim support for OCaml 3.07 .annot files (requires Vim with python support)
84+"
85+" Executing OCamlPrintType(<mode>) function will display in the Vim bottom
86+" line(s) the type of an ocaml value getting it from the corresponding .annot
87+" file (if any). If Vim is in visual mode, <mode> should be "visual" and the
88+" selected ocaml value correspond to the highlighted text, otherwise (<mode>
89+" can be anything else) it corresponds to the literal found at the current
90+" cursor position.
91+"
92+" .annot files are parsed lazily the first time OCamlPrintType is invoked; is
93+" also possible to force the parsing using the OCamlParseAnnot() function.
94+"
95+" Hitting the <F3> key will cause OCamlPrintType function to be invoked with
96+" the right argument depending on the current mode (visual or not).
97+"
98+" Copyright (C) <2003> Stefano Zacchiroli <zack@bononia.it>
99+"
100+" Created: Wed, 01 Oct 2003 18:16:22 +0200 zack
101+" LastModified: Mon, 06 Oct 2003 11:05:39 +0200 zack
102+"
103+" This program is free software; you can redistribute it and/or modify
104+" it under the terms of the GNU General Public License as published by
105+" the Free Software Foundation; either version 2 of the License, or
106+" (at your option) any later version.
107+"
108+" This program is distributed in the hope that it will be useful,
109+" but WITHOUT ANY WARRANTY; without even the implied warranty of
110+" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
111+" GNU General Public License for more details.
112+"
113+" You should have received a copy of the GNU General Public License
114+" along with this program; if not, write to the Free Software
115+" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
116+"
117+
118+if !has("python")
119+ echo "Python support not found: OCaml .annot support disabled"
120+ finish
121+endif
122+
123+if !exists("g:did_ocaml_dtypes")
124+ let g:did_ocaml_dtypes = 1
125+else
126+ finish
127+endif
128+
129+python << EOF
130+
131+import re
132+import os
133+import string
134+import time
135+import vim
136+
137+debug = False
138+
139+class AnnExc(Exception):
140+ def __init__(self, reason):
141+ self.reason = reason
142+
143+no_annotations = AnnExc("No type annotations (.annot) file found")
144+annotation_not_found = AnnExc("No type annotation found for the given text")
145+def malformed_annotations(lineno):
146+ return AnnExc("Malformed .annot file (line = %d)" % lineno)
147+
148+class Annotations:
149+ """
150+ .annot ocaml file representation
151+
152+ File format (copied verbatim from caml-types.el)
153+
154+ file ::= block *
155+ block ::= position <SP> position <LF> annotation *
156+ position ::= filename <SP> num <SP> num <SP> num
157+ annotation ::= keyword open-paren <LF> <SP> <SP> data <LF> close-paren
158+
159+ <SP> is a space character (ASCII 0x20)
160+ <LF> is a line-feed character (ASCII 0x0A)
161+ num is a sequence of decimal digits
162+ filename is a string with the lexical conventions of O'Caml
163+ open-paren is an open parenthesis (ASCII 0x28)
164+ close-paren is a closed parenthesis (ASCII 0x29)
165+ data is any sequence of characters where <LF> is always followed by
166+ at least two space characters.
167+
168+ - in each block, the two positions are respectively the start and the
169+ - end of the range described by the block.
170+ - in a position, the filename is the name of the file, the first num
171+ is the line number, the second num is the offset of the beginning
172+ of the line, the third num is the offset of the position itself.
173+ - the char number within the line is the difference between the third
174+ and second nums.
175+
176+ For the moment, the only possible keyword is \"type\"."
177+ """
178+
179+ def __init__(self):
180+ self.__filename = None # last .annot parsed file
181+ self.__ml_filename = None # as above but s/.annot/.ml/
182+ self.__timestamp = None # last parse action timestamp
183+ self.__annot = {}
184+ self.__re = re.compile(
185+ '^"[^"]+"\s+(\d+)\s+(\d+)\s+(\d+)\s+"[^"]+"\s+(\d+)\s+(\d+)\s+(\d+)$')
186+
187+ def __parse(self, fname):
188+ try:
189+ f = open(fname)
190+ line = f.readline() # position line
191+ lineno = 1
192+ while (line != ""):
193+ m = self.__re.search(line)
194+ if (not m):
195+ raise malformed_annotations(lineno)
196+ line1 = int(m.group(1))
197+ col1 = int(m.group(3)) - int(m.group(2))
198+ line2 = int(m.group(4))
199+ col2 = int(m.group(6)) - int(m.group(5))
200+ line = f.readline() # "type(" string
201+ lineno += 1
202+ if (line == ""): raise malformed_annotations(lineno)
203+ type = []
204+ line = f.readline() # type description
205+ lineno += 1
206+ if (line == ""): raise malformed_annotations(lineno)
207+ while line != ")\n":
208+ type.append(string.strip(line))
209+ line = f.readline()
210+ lineno += 1
211+ if (line == ""): raise malformed_annotations(lineno)
212+ type = string.join(type, "\n")
213+ self.__annot[(line1, col1), (line2, col2)] = type
214+ line = f.readline() # position line
215+ f.close()
216+ self.__filename = fname
217+ self.__ml_filename = re.sub("\.annot$", ".ml", fname)
218+ self.__timestamp = int(time.time())
219+ except IOError:
220+ raise no_annotations
221+
222+ def parse(self):
223+ annot_file = re.sub("\.ml$", ".annot", vim.current.buffer.name)
224+ self.__parse(annot_file)
225+
226+ def get_type(self, (line1, col1), (line2, col2)):
227+ if debug:
228+ print line1, col1, line2, col2
229+ if vim.current.buffer.name == None:
230+ raise no_annotations
231+ if vim.current.buffer.name != self.__ml_filename or \
232+ os.stat(self.__filename).st_mtime > self.__timestamp:
233+ self.parse()
234+ try:
235+ return self.__annot[(line1, col1), (line2, col2)]
236+ except KeyError:
237+ raise annotation_not_found
238+
239+word_char_RE = re.compile("^[\w.]$")
240+
241+ # TODO this function should recognize ocaml literals, actually it's just an
242+ # hack that recognize continuous sequences of word_char_RE above
243+def findBoundaries(line, col):
244+ """ given a cursor position (as returned by vim.current.window.cursor)
245+ return two integers identify the beggining and end column of the word at
246+ cursor position, if any. If no word is at the cursor position return the
247+ column cursor position twice """
248+ left, right = col, col
249+ line = line - 1 # mismatch vim/python line indexes
250+ (begin_col, end_col) = (0, len(vim.current.buffer[line]) - 1)
251+ try:
252+ while word_char_RE.search(vim.current.buffer[line][left - 1]):
253+ left = left - 1
254+ except IndexError:
255+ pass
256+ try:
257+ while word_char_RE.search(vim.current.buffer[line][right + 1]):
258+ right = right + 1
259+ except IndexError:
260+ pass
261+ return (left, right)
262+
263+annot = Annotations() # global annotation object
264+
265+def printOCamlType(mode):
266+ try:
267+ if mode == "visual": # visual mode: lookup highlighted text
268+ (line1, col1) = vim.current.buffer.mark("<")
269+ (line2, col2) = vim.current.buffer.mark(">")
270+ else: # any other mode: lookup word at cursor position
271+ (line, col) = vim.current.window.cursor
272+ (col1, col2) = findBoundaries(line, col)
273+ (line1, line2) = (line, line)
274+ begin_mark = (line1, col1)
275+ end_mark = (line2, col2 + 1)
276+ print annot.get_type(begin_mark, end_mark)
277+ except AnnExc, exc:
278+ print exc.reason
279+
280+def parseOCamlAnnot():
281+ try:
282+ annot.parse()
283+ except AnnExc, exc:
284+ print exc.reason
285+
286+EOF
287+
288+fun OCamlPrintType(current_mode)
289+ if (a:current_mode == "visual")
290+ python printOCamlType("visual")
291+ else
292+ python printOCamlType("normal")
293+ endif
294+endfun
295+
296+fun OCamlParseAnnot()
297+ python parseOCamlAnnot()
298+endfun
299+
300+map <F3> :call OCamlPrintType("normal")<RETURN>
301+vmap <F3> :call OCamlPrintType("visual")<RETURN>
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/indent/ocaml.vim
--- a/runtime/indent/ocaml.vim Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/indent/ocaml.vim Mon Jul 26 12:53:41 2004 +0000
@@ -1,12 +1,12 @@
11 " Vim indent file
2-" Language: OCaml
3-" Maintainers: Jean-Francois Yuen <jfyuen@ifrance.com>
4-" Mike Leary <leary@nwlink.com>
5-" Markus Mottl <markus@oefai.at>
6-" URL: http://www.oefai.at/~markus/vim/indent/ocaml.vim
7-" Last Change: 2003 Apr 14
8-" 2003 Mar 05 - Added '{<' and some fixes (JY)
9-" 2002 Nov 06 - Some fixes (JY)
2+" Language: OCaml
3+" Maintainers: Jean-Francois Yuen <jfyuen@happycoders.org>
4+" Mike Leary <leary@nwlink.com>
5+" Markus Mottl <markus@oefai.at>
6+" URL: http://www.oefai.at/~markus/vim/indent/ocaml.vim
7+" Last Change: 2004 Apr 11 - Added indent for 'class' (JY)
8+" 2003 Sep 16 - Added 'private' as keyword (JY)
9+" 2003 Mar 29 - Fixed bug with 'if' and 'else' (JY)
1010
1111 " Only load this indent file when no other was loaded.
1212 if exists("b:did_indent")
@@ -16,7 +16,7 @@
1616
1717 setlocal expandtab
1818 setlocal indentexpr=GetOCamlIndent()
19-setlocal indentkeys+=0=and,0=constraint,0=done,0=else,0=end,0=exception,0=external,0=if,0=in,0=include,0=inherit,0=initializer,0=let,0=method,0=open,0=then,0=type,0=val,0=with,0=;;,0=>\],0=\|\],0=\|,0=*),0=>},0},0\],0)
19+setlocal indentkeys+=0=and,0=class,0=constraint,0=done,0=else,0=end,0=exception,0=external,0=if,0=in,0=include,0=inherit,0=initializer,0=let,0=method,0=open,0=then,0=type,0=val,0=with,0;;,0>\],0\|\],0>},0\|,0},0\],0)
2020 setlocal nolisp
2121 setlocal nosmartindent
2222 setlocal textwidth=80
@@ -33,14 +33,13 @@
3333 endif
3434
3535 " Define some patterns:
36-let s:beflet = '^\s*\(initializer\|method\|try\)\|\(\<\(begin\|do\|else\|in\|then\|try\)\|->\|;\|(\)\s*$'
36+let s:beflet = '^\s*\(initializer\|method\|try\)\|\(\<\(begin\|do\|else\|in\|then\|try\)\|->\|<-\|=\|;\|(\)\s*$'
3737 let s:letpat = '^\s*\(let\|type\|module\|class\|open\|exception\|val\|include\|external\)\>'
3838 let s:letlim = '\(\<\(sig\|struct\)\|;;\)\s*$'
3939 let s:lim = '^\s*\(exception\|external\|include\|let\|module\|open\|type\|val\)\>'
4040 let s:module = '\<\%(begin\|sig\|struct\|object\)\>'
4141 let s:obj = '^\s*\(constraint\|inherit\|initializer\|method\|val\)\>\|\<\(object\|object\s*(.*)\)\s*$'
42-let s:type = '^\s*\%(let\|type\)\>.*='
43-let s:val = '^\s*\(val\|external\)\>.*:'
42+let s:type = '^\s*\%(class\|let\|type\)\>.*='
4443
4544 " Skipping pattern, for comments
4645 function s:SkipPattern(lnum, pat)
@@ -75,7 +74,7 @@
7574 " Indent 'let'
7675 function s:FindLet(pstart, pmid, pend)
7776 call search(a:pend, 'bW')
78- return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") =~ "^\\s*let\\>.*=.*\\<in\\s*$" || getline(prevnonblank(".") - 1) =~ "^\\s*let\\>.*=\\s*$\\|" . s:beflet'))
77+ return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") =~ "^\\s*let\\>.*=.*\\<in\\s*$" || getline(prevnonblank(".") - 1) =~ s:beflet'))
7978 endfunction
8079
8180 function GetOCamlIndent()
@@ -97,8 +96,7 @@
9796
9897 let line = getline(v:lnum)
9998
100- " Indent if current line begins with 'end'
101- " for 'sig', 'struct', 'object' and 'begin':
99+ " Indent if current line begins with 'end':
102100 if line =~ '^\s*end\>'
103101 return s:FindPair(s:module, '','\<end\>')
104102
@@ -118,27 +116,25 @@
118116 elseif line =~ '^\s*)'
119117 return s:FindPair('(', '',')')
120118
121- " Indent if current line begins with 'let'
122- " and last line does not begin with 'let' or end with 'in' or ';;':
119+ " Indent if current line begins with 'let':
123120 elseif line =~ '^\s*let\>'
124121 if lline !~ s:lim . '\|' . s:letlim . '\|' . s:beflet
125122 return s:FindLet(s:type, '','\<let\s*$')
126123 else return ind
127124 endif
128125
129- " Indent if current line begins with 'type'
130- " and last line does not end with 'and' or ';;':
131- elseif line =~ '^\s*type\>'
126+ " Indent if current line begins with 'class' or 'type':
127+ elseif line =~ '^\s*\(class\|type\)\>'
132128 if lline !~ s:lim . '\|\<and\s*$\|' . s:letlim
133- return s:FindLet(s:type, '','\<type\s*$')
129+ return s:FindLet(s:type, '','\<\(class\|type\)\s*$')
134130 else return ind
135131 endif
136132
137133 " Indent for pattern matching:
138134 elseif line =~ '^\s*|'
139- if lline !~ '^\s*\(|\|\(match\|with\|type\)\>\)\|\<\(function\|parser\|with\)\s*$'
135+ if lline !~ '^\s*\(|[^\]]\|\(match\|type\|with\)\>\)\|\<\(function\|parser\|private\|with\)\s*$'
140136 call search('|', 'bW')
141- return indent(searchpair('^\s*\(type\|match\)\>\|\<\(with\|function\|parser\)\s*$', '', '|', 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") =~ "\\[|\\||\\]" && getline(".") !~ "^\\s*|.*->"'))
137+ return indent(searchpair('^\s*\(match\|type\)\>\|\<\(function\|parser\|private\|with\)\s*$', '', '^\s*|', 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") !~ "^\\s*|.*->"'))
142138 else return ind
143139 endif
144140
@@ -149,41 +145,35 @@
149145 else return ind
150146 endif
151147
152- " Indent if current line begins with 'in' and previous
153- " line does not start with 'let' or 'and':
148+ " Indent if current line begins with 'in':
154149 elseif line =~ '^\s*in\>'
155150 if lline !~ '^\s*\(let\|and\)\>'
156151 return s:FindPair('\<let\>', '', '\<in\>')
157152 else return ind
158153 endif
159154
160- " Indent if current line begins with 'else'
161- " and previous line does not start with 'if', 'then' or 'else':
155+ " Indent if current line begins with 'else':
162156 elseif line =~ '^\s*else\>'
163- if lline !~ '^\s*\(if\|else\|then\)\>'
157+ if lline !~ '^\s*\(if\|then\)\>'
164158 return s:FindPair('\<if\>', '', '\<else\>')
165159 else return ind
166160 endif
167161
168- " Indent if current line begins with 'then'
169- " and previous line does not start with 'if', 'then' or 'else':
162+ " Indent if current line begins with 'then':
170163 elseif line =~ '^\s*then\>'
171- if lline !~ '^\s*\(if\|else\|then\)\>'
164+ if lline !~ '^\s*\(if\|else\)\>'
172165 return s:FindPair('\<if\>', '', '\<then\>')
173166 else return ind
174167 endif
175168
176- " Subtract a 'shiftwidth' if current line begins with 'and' and previous
177- " line does not start with 'let', 'and' or 'type' or end with 'end'
178- " (for classes):
169+ " Indent if current line begins with 'and':
179170 elseif line =~ '^\s*and\>'
180171 if lline !~ '^\s*\(and\|let\|type\)\>\|\<end\s*$'
181172 return ind - &sw
182173 else return ind
183174 endif
184175
185- " Indent if current line begins with 'with'
186- " and previous line does not start with 'match' or 'try':
176+ " Indent if current line begins with 'with':
187177 elseif line =~ '^\s*with\>'
188178 if lline !~ '^\s*\(match\|try\)\>'
189179 return s:FindPair('\<\%(match\|try\)\>', '','\<with\>')
@@ -193,35 +183,35 @@
193183 " Indent if current line begins with 'exception':
194184 elseif line =~ '^\s*exception\>'
195185 if lline !~ s:lim . '\|' . s:letlim
196- return indent(search(s:val . '\|^\s*\(external\|include\|open\|type\)\>', 'bW'))
186+ return indent(search('^\s*\(\(external\|include\|open\|type\)\>\|val\>.*:\)', 'bW'))
197187 else return ind
198188 endif
199189
200190 " Indent if current line begins with 'external':
201191 elseif line =~ '^\s*external\>'
202192 if lline !~ s:lim . '\|' . s:letlim
203- return indent(search(s:val . '\|^\s*\(exception\|include\|open\|type\)\>', 'bW'))
193+ return indent(search('^\s*\(\(exception\|external\|include\|open\|type\)\>\|val\>.*:\)', 'bW'))
204194 else return ind
205195 endif
206196
207197 " Indent if current line begins with 'include':
208198 elseif line =~ '^\s*include\>'
209199 if lline !~ s:lim . '\|' . s:letlim
210- return indent(search(s:val . '\|^\s*\(exception\|external\|open\|type\)\>', 'bW'))
200+ return indent(search('^\s*\(\(exception\|external\|open\|type\)\>\|val\>.*:\)', 'bW'))
211201 else return ind
212202 endif
213203
214204 " Indent if current line begins with 'open':
215205 elseif line =~ '^\s*open\>'
216206 if lline !~ s:lim . '\|' . s:letlim
217- return indent(search(s:val . '\|^\s*\(exception\|external\|include\|type\)\>', 'bW'))
207+ return indent(search('^\s*\(\(exception\|external\|include\|type\)\>\|val\>.*:\)', 'bW'))
218208 else return ind
219209 endif
220210
221211 " Indent if current line begins with 'val':
222212 elseif line =~ '^\s*val\>'
223213 if lline !~ '^\s*\(exception\|external\|include\|open\)\>\|' . s:obj . '\|' . s:letlim
224- return indent(search(s:val . '\|^\s*\(exception\|include\|initializer\|method\|open\|type\)\>', 'bW'))
214+ return indent(search('^\s*\(\(exception\|include\|initializer\|method\|open\|type\|val\)\>\|external\>.*:\)', 'bW'))
225215 else return ind
226216 endif
227217
@@ -253,15 +243,10 @@
253243 else return ind
254244 endif
255245
256- " Indent back to normal after comments:
257- elseif line =~ '^\s*\*)'
258- call search('\*)', 'bW')
259- return indent(searchpair('(\*', '', '\*)', 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string"'))
260-
261246 endif
262247
263248 " Add a 'shiftwidth' after lines ending with:
264- if lline =~ '\(:\|=\|->\|<-\|(\|\[\|{\|{<\|\[|\|\[<\|\<\(begin\|struct\|sig\|functor\|initializer\|object\|try\|do\|if\|then\|else\|fun\|function\|parser\)\|\<object\s*(.*)\)\s*$'
249+ if lline =~ '\(:\|=\|->\|<-\|(\|\[\|{\|{<\|\[|\|\[<\|\<\(begin\|do\|else\|fun\|function\|functor\|if\|initializer\|object\|parser\|private\|sig\|struct\|then\|try\)\|\<object\s*(.*)\)\s*$'
265250 let ind = ind + &sw
266251
267252 " Back to normal indent after lines ending with ';;':
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/indent/python.vim
--- a/runtime/indent/python.vim Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/indent/python.vim Mon Jul 26 12:53:41 2004 +0000
@@ -2,7 +2,7 @@
22 " Language: Python
33 " Maintainer: Bram Moolenaar <Bram@vim.org>
44 " Original Author: David Bustos <bustos@caltech.edu>
5-" Last Change: 2004 Jun 15
5+" Last Change: 2004 Jul 25
66
77 " Only load this indent file when no other was loaded.
88 if exists("b:did_indent")
@@ -99,15 +99,36 @@
9999 " Use syntax highlighting attributes when possible.
100100 let pline = getline(plnum)
101101 let pline_len = strlen(pline)
102- let col = 0
103- while col < pline_len
104- if pline[col] == '#' && (!has('syntax_items')
105- \ || synIDattr(synID(plnum, col + 1, 1), "name") =~ "Comment$")
106- let pline = strpart(pline, 0, col)
107- break
102+ if has('syntax_items')
103+ " If the last character in the line is a comment, do a binary search for
104+ " the start of the comment. synID() is slow, a linear search would take
105+ " too long on a long line.
106+ if synIDattr(synID(plnum, pline_len, 1), "name") =~ "Comment$"
107+ let min = 1
108+ let max = pline_len
109+ while min < max
110+ let col = (min + max) / 2
111+ if synIDattr(synID(plnum, col, 1), "name") =~ "Comment$"
112+ let max = col
113+ else
114+ let min = col + 1
115+ endif
116+ endwhile
117+ echomsg min
118+ let pline = strpart(pline, 0, min - 1)
119+ echomsg pline
120+ sleep 1
108121 endif
109- let col = col + 1
110- endwhile
122+ else
123+ let col = 0
124+ while col < pline_len
125+ if pline[col] == '#'
126+ let pline = strpart(pline, 0, col)
127+ break
128+ endif
129+ let col = col + 1
130+ endwhile
131+ endif
111132
112133 " If the previous line ended with a colon, indent this line
113134 if pline =~ ':\s*$'
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/syntax/dot.vim
--- a/runtime/syntax/dot.vim Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/syntax/dot.vim Mon Jul 26 12:53:41 2004 +0000
@@ -2,9 +2,9 @@
22 " Language: Dot
33 " Filenames: *.dot
44 " Maintainer: Markus Mottl <markus@oefai.at>
5-" URL: http://www.ai.univie.ac.at/~markus/vim/syntax/dot.vim
6-" Last Change: 2003 May 11
7-" 2001 May 04 - initial version
5+" URL: http://www.oefai.at/~markus/vim/syntax/dot.vim
6+" Last Change: 2004 Jul 26
7+" 2001 May 04 - initial version
88
99 " For version 5.x: Clear all syntax items
1010 " For version 6.x: Quit when a syntax file was already loaded
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/syntax/idl.vim
--- a/runtime/syntax/idl.vim Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/syntax/idl.vim Mon Jul 26 12:53:41 2004 +0000
@@ -1,203 +1,314 @@
11 " Vim syntax file
2-" Language: IDL (Interface Description Language)
3-" Maintainer: Jody Goldberg <jgoldberg@home.com> or <jody@gnome.org>
4-" Last Change: 2004 Jul 12
2+" Language: IDL (Interface Description Language)
3+" Created By: Jody Goldberg <jody@gnome.org>
4+" Maintainer: Michael Geddes <michaelrgeddes@optushome.com.au>
5+" Last Change: 2004 Jul 20
56
67 " This is an experiment. IDL's structure is simple enough to permit a full
78 " grammar based approach to rather than using a few heuristics. The result
89 " is large and somewhat repetative but seems to work.
910
10-" For version 5.x: Clear all syntax items
11-" For version 6.x: Quit when a syntax file was already loaded
12-if version < 600
13- syntax clear
14-elseif exists("b:current_syntax")
11+" There are some Microsoft extensions to idl files that are here. Some of
12+" them are disabled by defining idl_no_ms_extensions.
13+"
14+" The more complex of the extensions are disabled by defining idl_no_extensions.
15+"
16+
17+if exists("b:current_syntax")
1518 finish
1619 endif
1720
21+if exists("idlsyntax_showerror")
22+ syn match idlError +\S+ skipwhite skipempty nextgroup=idlError
23+endif
24+
25+syn region idlCppQuote start='\<cpp_quote\s*(' end=')' contains=idlString
26+
1827 " Misc basic
19-syn match idlId contained "[a-zA-Z][a-zA-Z0-9_]*"
20-syn match idlSemiColon contained ";"
21-syn match idlCommaArg contained "," skipempty skipwhite nextgroup=idlSimpDecl
22-syn region idlArraySize1 contained start=:\[: end=:\]: skipempty skipwhite nextgroup=idlArraySize1,idlSemiColon,idlCommaArg contains=idlArraySize1,idlLiteral
23-syn match idlSimpDecl contained "[a-zA-Z][a-zA-Z0-9_]*" skipempty skipwhite nextgroup=idlSemiColon,idlCommaArg,idlArraySize1
24-syn region idlSting contained start=+"+ skip=+\\\(\\\\\)*"+ end=+"+
25-syn match idlLiteral contained "[1-9]\d*\(\.\d*\)\="
26-syn match idlLiteral contained "\.\d\+"
27-syn keyword idlLiteral contained TRUE FALSE
28+syn match idlId contained "[a-zA-Z][a-zA-Z0-9_]*" skipwhite skipempty nextgroup=idlEnumComma,idlEnumNumber
29+syn match idlEnumComma contained ","
30+syn match idlEnumNumber contained "=" skipwhite skipempty nextgroup=idlString,idlLiteral
31+syn match idlSemiColon contained ";"
32+syn match idlCommaArg contained "," skipempty skipwhite nextgroup=idlSimpDecl
33+syn region idlArraySize1 contained start=:\[: end=:\]: skipempty skipwhite nextgroup=idlArraySize1,idlError,idlSemiColon,idlCommaArg contains=idlArraySize1,idlLiteral
34+syn match idlSimpDecl contained "[a-zA-Z][a-zA-Z0-9_]*" skipempty skipwhite nextgroup=idlError,idlSemiColon,idlCommaArg,idlArraySize1
35+syn region idlString contained start=+"+ skip=+\\\(\\\\\)*"+ end=+"+
36+syn match idlLiteral contained "[1-9]\d*\(\.\d*\)\="
37+syn match idlLiteral contained "0"
38+syn match idlLiteral contained "\.\d\+"
39+syn match idlLiteral contained "0x[0-9A-Fa-f]\+"
40+syn match idlLiteral contained "0[0-7]\+"
41+syn keyword idlLiteral contained TRUE FALSE
2842
2943 " Comments
30-syn keyword idlTodo contained TODO FIXME XXX
31-syn region idlComment start="/\*" end="\*/" contains=idlTodo
32-syn match idlComment "//.*" contains=idlTodo
33-syn match idlCommentError "\*/"
44+syn keyword idlTodo contained TODO FIXME XXX
45+syn region idlComment start="/\*" end="\*/" contains=idlTodo
46+syn match idlComment "//.*" contains=idlTodo
47+syn match idlCommentError "\*/"
3448
3549 " C style Preprocessor
36-syn region idlIncluded contained start=+"+ skip=+\\\(\\\\\)*"+ end=+"+
37-syn match idlIncluded contained "<[^>]*>"
38-syn match idlInclude "^[ \t]*#[ \t]*include\>[ \t]*["<]" contains=idlIncluded,idlString
39-syn region idlPreCondit start="^[ \t]*#[ \t]*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=idlComment,idlCommentError
40-syn region idlDefine start="^[ \t]*#[ \t]*\(define\>\|undef\>\)" skip="\\$" end="$" contains=idlLiteral, idlString
50+syn region idlIncluded contained start=+"+ skip=+\\\(\\\\\)*"+ end=+"+
51+syn match idlIncluded contained "<[^>]*>"
52+syn match idlInclude "^[ \t]*#[ \t]*include\>[ \t]*["<]" contains=idlIncluded,idlString
53+syn region idlPreCondit start="^[ \t]*#[ \t]*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=idlComment,idlCommentError
54+syn region idlDefine start="^[ \t]*#[ \t]*\(define\>\|undef\>\)" skip="\\$" end="$" contains=idlLiteral,idlString
4155
4256 " Constants
43-syn keyword idlConst const skipempty skipwhite nextgroup=idlBaseType,idlBaseTypeInt
57+syn keyword idlConst const skipempty skipwhite nextgroup=idlBaseType,idlBaseTypeInt
4458
4559 " Attribute
46-syn keyword idlROAttr readonly skipempty skipwhite nextgroup=idlAttr
47-syn keyword idlAttr attribute skipempty skipwhite nextgroup=idlBaseTypeInt,idlBaseType
60+syn keyword idlROAttr readonly skipempty skipwhite nextgroup=idlAttr
61+syn keyword idlAttr attribute skipempty skipwhite nextgroup=idlBaseTypeInt,idlBaseType
4862
4963 " Types
50-syn region idlD4 contained start="<" end=">" skipempty skipwhite nextgroup=idlSimpDecl contains=idlSeqType,idlBaseTypeInt,idlBaseType,idlLiteral
51-syn keyword idlSeqType contained sequence skipempty skipwhite nextgroup=idlD4
52-syn keyword idlBaseType contained float double char boolean octet any skipempty skipwhite nextgroup=idlSimpDecl
53-syn keyword idlBaseTypeInt contained short long skipempty skipwhite nextgroup=idlSimpDecl
54-syn keyword idlBaseType contained unsigned skipempty skipwhite nextgroup=idlBaseTypeInt
55-syn region idlD1 contained start="<" end=">" skipempty skipwhite nextgroup=idlSimpDecl contains=idlString,idlLiteral
56-syn keyword idlBaseType contained string skipempty skipwhite nextgroup=idlD1,idlSimpDecl
57-syn match idlBaseType contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlSimpDecl
64+syn region idlD4 contained start="<" end=">" skipempty skipwhite nextgroup=idlSimpDecl contains=idlSeqType,idlBaseTypeInt,idlBaseType,idlLiteral
65+syn keyword idlSeqType contained sequence skipempty skipwhite nextgroup=idlD4
66+syn keyword idlBaseType contained float double char boolean octet any skipempty skipwhite nextgroup=idlSimpDecl
67+syn keyword idlBaseTypeInt contained short long skipempty skipwhite nextgroup=idlSimpDecl
68+syn keyword idlBaseType contained unsigned skipempty skipwhite nextgroup=idlBaseTypeInt
69+syn region idlD1 contained start="<" end=">" skipempty skipwhite nextgroup=idlSimpDecl contains=idlString,idlLiteral
70+syn keyword idlBaseType contained string skipempty skipwhite nextgroup=idlD1,idlSimpDecl
71+syn match idlBaseType contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlSimpDecl
5872
5973 " Modules
60-syn region idlModuleContent contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon contains=idlUnion,idlStruct,idlEnum,idlInterface,idlComment,idlTypedef,idlConst,idlException,idlModule
61-syn match idlModuleName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlModuleContent,idlSemiColon
62-syn keyword idlModule module skipempty skipwhite nextgroup=idlModuleName
74+syn region idlModuleContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon contains=idlUnion,idlStruct,idlEnum,idlInterface,idlComment,idlTypedef,idlConst,idlException,idlModule
75+syn match idlModuleName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlModuleContent,idlError,idlSemiColon
76+syn keyword idlModule module skipempty skipwhite nextgroup=idlModuleName
6377
6478 " Interfaces
65-syn region idlInterfaceContent contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon contains=idlUnion,idlStruct,idlEnum,idlComment,idlROAttr,idlAttr,idlOp,idlOneWayOp,idlException,idlConst,idlTypedef
66-syn match idlInheritFrom2 contained "," skipempty skipwhite nextgroup=idlInheritFrom
67-syn match idlInheritFrom contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlInheritFrom2,idlInterfaceContent
68-syn match idlInherit contained ":" skipempty skipwhite nextgroup=idlInheritFrom
69-syn match idlInterfaceName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlInterfaceContent,idlInherit,idlSemiColon
70-syn keyword idlInterface interface skipempty skipwhite nextgroup=idlInterfaceName
79+syn cluster idlCommentable contains=idlComment
80+syn cluster idlContentCluster contains=idlUnion,idlStruct,idlEnum,idlROAttr,idlAttr,idlOp,idlOneWayOp,idlException,idlConst,idlTypedef,idlAttributes,idlErrorSquareBracket,idlErrorBracket,idlInterfaceSections
81+
82+syn region idlInterfaceContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon contains=@idlContentCluster,@idlCommentable
83+syn match idlInheritFrom2 contained "," skipempty skipwhite nextgroup=idlInheritFrom
84+syn match idlInheritFrom contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlInheritFrom2,idlInterfaceContent
85+syn match idlInherit contained ":" skipempty skipwhite nextgroup=idlInheritFrom
86+syn match idlInterfaceName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlInterfaceContent,idlInherit,idlError,idlSemiColon
87+syn keyword idlInterface interface dispinterface skipempty skipwhite nextgroup=idlInterfaceName
88+syn keyword idlInterfaceSections contained properties methods skipempty skipwhite nextgroup=idlSectionColon,idlError
89+syn match idlSectionColon contained ":"
7190
7291
92+syn match idlLibraryName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlLibraryContent,idlError,idlSemiColon
93+syn keyword idlLibrary library skipempty skipwhite nextgroup=idlLibraryName
94+syn region idlLibraryContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon contains=@idlCommentable,idlAttributes,idlErrorSquareBracket,idlErrorBracket,idlImportlib,idlCoclass,idlTypedef,idlInterface
95+
96+syn keyword idlImportlib contained importlib skipempty skipwhite nextgroup=idlStringArg
97+syn region idlStringArg contained start="(" end=")" contains=idlString nextgroup=idlError,idlSemiColon,idlErrorBrace,idlErrorSquareBracket
98+
99+syn keyword idlCoclass coclass contained skipempty skipwhite nextgroup=idlCoclassName
100+syn match idlCoclassName "[a-zA-Z0-9_]\+" contained skipempty skipwhite nextgroup=idlCoclassDefinition,idlError,idlSemiColon
101+
102+syn region idlCoclassDefinition contained start="{" end="}" contains=idlCoclassAttributes,idlInterface,idlErrorBracket,idlErrorSquareBracket skipempty skipwhite nextgroup=idlError,idlSemiColon
103+syn region idlCoclassAttributes contained start=+\[+ end=+]+ skipempty skipwhite nextgroup=idlInterface contains=idlErrorBracket,idlErrorBrace,idlCoclassAttribute
104+syn keyword idlCoclassAttribute contained default source
105+"syn keyword idlInterface interface skipempty skipwhite nextgroup=idlInterfaceStubName
106+
107+syn match idlImportString +"\f\+"+ skipempty skipwhite nextgroup=idlError,idlSemiColon
108+syn keyword idlImport import skipempty skipwhite nextgroup=idlImportString
109+
110+syn region idlAttributes start="\[" end="\]" contains=idlAttribute,idlAttributeParam,idlErrorBracket,idlErrorBrace,idlComment
111+syn keyword idlAttribute contained propput propget propputref id helpstring object uuid pointer_default
112+if !exists('idl_no_ms_extensions')
113+syn keyword idlAttribute contained nonextensible dual version aggregatable restricted hidden noncreatable oleautomation
114+endif
115+syn region idlAttributeParam contained start="(" end=")" contains=idlString,idlUuid,idlLiteral,idlErrorBrace,idlErrorSquareBracket
116+" skipwhite nextgroup=idlArraySize,idlParmList contains=idlArraySize,idlLiteral
117+syn match idlErrorBrace contained "}"
118+syn match idlErrorBracket contained ")"
119+syn match idlErrorSquareBracket contained "\]"
120+
121+syn match idlUuid contained +[0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}+
122+
73123 " Raises
74-syn keyword idlRaises contained raises skipempty skipwhite nextgroup=idlRaises,idlContext,idlSemiColon
124+syn keyword idlRaises contained raises skipempty skipwhite nextgroup=idlRaises,idlContext,idlError,idlSemiColon
75125
76126 " Context
77-syn keyword idlContext contained context skipempty skipwhite nextgroup=idlRaises,idlContext,idlSemiColon
127+syn keyword idlContext contained context skipempty skipwhite nextgroup=idlRaises,idlContext,idlError,idlSemiColon
78128
79129 " Operation
80-syn match idlParmList contained "," skipempty skipwhite nextgroup=idlOpParms
81-syn region idlArraySize contained start="\[" end="\]" skipempty skipwhite nextgroup=idlArraySize,idlParmList contains=idlArraySize,idlLiteral
82-syn match idlParmName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlParmList,idlArraySize
83-syn keyword idlParmInt contained short long skipempty skipwhite nextgroup=idlParmName
84-syn keyword idlParmType contained unsigned skipempty skipwhite nextgroup=idlParmInt
85-syn region idlD3 contained start="<" end=">" skipempty skipwhite nextgroup=idlParmName contains=idlString,idlLiteral
86-syn keyword idlParmType contained string skipempty skipwhite nextgroup=idlD3,idlParmName
87-syn keyword idlParmType contained void float double char boolean octet any skipempty skipwhite nextgroup=idlParmName
88-syn match idlParmType contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlParmName
89-syn keyword idlOpParms contained in out inout skipempty skipwhite nextgroup=idlParmType
130+syn match idlParmList contained "," skipempty skipwhite nextgroup=idlOpParms
131+syn region idlArraySize contained start="\[" end="\]" skipempty skipwhite nextgroup=idlArraySize,idlParmList contains=idlArraySize,idlLiteral
132+syn match idlParmName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlParmList,idlArraySize
133+syn keyword idlParmInt contained short long skipempty skipwhite nextgroup=idlParmName
134+syn keyword idlParmType contained unsigned skipempty skipwhite nextgroup=idlParmInt
135+syn region idlD3 contained start="<" end=">" skipempty skipwhite nextgroup=idlParmName contains=idlString,idlLiteral
136+syn keyword idlParmType contained string skipempty skipwhite nextgroup=idlD3,idlParmName
137+syn keyword idlParmType contained void float double char boolean octet any skipempty skipwhite nextgroup=idlParmName
138+syn match idlParmType contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlParmName
139+syn keyword idlOpParms contained in out inout skipempty skipwhite nextgroup=idlParmType
90140
91-syn region idlOpContents contained start="(" end=")" skipempty skipwhite nextgroup=idlRaises,idlContext,idlSemiColon contains=idlOpParms
92-syn match idlOpName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlOpContents
93-syn keyword idlOpInt contained short long skipempty skipwhite nextgroup=idlOpName
94-syn region idlD2 contained start="<" end=">" skipempty skipwhite nextgroup=idlOpName contains=idlString,idlLiteral
95-syn keyword idlOp contained unsigned skipempty skipwhite nextgroup=idlOpInt
96-syn keyword idlOp contained string skipempty skipwhite nextgroup=idlD2,idlOpName
97-syn keyword idlOp contained void float double char boolean octet any skipempty skipwhite nextgroup=idlOpName
98-syn match idlOp contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlOpName
99-syn keyword idlOp contained void skipempty skipwhite nextgroup=idlOpName
100-syn keyword idlOneWayOp contained oneway skipempty skipwhite nextgroup=idOp
141+if !exists('idl_no_ms_extensions')
142+syn keyword idlOpParms contained retval optional skipempty skipwhite nextgroup=idlParmType
143+ syn match idlOpParms contained +\<\(iid_is\|defaultvalue\)\s*([^)]*)+ skipempty skipwhite nextgroup=idlParamType
144+
145+ syn keyword idlVariantType contained BSTR VARIANT VARIANT_BOOL long short unsigned double CURRENCY DATE
146+ syn region idlSafeArray contained matchgroup=idlVariantType start=+SAFEARRAY(\s*+ end=+)+ contains=idlVariantType
147+endif
148+
149+syn region idlOpContents contained start="(" end=")" skipempty skipwhite nextgroup=idlRaises,idlContext,idlError,idlSemiColon contains=idlOpParms,idlSafeArray,idlVariantType,@idlCommentable
150+syn match idlOpName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlOpContents
151+syn keyword idlOpInt contained short long skipempty skipwhite nextgroup=idlOpName
152+syn region idlD2 contained start="<" end=">" skipempty skipwhite nextgroup=idlOpName contains=idlString,idlLiteral
153+syn keyword idlOp contained unsigned skipempty skipwhite nextgroup=idlOpInt
154+syn keyword idlOp contained string skipempty skipwhite nextgroup=idlD2,idlOpName
155+syn keyword idlOp contained void float double char boolean octet any skipempty skipwhite nextgroup=idlOpName
156+syn match idlOp contained "[a-zA-Z0-9_]\+[ \t]*\(::[ \t]*[a-zA-Z0-9_]\+\)*" skipempty skipwhite nextgroup=idlOpName
157+syn keyword idlOp contained void skipempty skipwhite nextgroup=idlOpName
158+syn keyword idlOneWayOp contained oneway skipempty skipwhite nextgroup=idOp
101159
102160 " Enum
103-syn region idlEnumContents contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon, idlSimpDecl contains=idlId,idlComment
104-syn match idlEnumName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlEnumContents
105-syn keyword idlEnum enum skipempty skipwhite nextgroup=idlEnumName
161+syn region idlEnumContents contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon,idlSimpDecl contains=idlId,idlAttributes,@idlCommentable
162+syn match idlEnumName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlEnumContents
163+syn keyword idlEnum enum skipempty skipwhite nextgroup=idlEnumName,idlEnumContents
106164
107165 " Typedef
108-syn keyword idlTypedef typedef skipempty skipwhite nextgroup=idlBaseType, idlBaseTypeInt, idlSeqType
166+syn keyword idlTypedef typedef skipempty skipwhite nextgroup=idlTypedefOtherTypeQualifier,idlDefBaseType,idlDefBaseTypeInt,idlDefSeqType,idlDefv1Enum,idlDefEnum,idlDefOtherType,idlDefAttributes,idlError
167+
168+if !exists('idl_no_extensions')
169+ syn keyword idlTypedefOtherTypeQualifier contained struct enum interface nextgroup=idlDefBaseType,idlDefBaseTypeInt,idlDefSeqType,idlDefv1Enum,idlDefEnum,idlDefOtherType,idlDefAttributes,idlError skipwhite
170+
171+ syn region idlDefAttributes contained start="\[" end="\]" contains=idlAttribute,idlAttributeParam,idlErrorBracket,idlErrorBrace skipempty skipwhite nextgroup=idlDefBaseType,idlDefBaseTypeInt,idlDefSeqType,idlDefv1Enum,idlDefEnum,idlDefOtherType,idlError
172+
173+ syn keyword idlDefBaseType contained float double char boolean octet any skipempty skipwhite nextgroup=idlTypedefDecl,idlError
174+ syn keyword idlDefBaseTypeInt contained short long skipempty skipwhite nextgroup=idlTypedefDecl,idlError
175+ syn match idlDefOtherType contained +\<\k\+\>+ skipempty nextgroup=idlTypedefDecl,idlError
176+ " syn keyword idlDefSeqType contained sequence skipempty skipwhite nextgroup=idlD4
177+
178+ " Enum typedef
179+ syn keyword idlDefEnum contained enum skipempty skipwhite nextgroup=idlDefEnumName,idlDefEnumContents
180+ syn match idlDefEnumName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlDefEnumContents,idlTypedefDecl
181+ syn region idlDefEnumContents contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlTypedefDecl contains=idlId,idlAttributes
182+
183+ syn match idlTypedefDecl contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlError,idlSemiColon
184+endif
109185
110186 " Struct
111-syn region idlStructContent contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon, idlSimpDecl contains=idlBaseType, idlBaseTypeInt, idlSeqType,idlComment, idlEnum, idlUnion
112-syn match idlStructName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlStructContent
113-syn keyword idlStruct struct skipempty skipwhite nextgroup=idlStructName
187+syn region idlStructContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon,idlSimpDecl contains=idlBaseType,idlBaseTypeInt,idlSeqType,@idlCommentable,idlEnum,idlUnion
188+syn match idlStructName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlStructContent
189+syn keyword idlStruct struct skipempty skipwhite nextgroup=idlStructName
114190
115191 " Exception
116-syn keyword idlException exception skipempty skipwhite nextgroup=idlStructName
192+syn keyword idlException exception skipempty skipwhite nextgroup=idlStructName
117193
118194 " Union
119-syn match idlColon contained ":" skipempty skipwhite nextgroup=idlCase,idlSeqType,idlBaseType,idlBaseTypeInt
120-syn region idlCaseLabel contained start="" skip="::" end=":"me=e-1 skipempty skipwhite nextgroup=idlColon contains=idlLiteral,idlString
121-syn keyword idlCase contained case skipempty skipwhite nextgroup=idlCaseLabel
122-syn keyword idlCase contained default skipempty skipwhite nextgroup=idlColon
123-syn region idlUnionContent contained start="{" end="}" skipempty skipwhite nextgroup=idlSemiColon,idlSimpDecl contains=idlCase
124-syn region idlSwitchType contained start="(" end=")" skipempty skipwhite nextgroup=idlUnionContent
125-syn keyword idlUnionSwitch contained switch skipempty skipwhite nextgroup=idlSwitchType
126-syn match idlUnionName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlUnionSwitch
127-syn keyword idlUnion union skipempty skipwhite nextgroup=idlUnionName
128-
129-syn sync lines=200
130-
131-" Define the default highlighting.
132-" For version 5.7 and earlier: only when not done already
133-" For version 5.8 and later: only when an item doesn't have highlighting yet
134-if version >= 508 || !exists("did_idl_syntax_inits")
135- if version < 508
136- let did_idl_syntax_inits = 1
137- command -nargs=+ HiLink hi link <args>
138- else
139- command -nargs=+ HiLink hi def link <args>
140- endif
141-
142- HiLink idlInclude Include
143- HiLink idlPreProc PreProc
144- HiLink idlPreCondit PreCondit
145- HiLink idlDefine Macro
146- HiLink idlIncluded String
147- HiLink idlString String
148- HiLink idlComment Comment
149- HiLink idlTodo Todo
150- HiLink idlLiteral Number
195+syn match idlColon contained ":" skipempty skipwhite nextgroup=idlCase,idlSeqType,idlBaseType,idlBaseTypeInt
196+syn region idlCaseLabel contained start="" skip="::" end=":"me=e-1 skipempty skipwhite nextgroup=idlColon contains=idlLiteral,idlString
197+syn keyword idlCase contained case skipempty skipwhite nextgroup=idlCaseLabel
198+syn keyword idlCase contained default skipempty skipwhite nextgroup=idlColon
199+syn region idlUnionContent contained start="{" end="}" skipempty skipwhite nextgroup=idlError,idlSemiColon,idlSimpDecl contains=idlCase
200+syn region idlSwitchType contained start="(" end=")" skipempty skipwhite nextgroup=idlUnionContent
201+syn keyword idlUnionSwitch contained switch skipempty skipwhite nextgroup=idlSwitchType
202+syn match idlUnionName contained "[a-zA-Z0-9_]\+" skipempty skipwhite nextgroup=idlUnionSwitch
203+syn keyword idlUnion union skipempty skipwhite nextgroup=idlUnionName
151204
152- HiLink idlModule Keyword
153- HiLink idlInterface Keyword
154- HiLink idlEnum Keyword
155- HiLink idlStruct Keyword
156- HiLink idlUnion Keyword
157- HiLink idlTypedef Keyword
158- HiLink idlException Keyword
159-
160- HiLink idlModuleName Typedef
161- HiLink idlInterfaceName Typedef
162- HiLink idlEnumName Typedef
163- HiLink idlStructName Typedef
164- HiLink idlUnionName Typedef
205+if !exists('idl_no_extensions')
206+ syn sync match idlInterfaceSync grouphere idlInterfaceContent "\<\(disp\)\=interface\>\s\+\k\+\s*:\s*\k\+\_s*{" skipempty skipwhite nextgroup=idlError,idlSemiColon contains=@idlContentCluster,@idlCommentable
207+ syn sync maxlines=1000 minlines=100
208+else
209+ syn sync lines=200
210+endif
211+" syn sync fromstart
165212
166- HiLink idlBaseTypeInt idlType
167- HiLink idlBaseType idlType
168- HiLink idlSeqType idlType
169- HiLink idlD1 Paren
170- HiLink idlD2 Paren
171- HiLink idlD3 Paren
172- HiLink idlD4 Paren
173- "HiLink idlArraySize Paren
174- "HiLink idlArraySize1 Paren
175- HiLink idlModuleContent Paren
176- HiLink idlUnionContent Paren
177- HiLink idlStructContent Paren
178- HiLink idlEnumContents Paren
179- HiLink idlInterfaceContent Paren
213+if !exists("did_idl_syntax_inits")
214+ let did_idl_syntax_inits = 1
215+ " The default methods for highlighting. Can be overridden later
216+ command -nargs=+ HiLink hi def link <args>
180217
181- HiLink idlSimpDecl Identifier
182- HiLink idlROAttr StorageClass
183- HiLink idlAttr Keyword
184- HiLink idlConst StorageClass
218+ HiLink idlInclude Include
219+ HiLink idlPreProc PreProc
220+ HiLink idlPreCondit PreCondit
221+ HiLink idlDefine Macro
222+ HiLink idlIncluded String
223+ HiLink idlString String
224+ HiLink idlComment Comment
225+ HiLink idlTodo Todo
226+ HiLink idlLiteral Number
227+ HiLink idlUuid Number
228+ HiLink idlType Type
229+ HiLink idlVariantType idlType
185230
186- HiLink idlOneWayOp StorageClass
187- HiLink idlOp idlType
188- HiLink idlParmType idlType
189- HiLink idlOpName Function
190- HiLink idlOpParms StorageClass
191- HiLink idlParmName Identifier
192- HiLink idlInheritFrom Identifier
231+ HiLink idlModule Keyword
232+ HiLink idlInterface Keyword
233+ HiLink idlEnum Keyword
234+ HiLink idlStruct Keyword
235+ HiLink idlUnion Keyword
236+ HiLink idlTypedef Keyword
237+ HiLink idlException Keyword
238+ HiLink idlTypedefOtherTypeQualifier keyword
193239
194- HiLink idlId Constant
195- "HiLink idlCase Keyword
196- HiLink idlCaseLabel Constant
240+ HiLink idlModuleName Typedef
241+ HiLink idlInterfaceName Typedef
242+ HiLink idlEnumName Typedef
243+ HiLink idlStructName Typedef
244+ HiLink idlUnionName Typedef
197245
246+ HiLink idlBaseTypeInt idlType
247+ HiLink idlBaseType idlType
248+ HiLink idlSeqType idlType
249+ HiLink idlD1 Paren
250+ HiLink idlD2 Paren
251+ HiLink idlD3 Paren
252+ HiLink idlD4 Paren
253+ "HiLink idlArraySize Paren
254+ "HiLink idlArraySize1 Paren
255+ HiLink idlModuleContent Paren
256+ HiLink idlUnionContent Paren
257+ HiLink idlStructContent Paren
258+ HiLink idlEnumContents Paren
259+ HiLink idlInterfaceContent Paren
260+
261+ HiLink idlSimpDecl Identifier
262+ HiLink idlROAttr StorageClass
263+ HiLink idlAttr Keyword
264+ HiLink idlConst StorageClass
265+
266+ HiLink idlOneWayOp StorageClass
267+ HiLink idlOp idlType
268+ HiLink idlParmType idlType
269+ HiLink idlOpName Function
270+ HiLink idlOpParms SpecialComment
271+ HiLink idlParmName Identifier
272+ HiLink idlInheritFrom Identifier
273+ HiLink idlAttribute SpecialComment
274+
275+ HiLink idlId Constant
276+ "HiLink idlCase Keyword
277+ HiLink idlCaseLabel Constant
278+
279+ HiLink idlErrorBracket Error
280+ HiLink idlErrorBrace Error
281+ HiLink idlErrorSquareBracket Error
282+
283+ HiLink idlImport Keyword
284+ HiLink idlImportString idlString
285+ HiLink idlCoclassAttribute StorageClass
286+ HiLink idlLibrary Keyword
287+ HiLink idlImportlib Keyword
288+ HiLink idlCoclass Keyword
289+ HiLink idlLibraryName Typedef
290+ HiLink idlCoclassName Typedef
291+ " hi idlLibraryContent guifg=red
292+ HiLink idlTypedefDecl Typedef
293+ HiLink idlDefEnum Keyword
294+ HiLink idlDefv1Enum Keyword
295+ HiLink idlDefEnumName Typedef
296+ HiLink idlDefEnumContents Paren
297+ HiLink idlDefBaseTypeInt idlType
298+ HiLink idlDefBaseType idlType
299+ HiLink idlDefSeqType idlType
300+ HiLink idlInterfaceSections Label
301+
302+ if exists("idlsyntax_showerror")
303+ if exists("idlsyntax_showerror_soft")
304+ hi default idlError guibg=#d0ffd0
305+ else
306+ HiLink idlError Error
307+ endif
308+ endif
198309 delcommand HiLink
199310 endif
200311
201312 let b:current_syntax = "idl"
202313
203-" vim: ts=8
314+" vim: sw=2 et
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/syntax/lilo.vim
--- a/runtime/syntax/lilo.vim Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/syntax/lilo.vim Mon Jul 26 12:53:41 2004 +0000
@@ -2,22 +2,23 @@
22 " This is a GENERATED FILE. Please always refer to source file at the URI below.
33 " Language: lilo configuration (lilo.conf)
44 " Maintainer: David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>
5-" Last Change: 2003 May 04
5+" Last Change: 2004-07-20
66 " URL: http://trific.ath.cx/Ftp/vim/syntax/lilo.vim
77
8+
89 " Setup
910 if version >= 600
10- if exists("b:current_syntax")
11- finish
12- endif
11+ if exists("b:current_syntax")
12+ finish
13+ endif
1314 else
14- syntax clear
15+ syntax clear
1516 endif
1617
1718 if version >= 600
18- command -nargs=1 SetIsk setlocal iskeyword=<args>
19+ command -nargs=1 SetIsk setlocal iskeyword=<args>
1920 else
20- command -nargs=1 SetIsk set iskeyword=<args>
21+ command -nargs=1 SetIsk set iskeyword=<args>
2122 endif
2223 SetIsk @,48-57,.,-,_
2324 delcommand SetIsk
@@ -34,23 +35,23 @@
3435 syn match liloDecNumberP "\d\+p\=" contained
3536 syn match liloSpecial contained "\\\(\"\|\\\|$\)"
3637 syn region liloString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=liloSpecial,liloEnviron
37-syn match liloLabel "\S\+" contained contains=liloSpecial,liloEnviron
38+syn match liloLabel :[^ "]\+: contained contains=liloSpecial,liloEnviron
3839 syn region liloPath start=+[$/]+ skip=+\\\\\|\\ \|\\$"+ end=+ \|$+ contained contains=liloSpecial,liloEnviron
3940 syn match liloDecNumberList "\(\d\|,\)\+" contained contains=liloDecNumber
4041 syn match liloDecNumberPList "\(\d\|[,p]\)\+" contained contains=liloDecNumberP,liloDecNumber
4142 syn region liloAnything start=+[^[:space:]#]+ skip=+\\\\\|\\ \|\\$+ end=+ \|$+ contained contains=liloSpecial,liloEnviron,liloString
4243
4344 " Path
44-syn keyword liloOption backup bitmap boot disktab force-backup install keytable map message nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty
45+syn keyword liloOption backup bitmap boot disktab force-backup keytable map message nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty
4546 syn keyword liloKernelOpt initrd root nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty
4647 syn keyword liloImageOpt path loader table nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty
4748 syn keyword liloDiskOpt partition nextgroup=liloEqPath,liloEqPathComment,liloError skipwhite skipempty
4849
4950 " Other
50-syn keyword liloOption menu-scheme raid-extra-boot serial nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty
51-syn keyword liloOption default nextgroup=liloEqLabel,liloEqLabelComment,liloError skipwhite skipempty
51+syn keyword liloOption menu-scheme raid-extra-boot serial install nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty
52+syn keyword liloOption bios-passes-dl nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty
53+syn keyword liloOption default label alias wmdefault nextgroup=liloEqLabelString,liloEqLabelStringComment,liloError skipwhite skipempty
5254 syn keyword liloKernelOpt ramdisk nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty
53-syn keyword liloImageOpt alias label nextgroup=liloEqLabel,liloEqLabelComment,liloError skipwhite skipempty
5455 syn keyword liloImageOpt password range nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty
5556 syn keyword liloDiskOpt set type nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty
5657
@@ -67,19 +68,21 @@
6768 syn keyword liloImageOpt fallback literal nextgroup=liloEqString,liloEqStringComment,liloError skipwhite skipempty
6869
6970 " Hex number
70-syn keyword liloImageOpt map-drive to nextgroup=liloEqHexNumber,liloEqHexNumberComment,liloError skipwhite skipempty
71+syn keyword liloImageOpt map-drive to boot-as nextgroup=liloEqHexNumber,liloEqHexNumberComment,liloError skipwhite skipempty
7172 syn keyword liloDiskOpt bios normal hidden nextgroup=liloEqNumber,liloEqNumberComment,liloError skipwhite skipempty
7273
7374 " Number list
74-syn keyword liloOption bmp-colors bmp-timer nextgroup=liloEqNumberList,liloEqNumberListComment,liloError skipwhite skipempty
75+syn keyword liloOption bmp-colors nextgroup=liloEqNumberList,liloEqNumberListComment,liloError skipwhite skipempty
7576
7677 " Number list, some of the numbers followed by p
77-syn keyword liloOption bmp-table nextgroup=liloEqDecNumberPList,liloEqDecNumberPListComment,liloError skipwhite skipempty
78+syn keyword liloOption bmp-table bmp-timer nextgroup=liloEqDecNumberPList,liloEqDecNumberPListComment,liloError skipwhite skipempty
7879
7980 " Flag
8081 syn keyword liloOption compact fix-table geometric ignore-table lba32 linear mandatory nowarn prompt
82+syn keyword liloOption bmp-retain el-torito-bootable-CD large-memory suppress-boot-time-BIOS-data
8183 syn keyword liloKernelOpt read-only read-write
8284 syn keyword liloImageOpt bypass lock mandatory optional restricted single-key unsafe
85+syn keyword liloImageOpt master-boot wmwarn wmdisable
8386 syn keyword liloDiskOpt change activate deactivate inaccessible reset
8487
8588 " Image
@@ -97,7 +100,7 @@
97100 syn match liloEqDecNumberComment "#.*$" contained nextgroup=liloEqDecNumber,liloEqDecNumberComment,liloError skipwhite skipempty
98101 syn match liloEqHexNumberComment "#.*$" contained nextgroup=liloEqHexNumber,liloEqHexNumberComment,liloError skipwhite skipempty
99102 syn match liloEqStringComment "#.*$" contained nextgroup=liloEqString,liloEqStringComment,liloError skipwhite skipempty
100-syn match liloEqLabelComment "#.*$" contained nextgroup=liloEqLabel,liloEqLabelComment,liloError skipwhite skipempty
103+syn match liloEqLabelStringComment "#.*$" contained nextgroup=liloEqLabelString,liloEqLabelStringComment,liloError skipwhite skipempty
101104 syn match liloEqNumberListComment "#.*$" contained nextgroup=liloEqNumberList,liloEqNumberListComment,liloError skipwhite skipempty
102105 syn match liloEqDecNumberPListComment "#.*$" contained nextgroup=liloEqDecNumberPList,liloEqDecNumberPListComment,liloError skipwhite skipempty
103106 syn match liloEqAnythingComment "#.*$" contained nextgroup=liloEqAnything,liloEqAnythingComment,liloError skipwhite skipempty
@@ -109,7 +112,7 @@
109112 syn match liloEqDecNumber "=" contained nextgroup=liloDecNumber,liloDecNumberComment,liloError skipwhite skipempty
110113 syn match liloEqHexNumber "=" contained nextgroup=liloHexNumber,liloHexNumberComment,liloError skipwhite skipempty
111114 syn match liloEqString "=" contained nextgroup=liloString,liloStringComment,liloError skipwhite skipempty
112-syn match liloEqLabel "=" contained nextgroup=liloLabel,liloLabelComment,liloError skipwhite skipempty
115+syn match liloEqLabelString "=" contained nextgroup=liloString,liloLabel,liloLabelStringComment,liloError skipwhite skipempty
113116 syn match liloEqNumberList "=" contained nextgroup=liloDecNumberList,liloDecNumberListComment,liloError skipwhite skipempty
114117 syn match liloEqDecNumberPList "=" contained nextgroup=liloDecNumberPList,liloDecNumberPListComment,liloError skipwhite skipempty
115118 syn match liloEqAnything "=" contained nextgroup=liloAnything,liloAnythingComment,liloError skipwhite skipempty
@@ -121,74 +124,71 @@
121124 syn match liloDecNumberComment "#.*$" contained nextgroup=liloDecNumber,liloDecNumberComment,liloError skipwhite skipempty
122125 syn match liloHexNumberComment "#.*$" contained nextgroup=liloHexNumber,liloHexNumberComment,liloError skipwhite skipempty
123126 syn match liloStringComment "#.*$" contained nextgroup=liloString,liloStringComment,liloError skipwhite skipempty
124-syn match liloLabelComment "#.*$" contained nextgroup=liloLabel,liloLabelComment,liloError skipwhite skipempty
127+syn match liloLabelStringComment "#.*$" contained nextgroup=liloString,liloLabel,liloLabelStringComment,liloError skipwhite skipempty
125128 syn match liloDecNumberListComment "#.*$" contained nextgroup=liloDecNumberList,liloDecNumberListComment,liloError skipwhite skipempty
126129 syn match liloDecNumberPListComment "#.*$" contained nextgroup=liloDecNumberPList,liloDecNumberPListComment,liloError skipwhite skipempty
127130 syn match liloAnythingComment "#.*$" contained nextgroup=liloAnything,liloAnythingComment,liloError skipwhite skipempty
128131
129132 " Define the default highlighting
130133 if version >= 508 || !exists("did_lilo_syntax_inits")
131- if version < 508
132- let did_lilo_syntax_inits = 1
133- command -nargs=+ HiLink hi link <args>
134- else
135- command -nargs=+ HiLink hi def link <args>
136- endif
137-
138- HiLink liloEqPath liloEquals
139- HiLink liloEqWord liloEquals
140- HiLink liloEqVga liloEquals
141- HiLink liloEqDecNumber liloEquals
142- HiLink liloEqHexNumber liloEquals
143- HiLink liloEqNumber liloEquals
144- HiLink liloEqString liloEquals
145- HiLink liloEqLabel liloEquals
146- HiLink liloEqAnything liloEquals
147- HiLink liloEquals Special
148-
149- HiLink liloError Error
134+ if version < 508
135+ let did_lilo_syntax_inits = 1
136+ command -nargs=+ HiLink hi link <args>
137+ else
138+ command -nargs=+ HiLink hi def link <args>
139+ endif
150140
151- HiLink liloEqPathComment liloComment
152- HiLink liloEqVgaComment liloComment
153- HiLink liloEqDecNumberComment liloComment
154- HiLink liloEqHexNumberComment liloComment
155- HiLink liloEqStringComment liloComment
156- HiLink liloEqLabelComment liloComment
157- HiLink liloEqAnythingComment liloComment
158- HiLink liloPathComment liloComment
159- HiLink liloVgaComment liloComment
160- HiLink liloDecNumberComment liloComment
161- HiLink liloHexNumberComment liloComment
162- HiLink liloNumberComment liloComment
163- HiLink liloStringComment liloComment
164- HiLink liloLabelComment liloComment
165- HiLink liloAnythingComment liloComment
166- HiLink liloComment Comment
141+ HiLink liloEqPath liloEquals
142+ HiLink liloEqWord liloEquals
143+ HiLink liloEqVga liloEquals
144+ HiLink liloEqDecNumber liloEquals
145+ HiLink liloEqHexNumber liloEquals
146+ HiLink liloEqNumber liloEquals
147+ HiLink liloEqString liloEquals
148+ HiLink liloEqAnything liloEquals
149+ HiLink liloEquals Special
167150
168- HiLink liloDiskOpt liloOption
169- HiLink liloKernelOpt liloOption
170- HiLink liloImageOpt liloOption
171- HiLink liloOption Keyword
172-
173- HiLink liloDecNumber liloNumber
174- HiLink liloHexNumber liloNumber
175- HiLink liloDecNumberP liloNumber
176- HiLink liloNumber Number
177- HiLink liloString String
178- HiLink liloPath Constant
151+ HiLink liloError Error
179152
180- HiLink liloSpecial Special
181- HiLink liloLabel Title
182- HiLink liloDecNumberList Special
183- HiLink liloDecNumberPList Special
184- HiLink liloAnything Normal
185- HiLink liloEnviron Identifier
186- HiLink liloVgaKeyword Identifier
187- HiLink liloImage Type
188- HiLink liloChRules Preproc
189- HiLink liloDisk Preproc
153+ HiLink liloEqPathComment liloComment
154+ HiLink liloEqVgaComment liloComment
155+ HiLink liloEqDecNumberComment liloComment
156+ HiLink liloEqHexNumberComment liloComment
157+ HiLink liloEqStringComment liloComment
158+ HiLink liloEqAnythingComment liloComment
159+ HiLink liloPathComment liloComment
160+ HiLink liloVgaComment liloComment
161+ HiLink liloDecNumberComment liloComment
162+ HiLink liloHexNumberComment liloComment
163+ HiLink liloNumberComment liloComment
164+ HiLink liloStringComment liloComment
165+ HiLink liloAnythingComment liloComment
166+ HiLink liloComment Comment
190167
191- delcommand HiLink
168+ HiLink liloDiskOpt liloOption
169+ HiLink liloKernelOpt liloOption
170+ HiLink liloImageOpt liloOption
171+ HiLink liloOption Keyword
172+
173+ HiLink liloDecNumber liloNumber
174+ HiLink liloHexNumber liloNumber
175+ HiLink liloDecNumberP liloNumber
176+ HiLink liloNumber Number
177+ HiLink liloString String
178+ HiLink liloPath Constant
179+
180+ HiLink liloSpecial Special
181+ HiLink liloLabel Title
182+ HiLink liloDecNumberList Special
183+ HiLink liloDecNumberPList Special
184+ HiLink liloAnything Normal
185+ HiLink liloEnviron Identifier
186+ HiLink liloVgaKeyword Identifier
187+ HiLink liloImage Type
188+ HiLink liloChRules Preproc
189+ HiLink liloDisk Preproc
190+
191+ delcommand HiLink
192192 endif
193193
194194 let b:current_syntax = "lilo"
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/syntax/lprolog.vim
--- a/runtime/syntax/lprolog.vim Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/syntax/lprolog.vim Mon Jul 26 12:53:41 2004 +0000
@@ -2,10 +2,10 @@
22 " Language: LambdaProlog (Teyjus)
33 " Filenames: *.mod *.sig
44 " Maintainer: Markus Mottl <markus@oefai.at>
5-" URL: http://www.ai.univie.ac.at/~markus/vim/syntax/lprolog.vim
6-" Last Change: 2003 May 11
7-" 2001 Apr 26 - Upgraded for new Vim version
8-" 2000 Jun 5 - Initial release
5+" URL: http://www.oefai.at/~markus/vim/syntax/lprolog.vim
6+" Last Change: 2004 Jul 26
7+" 2001 Apr 26 - Upgraded for new Vim version
8+" 2000 Jun 5 - Initial release
99
1010 " For version 5.x: Clear all syntax items
1111 " For version 6.x: Quit when a syntax file was already loaded
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/syntax/ocaml.vim
--- a/runtime/syntax/ocaml.vim Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/syntax/ocaml.vim Mon Jul 26 12:53:41 2004 +0000
@@ -2,12 +2,12 @@
22 " Language: OCaml
33 " Filenames: *.ml *.mli *.mll *.mly
44 " Maintainers: Markus Mottl <markus@oefai.at>
5-" Karl-Heinz Sylla <Karl-Heinz.Sylla@gmd.de>
6-" Issac Trotts <<ijtrotts@ucdavis.edu>
7-" URL: http://www.oefai.at/~markus/vim/syntax/ocaml.vim
8-" Last Change: 2003 May 04
9-" 2002 Oct 24 - Small fix for "module type" (MM)
10-" 2002 Jun 16 - Added "&&", "<" and ">" as operators (MM)
5+" Karl-Heinz Sylla <Karl-Heinz.Sylla@gmd.de>
6+" Issac Trotts <ijtrotts@ucdavis.edu>
7+" URL: http://www.oefai.at/~markus/vim/syntax/ocaml.vim
8+" Last Change: 2004 Jul 26
9+" 2003 Jan 19 - Added keyword "require" for scripting (MM)
10+" 2002 Oct 30 - New variable "ocaml_revised" (MM)
1111
1212 " For version 5.x: Clear all syntax items
1313 " For version 6.x: Quit when a syntax file was already loaded
@@ -24,7 +24,7 @@
2424 syn match ocamlComment "^#!.*"
2525
2626 " Scripting directives
27-syn match ocamlScript "^#\<\(quit\|labels\|warnings\|directory\|cd\|load\|use\|install_printer\|remove_printer\|trace\|untrace\|untrace_all\|print_depth\|print_length\)\>"
27+syn match ocamlScript "^#\<\(quit\|labels\|warnings\|directory\|cd\|load\|use\|install_printer\|remove_printer\|require\|trace\|untrace\|untrace_all\|print_depth\|print_length\)\>"
2828
2929 " lowercase identifier - the standard way to match
3030 syn match ocamlLCIdentifier /\<\(\l\|_\)\(\w\|'\)*\>/
@@ -163,7 +163,7 @@
163163 syn match ocamlKeyChar "!"
164164 endif
165165
166-syn keyword ocamlType array bool char exn float format int
166+syn keyword ocamlType array bool char exn float format format4 int
167167 syn keyword ocamlType list option string unit
168168
169169 syn keyword ocamlOperator asr lor lsl lsr lxor mod not
diff -r a81bc802c17c -r 4ac1dce8dd5e runtime/syntax/sml.vim
--- a/runtime/syntax/sml.vim Mon Jul 19 20:55:54 2004 +0000
+++ b/runtime/syntax/sml.vim Mon Jul 26 12:53:41 2004 +0000
@@ -1,12 +1,12 @@
11 " Vim syntax file
22 " Language: SML
33 " Filenames: *.sml *.sig
4-" Maintainers: Markus Mottl <markus@oefai.at>
5-" Fabrizio Zeno Cornelli <zeno@filibusta.crema.unimi.it>
6-" URL: http://www.ai.univie.ac.at/~markus/vim/syntax/sml.vim
7-" Last Change: 2003 May 11
8-" 2001 Nov 20 - Fixed small highlighting bug with modules (MM)
9-" 2001 Aug 29 - Fixed small highlighting bug (MM)
4+" Maintainers: Markus Mottl <markus@oefai.at>
5+" Fabrizio Zeno Cornelli <zeno@filibusta.crema.unimi.it>
6+" URL: http://www.oefai.at/~markus/vim/syntax/sml.vim
7+" Last Change: 2004 Jul 26
8+" 2001 Nov 20 - Fixed small highlighting bug with modules (MM)
9+" 2001 Aug 29 - Fixed small highlighting bug (MM)
1010
1111 " For version 5.x: Clear all syntax items
1212 " For version 6.x: Quit when a syntax file was already loaded
diff -r a81bc802c17c -r 4ac1dce8dd5e src/Makefile
--- a/src/Makefile Mon Jul 19 20:55:54 2004 +0000
+++ b/src/Makefile Mon Jul 26 12:53:41 2004 +0000
@@ -1055,9 +1055,9 @@
10551055 NONE_INSTALL = install_normal
10561056
10571057 ### KDE GUI interface.
1058-KDE_SRC = gui.c pty.c gui_kde.cc gui_kde_x11.cc gui_kde_widget.cc gui_kde_widget_moc.cc kvim_iface_skel.cc
1058+KDE_SRC = gui.c pty.c gui_kde.cc gui_kde_x11.cc gui_kde_wid.cc gui_kde_wid_moc.cc kvim_iface_skel.cc
10591059 KDE_OBJ = objects/gui.o objects/pty.o objects/gui_kde.o objects/gui_kde_x11.o \
1060- objects/gui_kde_widget.o objects/gui_kde_widget_moc.o \
1060+ objects/gui_kde_wid.o objects/gui_kde_wid_moc.o \
10611061 objects/kvim_iface_skel.o
10621062 KDE_DEFS = -DFEAT_GUI_KDE $(NARROW_PROTO)
10631063 KDE_IPATH = $(GUI_INC_LOC)
@@ -1201,7 +1201,7 @@
12011201 CARBONGUI_TESTARG = VIMPROG=../$(CARBONGUI_BUNDLE)/Contents/MacOS/$(VIMTARGET)
12021202
12031203 # All GUI files
1204-ALL_GUI_SRC = gui.c gui_gtk.c gui_gtk_f.c gui_motif.c gui_athena.c gui_gtk_x11.c gui_x11.c gui_at_sb.c gui_at_fs.c pty.c gui_kde.cc gui_kde_widget.cc gui_kde_x11.cc gui_kde_widget_moc.cc
1204+ALL_GUI_SRC = gui.c gui_gtk.c gui_gtk_f.c gui_motif.c gui_athena.c gui_gtk_x11.c gui_x11.c gui_at_sb.c gui_at_fs.c pty.c gui_kde.cc gui_kde_wid.cc gui_kde_x11.cc gui_kde_wid_moc.cc
12051205 ALL_GUI_PRO = gui.pro gui_gtk.pro gui_motif.pro gui_athena.pro gui_gtk_x11.pro gui_x11.pro gui_w16.pro gui_w32.pro gui_amiga.pro gui_photon.pro gui_kde.pro gui_kde_x11.pro
12061206
12071207 # }}}
@@ -2038,7 +2038,7 @@
20382038 -rm -f $(TOOLS) auto/osdef.h auto/pathdef.c auto/if_perl.c
20392039 -rm -f conftest* *~ auto/link.sed
20402040 -rm -rf $(GUI_BUNDLE)
2041- -rm -f gui_kde_widget_moc.cc kvim_iface_skel.cc *.kidl
2041+ -rm -f gui_kde_wid_moc.cc kvim_iface_skel.cc *.kidl
20422042 if test -d $(PODIR); then \
20432043 cd $(PODIR); $(MAKE) prefix=$(DESTDIR)$(prefix) clean; \
20442044 fi
@@ -2393,17 +2393,17 @@
23932393 objects/gui_kde_x11.o: gui_kde_x11.cc
23942394 $(CCC) -o $@ gui_kde_x11.cc
23952395
2396-objects/gui_kde_widget.o: gui_kde_widget.cc
2397- $(MOC) -o gui_kde_widget_moc.cc gui_kde_widget.h
2396+objects/gui_kde_wid.o: gui_kde_wid.cc
2397+ $(MOC) -o gui_kde_wid_moc.cc gui_kde_wid.h
23982398 $(KDE_DIR)/bin/dcopidl kvim_iface.h > kvim_iface.kidl || ( rm -f kvim_iface.kidl ; /bin/false )
23992399 $(KDE_DIR)/bin/dcopidl2cpp --c++-suffix cc --no-stub kvim_iface.kidl
2400- $(CCC) -o $@ gui_kde_widget.cc
2401-
2402-gui_kde_widget_moc.cc: objects/gui_kde_widget.o
2403-objects/gui_kde_widget_moc.o: gui_kde_widget_moc.cc
2404- $(CCC) -o $@ gui_kde_widget_moc.cc
2405-
2406-kvim_iface_skel.cc: objects/gui_kde_widget.o
2400+ $(CCC) -o $@ gui_kde_wid.cc
2401+
2402+gui_kde_wid_moc.cc: objects/gui_kde_wid.o
2403+objects/gui_kde_wid_moc.o: gui_kde_wid_moc.cc
2404+ $(CCC) -o $@ gui_kde_wid_moc.cc
2405+
2406+kvim_iface_skel.cc: objects/gui_kde_wid.o
24072407 objects/kvim_iface_skel.o: kvim_iface_skel.cc
24082408 $(CCC) -o $@ kvim_iface_skel.cc
24092409
@@ -2716,21 +2716,21 @@
27162716 ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \
27172717 proto/gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \
27182718 arabic.h
2719-objects/gui_kde.o: gui_kde.cc gui_kde_widget.h kvim_iface.h vim.h \
2719+objects/gui_kde.o: gui_kde.cc gui_kde_wid.h kvim_iface.h vim.h \
27202720 auto/config.h feature.h os_unix.h auto/osdef.h ascii.h keymap.h \
27212721 term.h macros.h structs.h regexp.h gui.h option.h ex_cmds.h proto.h \
27222722 globals.h farsi.h
2723-objects/gui_kde_widget.o: gui_kde_widget.cc gui_kde_widget.h kvim_iface.h \
2723+objects/gui_kde_wid.o: gui_kde_wid.cc gui_kde_wid.h kvim_iface.h \
27242724 vim.h auto/config.h feature.h os_unix.h auto/osdef.h ascii.h keymap.h \
27252725 term.h macros.h structs.h regexp.h gui.h option.h ex_cmds.h proto.h \
27262726 globals.h farsi.h proto/../../pixmaps/alert.xpm proto/../../pixmaps/error.xpm \
27272727 proto/../../pixmaps/generic.xpm proto/../../pixmaps/info.xpm \
27282728 proto/../../pixmaps/quest.xpm
2729-objects/gui_kde_x11.o: gui_kde_x11.cc gui_kde_widget.h kvim_iface.h vim.h \
2729+objects/gui_kde_x11.o: gui_kde_x11.cc gui_kde_wid.h kvim_iface.h vim.h \
27302730 auto/config.h feature.h os_unix.h auto/osdef.h ascii.h keymap.h \
27312731 term.h macros.h structs.h regexp.h gui.h option.h ex_cmds.h proto.h \
27322732 globals.h farsi.h version.h ../runtime/vim32x32.xpm
2733-objects/gui_kde_widget_moc.o: gui_kde_widget_moc.cc gui_kde_widget.h \
2733+objects/gui_kde_wid_moc.o: gui_kde_wid_moc.cc gui_kde_wid.h \
27342734 kvim_iface.h vim.h auto/config.h feature.h os_unix.h auto/osdef.h \
27352735 ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h option.h \
27362736 ex_cmds.h proto.h globals.h
diff -r a81bc802c17c -r 4ac1dce8dd5e src/buffer.c
--- a/src/buffer.c Mon Jul 19 20:55:54 2004 +0000
+++ b/src/buffer.c Mon Jul 26 12:53:41 2004 +0000
@@ -216,6 +216,12 @@
216216 #endif
217217 curbuf->b_flags |= BF_READERR;
218218
219+#ifdef FEAT_FOLDING
220+ /* Need to update automatic folding. Do this before the autocommands,
221+ * they may use the fold info. */
222+ foldUpdateAll(curwin);
223+#endif
224+
219225 #ifdef FEAT_AUTOCMD
220226 /* need to set w_topline, unless some autocommand already did that. */
221227 if (!(curwin->w_valid & VALID_TOPLINE))
@@ -263,11 +269,6 @@
263269 #endif
264270 }
265271
266-#ifdef FEAT_FOLDING
267- /* Need to update automatic folding. */
268- foldUpdateAll(curwin);
269-#endif
270-
271272 return retval;
272273 }
273274
@@ -408,8 +409,7 @@
408409 if (!buf_valid(buf))
409410 return;
410411 # ifdef FEAT_EVAL
411- /* Autocommands may abort script processing. */
412- if (aborting())
412+ if (aborting()) /* autocmds may abort script processing */
413413 return;
414414 # endif
415415
@@ -538,7 +538,8 @@
538538 return;
539539 }
540540 # ifdef FEAT_EVAL
541- if (aborting()) /* autocmds may abort script processing */
541+ /* autocmds may abort script processing */
542+ if (aborting())
542543 return;
543544 # endif
544545
@@ -669,8 +670,16 @@
669670 && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG))
670671 if (swap_exists_action == SEA_QUIT && *eap->cmd == 's')
671672 {
672- /* Quitting means closing the split window, nothing else. */
673+ int old_got_int = got_int;
674+
675+ /* Quitting means closing the split window, nothing else.
676+ * Reset got_int here, because it causes aborting() to return TRUE
677+ * which breaks closing a window. */
678+ got_int = FALSE;
679+
673680 win_close(curwin, TRUE);
681+
682+ got_int |= old_got_int;
674683 swap_exists_action = SEA_NONE;
675684 }
676685 else
@@ -688,6 +697,12 @@
688697 handle_swap_exists(old_curbuf)
689698 buf_T *old_curbuf;
690699 {
700+ int old_got_int = got_int;
701+
702+ /* Reset got_int here, because it causes aborting() to return TRUE which
703+ * breaks closing a buffer. */
704+ got_int = FALSE;
705+
691706 if (swap_exists_action == SEA_QUIT)
692707 {
693708 /* User selected Quit at ATTENTION prompt. Go back to previous
@@ -712,6 +727,7 @@
712727 do_modelines();
713728 }
714729 swap_exists_action = SEA_NONE;
730+ got_int |= old_got_int;
715731 }
716732 #endif
717733
@@ -4226,26 +4242,28 @@
42264242 #endif
42274243 set_curbuf(buf, DOBUF_GOTO);
42284244 #ifdef FEAT_AUTOCMD
4229-# ifdef FEAT_EVAL
4230- /* Autocommands deleted the buffer or aborted script
4231- * processing!!! */
4232- if (!buf_valid(buf) || aborting())
4233-# else
42344245 if (!buf_valid(buf)) /* autocommands deleted the buffer!!! */
4235-# endif
42364246 {
4237-#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
4247+# if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
42384248 swap_exists_action = SEA_NONE;
4239-#endif
4249+# endif
42404250 break;
42414251 }
42424252 #endif
42434253 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
42444254 if (swap_exists_action == SEA_QUIT)
42454255 {
4246- /* User selected Quit at ATTENTION prompt; close this window. */
4256+ int old_got_int = got_int;
4257+
4258+ /* User selected Quit at ATTENTION prompt; close this window.
4259+ * Reset got_int here, because it causes aborting() to return
4260+ * TRUE which breaks closing a window. */
4261+ got_int = FALSE;
4262+
42474263 win_close(curwin, TRUE);
42484264 --open_wins;
4265+
4266+ got_int |= old_got_int;
42494267 swap_exists_action = SEA_NONE;
42504268 }
42514269 else
@@ -4259,6 +4277,11 @@
42594277 (void)vgetc(); /* only break the file loading, not the rest */
42604278 break;
42614279 }
4280+#ifdef FEAT_EVAL
4281+ /* Autocommands deleted the buffer or aborted script processing!!! */
4282+ if (aborting())
4283+ break;
4284+#endif
42624285 }
42634286 #ifdef FEAT_AUTOCMD
42644287 --autocmd_no_enter;
diff -r a81bc802c17c -r 4ac1dce8dd5e src/edit.c
--- a/src/edit.c Mon Jul 19 20:55:54 2004 +0000
+++ b/src/edit.c Mon Jul 26 12:53:41 2004 +0000
@@ -2641,7 +2641,7 @@
26412641
26422642 #ifdef FEAT_COMPL_FUNC
26432643 static char_u *call_completefunc __ARGS((char_u *line, char_u *base, int col, int preproc));
2644-static int expand_by_function __ARGS((int lnum, int col, char_u *base, char_u ***matches));
2644+static int expand_by_function __ARGS((linenr_T lnum, int col, char_u *base, char_u ***matches));
26452645
26462646 /*
26472647 * Execute user defined complete function 'completefunc'.
@@ -2665,7 +2665,7 @@
26652665 args[0] = line;
26662666 args[1] = base;
26672667 args[2] = colbuf;
2668- args[3] = preproc ? "1" : "0";
2668+ args[3] = (char_u *)(preproc ? "1" : "0");
26692669 return call_vim_function(curbuf->b_p_cfu, 4, args, FALSE);
26702670 }
26712671
@@ -2676,7 +2676,7 @@
26762676 */
26772677 static int
26782678 expand_by_function(lnum, col, base, matches)
2679- int lnum;
2679+ linenr_T lnum;
26802680 int col;
26812681 char_u *base;
26822682 char_u ***matches;
@@ -3528,7 +3528,7 @@
35283528 lenstr = call_completefunc(line, NULL, complete_col, 1);
35293529 if (lenstr == NULL)
35303530 return FAIL;
3531- keeplen = atoi(lenstr);
3531+ keeplen = atoi((char *)lenstr);
35323532 vim_free(lenstr);
35333533 if (keeplen < 0)
35343534 return FAIL;
diff -r a81bc802c17c -r 4ac1dce8dd5e src/eval.c
--- a/src/eval.c Mon Jul 19 20:55:54 2004 +0000
+++ b/src/eval.c Mon Jul 26 12:53:41 2004 +0000
@@ -295,8 +295,10 @@
295295 static void f_getcmdline __ARGS((VAR argvars, VAR retvar));
296296 static void f_getcmdpos __ARGS((VAR argvars, VAR retvar));
297297 static void f_getcwd __ARGS((VAR argvars, VAR retvar));
298+static void f_getfperm __ARGS((VAR argvars, VAR retvar));
298299 static void f_getfsize __ARGS((VAR argvars, VAR retvar));
299300 static void f_getftime __ARGS((VAR argvars, VAR retvar));
301+static void f_getftype __ARGS((VAR argvars, VAR retvar));
300302 static void f_getline __ARGS((VAR argvars, VAR retvar));
301303 static void f_getreg __ARGS((VAR argvars, VAR retvar));
302304 static void f_getregtype __ARGS((VAR argvars, VAR retvar));
@@ -751,7 +753,7 @@
751753 if (argv[i] == NULL || *argv[i] == NUL)
752754 {
753755 argvars[i].var_type = VAR_STRING;
754- argvars[i].var_val.var_string = "";
756+ argvars[i].var_val.var_string = (char_u *)"";
755757 continue;
756758 }
757759
@@ -2853,8 +2855,10 @@
28532855 {"getcmdline", 0, 0, f_getcmdline},
28542856 {"getcmdpos", 0, 0, f_getcmdpos},
28552857 {"getcwd", 0, 0, f_getcwd},
2858+ {"getfperm", 1, 1, f_getfperm},
28562859 {"getfsize", 1, 1, f_getfsize},
28572860 {"getftime", 1, 1, f_getftime},
2861+ {"getftype", 1, 1, f_getftype},
28582862 {"getline", 1, 1, f_getline},
28592863 {"getreg", 0, 1, f_getreg},
28602864 {"getregtype", 0, 1, f_getregtype},
@@ -2941,7 +2945,7 @@
29412945 {"wincol", 0, 0, f_wincol},
29422946 {"winheight", 1, 1, f_winheight},
29432947 {"winline", 0, 0, f_winline},
2944- {"winnr", 0, 0, f_winnr},
2948+ {"winnr", 0, 1, f_winnr},
29452949 {"winrestcmd", 0, 0, f_winrestcmd},
29462950 {"winwidth", 1, 1, f_winwidth},
29472951 };
@@ -4578,6 +4582,38 @@
45784582 }
45794583
45804584 /*
4585+ * "getfperm({fname})" function
4586+ */
4587+ static void
4588+f_getfperm(argvars, retvar)
4589+ VAR argvars;
4590+ VAR retvar;
4591+{
4592+ char_u *fname;
4593+ struct stat st;
4594+ char_u *perm = NULL;
4595+ char_u flags[] = "rwx";
4596+ int i;
4597+
4598+ fname = get_var_string(&argvars[0]);
4599+
4600+ retvar->var_type = VAR_STRING;
4601+ if (mch_stat((char *)fname, &st) >= 0)
4602+ {
4603+ perm = vim_strsave((char_u *)"---------");
4604+ if (perm != NULL)
4605+ {
4606+ for (i = 0; i < 9; i++)
4607+ {
4608+ if (st.st_mode & (1 << (8 - i)))
4609+ perm[i] = flags[i % 3];
4610+ }
4611+ }
4612+ }
4613+ retvar->var_val.var_string = perm;
4614+}
4615+
4616+/*
45814617 * "getfsize({fname})" function
45824618 */
45834619 static void
@@ -4623,6 +4659,86 @@
46234659 }
46244660
46254661 /*
4662+ * "getftype({fname})" function
4663+ */
4664+ static void
4665+f_getftype(argvars, retvar)
4666+ VAR argvars;
4667+ VAR retvar;
4668+{
4669+ char_u *fname;
4670+ struct stat st;
4671+ char_u *type = NULL;
4672+ char *t;
4673+
4674+ fname = get_var_string(&argvars[0]);
4675+
4676+ retvar->var_type = VAR_STRING;
4677+ if (mch_lstat((char *)fname, &st) >= 0)
4678+ {
4679+#ifdef S_ISREG
4680+ if (S_ISREG(st.st_mode))
4681+ t = "file";
4682+ else if (S_ISDIR(st.st_mode))
4683+ t = "dir";
4684+# ifdef S_ISLNK
4685+ else if (S_ISLNK(st.st_mode))
4686+ t = "link";
4687+# endif
4688+# ifdef S_ISBLK
4689+ else if (S_ISBLK(st.st_mode))
4690+ t = "bdev";
4691+# endif
4692+# ifdef S_ISCHR
4693+ else if (S_ISCHR(st.st_mode))
4694+ t = "cdev";
4695+# endif
4696+# ifdef S_ISFIFO
4697+ else if (S_ISFIFO(st.st_mode))
4698+ t = "fifo";
4699+# endif
4700+# ifdef S_ISSOCK
4701+ else if (S_ISSOCK(st.st_mode))
4702+ t = "fifo";
4703+# endif
4704+ else
4705+ t = "other";
4706+#else
4707+# ifdef S_IFMT
4708+ switch (st.st_mode & S_IFMT)
4709+ {
4710+ case S_IFREG: t = "file"; break;
4711+ case S_IFDIR: t = "dir"; break;
4712+# ifdef S_IFLNK
4713+ case S_IFLNK: t = "link"; break;
4714+# endif
4715+# ifdef S_IFBLK
4716+ case S_IFBLK: t = "bdev"; break;
4717+# endif
4718+# ifdef S_IFCHR
4719+ case S_IFCHR: t = "cdev"; break;
4720+# endif
4721+# ifdef S_IFIFO
4722+ case S_IFIFO: t = "fifo"; break;
4723+# endif
4724+# ifdef S_IFSOCK
4725+ case S_IFSOCK: t = "socket"; break;
4726+# endif
4727+ default: t = "other";
4728+ }
4729+# else
4730+ if (mch_isdir(fname))
4731+ t = "dir";
4732+ else
4733+ t = "file";
4734+# endif
4735+#endif
4736+ type = vim_strsave((char_u *)t);
4737+ }
4738+ retvar->var_val.var_string = type;
4739+}
4740+
4741+/*
46264742 * "getreg()" function
46274743 */
46284744 static void
@@ -6305,6 +6421,10 @@
63056421 retvar->var_type = VAR_STRING;
63066422 }
63076423
6424+#define SP_NOMOVE 1 /* don't move cursor */
6425+#define SP_REPEAT 2 /* repeat to find outer pair */
6426+#define SP_RETCOUNT 4 /* return matchcount */
6427+
63086428 /*
63096429 * "search()" function
63106430 */
@@ -6315,13 +6435,24 @@
63156435 {
63166436 char_u *pat;
63176437 pos_T pos;
6438+ pos_T save_cursor;
63186439 int save_p_ws = p_ws;
63196440 int dir;
6441+ int flags = 0;
6442+
6443+ retvar->var_val.var_number = 0; /* default: FAIL */
63206444
63216445 pat = get_var_string(&argvars[0]);
6322- dir = get_search_arg(&argvars[1], NULL); /* may set p_ws */
6323-
6324- pos = curwin->w_cursor;
6446+ dir = get_search_arg(&argvars[1], &flags); /* may set p_ws */
6447+ if (dir == 0)
6448+ goto theend;
6449+ if ((flags & ~SP_NOMOVE) != 0)
6450+ {
6451+ EMSG2(_(e_invarg2), get_var_string(&argvars[1]));
6452+ goto theend;
6453+ }
6454+
6455+ pos = save_cursor = curwin->w_cursor;
63256456 if (searchit(curwin, curbuf, &pos, dir, pat, 1L,
63266457 SEARCH_KEEP, RE_SEARCH) != FAIL)
63276458 {
@@ -6331,15 +6462,14 @@
63316462 * correct that here */
63326463 check_cursor();
63336464 }
6334- else
6335- retvar->var_val.var_number = 0;
6465+
6466+ /* If 'n' flag is used: restore cursor position. */
6467+ if (flags & SP_NOMOVE)
6468+ curwin->w_cursor = save_cursor;
6469+theend:
63366470 p_ws = save_p_ws;
63376471 }
63386472
6339-#define SP_NOMOVE 1 /* don't move cursor */
6340-#define SP_REPEAT 2 /* repeat to find outer pair */
6341-#define SP_RETCOUNT 4 /* return matchcount */
6342-
63436473 /*
63446474 * "searchpair()" function
63456475 */
@@ -6393,6 +6523,8 @@
63936523
63946524 /* Handle the optional fourth argument: flags */
63956525 dir = get_search_arg(&argvars[3], &flags); /* may set p_ws */
6526+ if (dir == 0)
6527+ goto theend;
63966528
63976529 /* Optional fifth argument: skip expresion */
63986530 if (argvars[3].var_type == VAR_UNKNOWN
@@ -6474,6 +6606,11 @@
64746606 p_cpo = save_cpo;
64756607 }
64766608
6609+/*
6610+ * Get flags for a search function.
6611+ * Possibly sets "p_ws".
6612+ * Returns BACKWARD, FORWARD or zero (for an error).
6613+ */
64776614 static int
64786615 get_search_arg(varp, flagsp)
64796616 VAR varp;
@@ -6482,24 +6619,37 @@
64826619 int dir = FORWARD;
64836620 char_u *flags;
64846621 char_u nbuf[NUMBUFLEN];
6622+ int mask;
64856623
64866624 if (varp->var_type != VAR_UNKNOWN)
64876625 {
64886626 flags = get_var_string_buf(varp, nbuf);
6489- if (vim_strchr(flags, 'b') != NULL)
6490- dir = BACKWARD;
6491- if (vim_strchr(flags, 'w') != NULL)
6492- p_ws = TRUE;
6493- if (vim_strchr(flags, 'W') != NULL)
6494- p_ws = FALSE;
6495- if (flagsp != NULL)
6496- {
6497- if (vim_strchr(flags, 'n') != NULL)
6498- *flagsp |= SP_NOMOVE;
6499- if (vim_strchr(flags, 'r') != NULL)
6500- *flagsp |= SP_REPEAT;
6501- if (vim_strchr(flags, 'm') != NULL)
6502- *flagsp |= SP_RETCOUNT;
6627+ while (*flags != NUL)
6628+ {
6629+ switch (*flags)
6630+ {
6631+ case 'b': dir = BACKWARD; break;
6632+ case 'w': p_ws = TRUE; break;
6633+ case 'W': p_ws = FALSE; break;
6634+ default: mask = 0;
6635+ if (flagsp != NULL)
6636+ switch (*flags)
6637+ {
6638+ case 'n': mask = SP_NOMOVE; break;
6639+ case 'r': mask = SP_REPEAT; break;
6640+ case 'm': mask = SP_RETCOUNT; break;
6641+ }
6642+ if (mask == 0)
6643+ {
6644+ EMSG2(_(e_invarg2), flags);
6645+ dir = 0;
6646+ }
6647+ else
6648+ *flagsp |= mask;
6649+ }
6650+ if (dir == 0)
6651+ break;
6652+ ++flags;
65036653 }
65046654 }
65056655 return dir;
@@ -7648,7 +7798,9 @@
76487798 /* not multi-byte: fromstr and tostr must be the same length */
76497799 if (STRLEN(fromstr) != STRLEN(tostr))
76507800 {
7801+#ifdef FEAT_MBYTE
76517802 error:
7803+#endif
76527804 EMSG2(_(e_invarg2), fromstr);
76537805 ga_clear(&ga);
76547806 return;
@@ -7859,9 +8011,30 @@
78598011 int nr = 1;
78608012 #ifdef FEAT_WINDOWS
78618013 win_T *wp;
7862-
7863- for (wp = firstwin; wp != curwin; wp = wp->w_next)
7864- ++nr;
8014+ win_T *twin = curwin;
8015+ char_u *arg;
8016+
8017+ if (argvars[0].var_type != VAR_UNKNOWN)
8018+ {
8019+ arg = get_var_string(&argvars[0]);
8020+ if (STRCMP(arg, "$") == 0)
8021+ twin = lastwin;
8022+ else if (STRCMP(arg, "#") == 0)
8023+ {
8024+ twin = prevwin;
8025+ if (prevwin == NULL)
8026+ nr = 0;
8027+ }
8028+ else
8029+ {
8030+ EMSG2(_(e_invexpr2), arg);
8031+ nr = 0;
8032+ }
8033+ }
8034+
8035+ if (nr > 0)
8036+ for (wp = firstwin; wp != twin; wp = wp->w_next)
8037+ ++nr;
78658038 #endif
78668039 retvar->var_val.var_number = nr;
78678040 }
diff -r a81bc802c17c -r 4ac1dce8dd5e src/ex_cmds2.c
--- a/src/ex_cmds2.c Mon Jul 19 20:55:54 2004 +0000
+++ b/src/ex_cmds2.c Mon Jul 26 12:53:41 2004 +0000
@@ -3806,6 +3806,7 @@
38063806 {"Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique"}
38073807 };
38083808
3809+#ifdef FEAT_MBYTE
38093810 /* Generic font metrics for multi-byte fonts */
38103811 static struct prt_ps_font_S prt_ps_mb_font =
38113812 {
@@ -3814,6 +3815,7 @@
38143815 -250, 805,
38153816 {NULL, NULL, NULL, NULL}
38163817 };
3818+#endif
38173819
38183820 /* Pointer to current font set being used */
38193821 static struct prt_ps_font_S* prt_ps_font;
@@ -3822,8 +3824,8 @@
38223824 * building CID font name */
38233825 struct prt_ps_encoding_S
38243826 {
3825- char_u *encoding;
3826- char_u *cmap_encoding;
3827+ char *encoding;
3828+ char *cmap_encoding;
38273829 int needs_charset;
38283830 };
38293831
@@ -3834,6 +3836,8 @@
38343836 int has_charset;
38353837 };
38363838
3839+#ifdef FEAT_MBYTE
3840+
38373841 #define CS_JIS_C_1978 (0x01)
38383842 #define CS_JIS_X_1983 (0x02)
38393843 #define CS_JIS_X_1990 (0x04)
@@ -4017,6 +4021,7 @@
40174021 "KS_X_1992"
40184022 }
40194023 };
4024+#endif /* FEAT_MBYTE */
40204025
40214026 struct prt_ps_resource_S
40224027 {
@@ -4076,7 +4081,7 @@
40764081
40774082 struct prt_dsc_comment_S
40784083 {
4079- char_u *string;
4084+ char *string;
40804085 int len;
40814086 int type;
40824087 };
@@ -4092,11 +4097,11 @@
40924097 #define SIZEOF_CSTR(s) (sizeof(s) - 1)
40934098 struct prt_dsc_comment_S prt_dsc_table[] =
40944099 {
4095- {PRT_DSC_TITLE, SIZEOF_CSTR(PRT_DSC_TITLE), PRT_DSC_TITLE_TYPE},
4100+ {PRT_DSC_TITLE, SIZEOF_CSTR(PRT_DSC_TITLE), PRT_DSC_TITLE_TYPE},
40964101 {PRT_DSC_VERSION, SIZEOF_CSTR(PRT_DSC_VERSION),
4097- PRT_DSC_VERSION_TYPE},
4102+ PRT_DSC_VERSION_TYPE},
40984103 {PRT_DSC_ENDCOMMENTS, SIZEOF_CSTR(PRT_DSC_ENDCOMMENTS),
4099- PRT_DSC_ENDCOMMENTS_TYPE}
4104+ PRT_DSC_ENDCOMMENTS_TYPE}
41004105 };
41014106
41024107 static void prt_write_file_raw_len __ARGS((char_u *buffer, int bytes));
@@ -4135,6 +4140,7 @@
41354140 static int prt_resfile_skip_ws __ARGS((int offset));
41364141 static int prt_next_dsc __ARGS((struct prt_dsc_line_S *p_dsc_line));
41374142 #ifdef FEAT_MBYTE
4143+static int prt_build_cid_fontname __ARGS((int font, char_u *name, int name_len));
41384144 static void prt_def_cidfont __ARGS((char *new_name, int height, char *cidfont));
41394145 static int prt_match_encoding __ARGS((char *p_encoding, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_encoding_S **pp_mbenc));
41404146 static int prt_match_charset __ARGS((char *p_charset, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_charset_S **pp_mbchar));
@@ -5097,15 +5103,16 @@
50975103 return (int)((prt_right_margin - prt_left_margin) / prt_char_width);
50985104 }
50995105
5106+#ifdef FEAT_MBYTE
51005107 static int
51015108 prt_build_cid_fontname(font, name, name_len)
51025109 int font;
5103- char *name;
5110+ char_u *name;
51045111 int name_len;
51055112 {
51065113 char *fontname;
51075114
5108- fontname = alloc(name_len + 1);
5115+ fontname = (char *)alloc(name_len + 1);
51095116 if (fontname == NULL)
51105117 return FALSE;
51115118 STRNCPY(fontname, name, name_len);
@@ -5114,6 +5121,7 @@
51145121
51155122 return TRUE;
51165123 }
5124+#endif
51175125
51185126 /*
51195127 * Get number of lines of text that fit on a page (excluding the header).
@@ -5152,13 +5160,13 @@
51525160 #ifdef FEAT_MBYTE
51535161 static int
51545162 prt_match_encoding(p_encoding, p_cmap, pp_mbenc)
5155- char *p_encoding;
5156- struct prt_ps_mbfont_S *p_cmap;
5157- struct prt_ps_encoding_S **pp_mbenc;
5158-{
5159- int mbenc;
5160- int enc_len;
5161- struct prt_ps_encoding_S *p_mbenc;
5163+ char *p_encoding;
5164+ struct prt_ps_mbfont_S *p_cmap;
5165+ struct prt_ps_encoding_S **pp_mbenc;
5166+{
5167+ int mbenc;
5168+ int enc_len;
5169+ struct prt_ps_encoding_S *p_mbenc;
51625170
51635171 *pp_mbenc = NULL;
51645172 /* Look for recognised encoding */
@@ -5178,12 +5186,12 @@
51785186
51795187 static int
51805188 prt_match_charset(p_charset, p_cmap, pp_mbchar)
5181- char *p_charset;
5182- struct prt_ps_mbfont_S *p_cmap;
5189+ char *p_charset;
5190+ struct prt_ps_mbfont_S *p_cmap;
51835191 struct prt_ps_charset_S **pp_mbchar;
51845192 {
5185- int mbchar;
5186- int char_len;
5193+ int mbchar;
5194+ int char_len;
51875195 struct prt_ps_charset_S *p_mbchar;
51885196
51895197 /* Look for recognised character set, using default if one is not given */
@@ -5226,7 +5234,7 @@
52265234 char_u *p_encoding;
52275235 struct prt_ps_encoding_S *p_mbenc;
52285236 struct prt_ps_encoding_S *p_mbenc_first;
5229- struct prt_ps_charset_S *p_mbchar;
5237+ struct prt_ps_charset_S *p_mbchar;
52305238 #endif
52315239
52325240 #if 0
@@ -5262,11 +5270,13 @@
52625270 p_mbenc_first = NULL;
52635271 p_mbchar = NULL;
52645272 for (cmap = 0; cmap < NUM_ELEMENTS(prt_ps_mbfonts); cmap++)
5265- if (prt_match_encoding(p_encoding, &prt_ps_mbfonts[cmap], &p_mbenc))
5273+ if (prt_match_encoding((char *)p_encoding, &prt_ps_mbfonts[cmap],
5274+ &p_mbenc))
52665275 {
52675276 if (p_mbenc_first == NULL)
52685277 p_mbenc_first = p_mbenc;
5269- if (prt_match_charset(p_pmcs, &prt_ps_mbfonts[cmap], &p_mbchar))
5278+ if (prt_match_charset((char *)p_pmcs, &prt_ps_mbfonts[cmap],
5279+ &p_mbchar))
52705280 break;
52715281 }
52725282
@@ -5343,8 +5353,8 @@
53435353 return FALSE;
53445354 if (mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].present)
53455355 if (!prt_build_cid_fontname(PRT_PS_FONT_BOLDOBLIQUE,
5346- mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].string,
5347- mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].strlen))
5356+ mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].string,
5357+ mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].strlen))
53485358 return FALSE;
53495359
53505360 /* Check if need to use Courier for ASCII code range, and if so pick up
@@ -5555,8 +5565,8 @@
55555565 EMSG2(_("E456: Can't open file \"%s\""), resource->filename);
55565566 return FALSE;
55575567 }
5558- prt_dsc_resources("BeginResource",
5559- prt_resource_types[resource->type], resource->title);
5568+ prt_dsc_resources("BeginResource", prt_resource_types[resource->type],
5569+ (char *)resource->title);
55605570
55615571 prt_dsc_textline("BeginDocument", (char *)resource->filename);
55625572
@@ -5602,7 +5612,7 @@
56025612 double bottom;
56035613 struct prt_ps_resource_S res_prolog;
56045614 struct prt_ps_resource_S res_encoding;
5605- char_u buffer[256];
5615+ char buffer[256];
56065616 char_u *p_encoding;
56075617 #ifdef FEAT_MBYTE
56085618 struct prt_ps_resource_S res_cidfont;
@@ -5614,7 +5624,7 @@
56145624 */
56155625 prt_dsc_start();
56165626 prt_dsc_textline("Title", (char *)psettings->jobname);
5617- if (!get_user_name(buffer, 256))
5627+ if (!get_user_name((char_u *)buffer, 256))
56185628 STRCPY(buffer, "Unknown");
56195629 prt_dsc_textline("For", buffer);
56205630 prt_dsc_textline("Creator", VIM_VERSION_LONG);
@@ -5757,7 +5767,7 @@
57575767 if (!prt_find_resource(prt_ascii_encoding, &res_encoding))
57585768 {
57595769 EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
5760- prt_ascii_encoding);
5770+ prt_ascii_encoding);
57615771 return FALSE;
57625772 }
57635773 if (!prt_open_resource(&res_encoding))
@@ -5786,7 +5796,7 @@
57865796 if (!prt_find_resource(prt_cmap, &res_cmap))
57875797 {
57885798 EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
5789- prt_cmap);
5799+ prt_cmap);
57905800 return FALSE;
57915801 }
57925802 if (!prt_open_resource(&res_cmap))
@@ -5911,7 +5921,7 @@
59115921 /* When using Courier for ASCII range when printing multi-byte, need to
59125922 * pick up ASCII encoding to use with it. */
59135923 if (prt_use_courier)
5914- p_encoding = prt_ascii_encoding;
5924+ p_encoding = (char_u *)prt_ascii_encoding;
59155925 #endif
59165926 prt_dsc_resources("IncludeResource", "font",
59175927 prt_ps_courier_font.ps_fontname[PRT_PS_FONT_ROMAN]);
@@ -6015,7 +6025,7 @@
60156025
60166026 /* Write CTRL-D to close serial communication link if used.
60176027 * NOTHING MUST BE WRITTEN AFTER THIS! */
6018- prt_write_file(IF_EB("\004", "\067"));
6028+ prt_write_file((char_u *)IF_EB("\004", "\067"));
60196029
60206030 if (!prt_file_error && psettings->outfile == NULL
60216031 && !got_int && !psettings->user_abort)
@@ -6274,7 +6284,7 @@
62746284 */
62756285 do
62766286 {
6277- ch = prt_hexchar[(*p) >> 4];
6287+ ch = prt_hexchar[(unsigned)(*p) >> 4];
62786288 ga_append(&prt_ps_buffer, ch);
62796289 ch = prt_hexchar[(*p) & 0xf];
62806290 ga_append(&prt_ps_buffer, ch);
diff -r a81bc802c17c -r 4ac1dce8dd5e src/gui_kde.cc
--- a/src/gui_kde.cc Mon Jul 19 20:55:54 2004 +0000
+++ b/src/gui_kde.cc Mon Jul 26 12:53:41 2004 +0000
@@ -29,7 +29,7 @@
2929 #include <qmessagebox.h>
3030 #include <qiconset.h>
3131 #include <qtextcodec.h>
32-#include "gui_kde_widget.h"
32+#include "gui_kde_wid.h"
3333
3434 extern "C" {
3535 #include "vim.h"
diff -r a81bc802c17c -r 4ac1dce8dd5e src/gui_kde_wid.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gui_kde_wid.cc Mon Jul 26 12:53:41 2004 +0000
@@ -0,0 +1,1449 @@
1+/* vi:set ts=8 sts=4 sw=4:
2+ *
3+ * VIM - Vi IMproved by Bram Moolenaar
4+ *
5+ * Do ":help uganda" in Vim to read copying and usage conditions.
6+ * Do ":help credits" in Vim to see a list of people who contributed.
7+ */
8+
9+/*
10+ * Porting to KDE(2) was done by
11+ *
12+ * (C) 2000 by Thomas Capricelli <orzel@freehackers.org>
13+ *
14+ * Please visit http://freehackers.org/kvim for other vim- or
15+ * kde-related coding.
16+ *
17+ * $Id$
18+ *
19+ */
20+
21+#include <assert.h>
22+#include <qpainter.h>
23+#include <qevent.h>
24+#include <qpushbutton.h>
25+#include <qscrollbar.h>
26+#include <qlayout.h>
27+#include <qclipboard.h>
28+#include <qdragobject.h>
29+#include <qstrlist.h>
30+#include <qmenubar.h>
31+#include <qtextcodec.h>
32+#if QT_VERSION>=300
33+#include <qptrlist.h>
34+#include <ktip.h>
35+#endif
36+#include <kglobal.h>
37+#include <kconfig.h>
38+#include <kaboutapplication.h>
39+#include <dcopclient.h>
40+#include <kaboutkde.h>
41+#include <kbugreport.h>
42+#include <kurldrag.h>
43+#include <kmenubar.h>
44+#include <ktoolbar.h>
45+#include <kstandarddirs.h>
46+#include "gui_kde_wid.h"
47+#include <qxembed.h>
48+
49+extern "C"
50+{
51+#include "version.h"
52+}
53+
54+// Pixmap for dialog
55+#ifdef FEAT_GUI_DIALOG
56+# include "../../pixmaps/alert.xpm"
57+# include "../../pixmaps/error.xpm"
58+# include "../../pixmaps/generic.xpm"
59+# include "../../pixmaps/info.xpm"
60+# include "../../pixmaps/quest.xpm"
61+#endif
62+
63+/**
64+ * Keycodes recognized by vim.
65+ */
66+struct special_key {//{{{
67+ int qtkey;
68+ char_u code0;
69+ char_u code1;
70+} special_keys[] =
71+{
72+ { Qt::Key_Up, 'k', 'u' },
73+ { Qt::Key_Down, 'k', 'd' },
74+ { Qt::Key_Left, 'k', 'l' },
75+ { Qt::Key_Right, 'k', 'r' },
76+ { Qt::Key_F1, 'k', '1' },
77+ { Qt::Key_F2, 'k', '2' },
78+ { Qt::Key_F3, 'k', '3' },
79+ { Qt::Key_F4, 'k', '4' },
80+ { Qt::Key_F5, 'k', '5' },
81+ { Qt::Key_F6, 'k', '6' },
82+ { Qt::Key_F7, 'k', '7' },
83+ { Qt::Key_F8, 'k', '8' },
84+ { Qt::Key_F9, 'k', '9' },
85+ { Qt::Key_F10, 'k', ';' },
86+ { Qt::Key_F11, 'F', '1' },
87+ { Qt::Key_F12, 'F', '2' },
88+ { Qt::Key_F13, 'F', '3' },
89+ { Qt::Key_F14, 'F', '4' },
90+ { Qt::Key_F15, 'F', '5' },
91+ { Qt::Key_F16, 'F', '6' },
92+ { Qt::Key_F17, 'F', '7' },
93+ { Qt::Key_F18, 'F', '8' },
94+ { Qt::Key_F19, 'F', '9' },
95+ { Qt::Key_F20, 'F', 'A' },
96+ { Qt::Key_F21, 'F', 'B' },
97+ { Qt::Key_F22, 'F', 'C' },
98+ { Qt::Key_F23, 'F', 'D' },
99+ { Qt::Key_F24, 'F', 'E' },
100+ { Qt::Key_F25, 'F', 'F' },
101+ { Qt::Key_F26, 'F', 'G' },
102+ { Qt::Key_F27, 'F', 'H' },
103+ { Qt::Key_F28, 'F', 'I' },
104+ { Qt::Key_F29, 'F', 'J' },
105+ { Qt::Key_F30, 'F', 'K' },
106+ { Qt::Key_F31, 'F', 'L' },
107+ { Qt::Key_F32, 'F', 'M' },
108+ { Qt::Key_F33, 'F', 'N' },
109+ { Qt::Key_F34, 'F', 'O' },
110+ { Qt::Key_F35, 'F', 'P' },
111+ { Qt::Key_Help, '%', '1' },
112+ // { Qt::Key_Undo, '&', '8' }, <= hmmm ?
113+ { Qt::Key_BackSpace, 'k', 'b' },
114+ { Qt::Key_Insert, KS_EXTRA, KE_KINS },
115+ { Qt::Key_Delete, KS_EXTRA, KE_KDEL },
116+ { Qt::Key_Home, 'K', '1' },
117+ { Qt::Key_End, 'K', '4' },
118+ { Qt::Key_Prior, 'K', '3' },
119+ { Qt::Key_Next, 'K', '5' },
120+ { Qt::Key_Print, '%', '9' },
121+
122+ { Qt::Key_Plus, 'K', '6'},
123+ { Qt::Key_Minus, 'K', '7'},
124+ { Qt::Key_Slash, 'K', '8'},
125+ { Qt::Key_multiply, 'K', '9'},
126+ { Qt::Key_Enter, 'K', 'A'},
127+ { Qt::Key_Period, 'K', 'B'},
128+
129+ { Qt::Key_0, 'K', 'C'},
130+ { Qt::Key_1, 'K', 'D'},
131+ { Qt::Key_2, 'K', 'E'},
132+ { Qt::Key_3, 'K', 'F'},
133+ { Qt::Key_4, 'K', 'G'},
134+ { Qt::Key_5, 'K', 'H'},
135+ { Qt::Key_6, 'K', 'I'},
136+ { Qt::Key_7, 'K', 'J'},
137+ { Qt::Key_8, 'K', 'K'},
138+ { Qt::Key_9, 'K', 'L'},
139+ /* End of list marker: */
140+ { 0, 0, 0 }
141+};//}}}
142+
143+#ifdef FEAT_CLIENTSERVER
144+typedef int (*QX11EventFilter) (XEvent*);
145+extern QX11EventFilter qt_set_x11_event_filter (QX11EventFilter filter);
146+static QX11EventFilter oldFilter = 0;
147+static int kvim_x11_event_filter( XEvent* e);
148+#endif
149+void gui_keypress(QKeyEvent *e);
150+
151+/*
152+ * Return OK if the key with the termcap name "name" is supported.
153+ */
154+ int
155+gui_mch_haskey(char_u * name)//{{{
156+{
157+ for (int i=0; special_keys[i].qtkey != 0; i++)
158+ if (name[0] == special_keys[i].code0 &&
159+ name[1] == special_keys[i].code1)
160+ return OK;
161+ return FAIL;
162+}//}}}
163+
164+/*
165+ * custom Frame for drawing ...
166+ */
167+void VimWidget::paintEvent( QPaintEvent *e)//{{{
168+{
169+ QRect r = e->rect();
170+ gui_redraw(r.x(), r.y(), r.width(), r.height() );
171+}//}}}
172+
173+void VimWidget::draw_string(int x, int y, QString s, int len, int flags)//{{{
174+{
175+ gui.current_font->setBold( flags & DRAW_BOLD );
176+ gui.current_font->setUnderline( flags & DRAW_UNDERL );
177+ gui.current_font->setItalic(flags & DRAW_ITALIC);
178+ painter->setBackgroundMode( flags & DRAW_TRANSP ? Qt::TransparentMode : Qt::OpaqueMode);
179+ painter->setFont( *(gui.current_font) );
180+ painter->drawText( x, y, s, len);
181+}//}}}
182+
183+void VimWidget::mousePressEvent(QMouseEvent *event)//{{{
184+{
185+ int button=0;
186+ int modifiers=0;
187+ ButtonState state = event->state();
188+ ButtonState buttons = event->button();
189+
190+ //Look at button states
191+ if (buttons & QMouseEvent::LeftButton)
192+ button |= MOUSE_LEFT;
193+ if (buttons & QMouseEvent::RightButton)
194+ button |= MOUSE_RIGHT;
195+ if (buttons & QMouseEvent::MidButton)
196+ button |= MOUSE_MIDDLE;
197+ //Look for keyboard modifiers
198+ if (state & QMouseEvent::ShiftButton)
199+ modifiers |= MOUSE_SHIFT;
200+ if (state & QMouseEvent::ControlButton)
201+ modifiers |= MOUSE_CTRL;
202+ if (state & QMouseEvent::AltButton)
203+ modifiers |= MOUSE_ALT;
204+ gui_send_mouse_event(button,event->x(),event->y(),FALSE,modifiers);
205+#if QT_VERSION>=300
206+ QByteArray params;
207+ QDataStream stream(params, IO_WriteOnly);
208+ stream << kapp->dcopClient()->appId() << button << modifiers << gui.row << gui.col;
209+ kapp->dcopClient()->emitDCOPSignal("mousePEvent(QCString,int,int,int,int)", params);
210+#endif
211+ event->accept();
212+}//}}}
213+
214+#if defined(FEAT_SESSION)
215+void VimMainWindow::saveGlobalProperties (KConfig *conf)
216+{
217+ //we write a mksession file to a file written in the user's ~/.kde/share/config/
218+ //the name of the file in saved in 'conf'
219+ //when restoring app, we source this file
220+#if 0 //disabled for release
221+ QString filename = KGlobal::dirs()->localkdedir() + KGlobal::dirs()->kde_default("config") + kapp->randomString(10);
222+ QString cmd("mksession ");
223+ cmd+=filename;
224+ do_cmdline_cmd((char_u*)cmd.latin1());
225+ conf->writePathEntry("sessionfile", filename);
226+ conf->sync();
227+#endif
228+}
229+
230+void VimMainWindow::readGlobalProperties (KConfig *conf)
231+{
232+#if 0
233+ QString filename = conf->readPathEntry("sessionfile");
234+ if (filename.isNull()) return;
235+ QString cmd("source ");
236+ cmd+=filename;
237+ do_cmdline_cmd((char_u*)cmd.latin1());
238+#endif
239+}
240+#endif
241+
242+void VimMainWindow::wheelEvent (QWheelEvent *event)//{{{
243+{
244+ ButtonState state = event->state();
245+ int button=0;
246+ int modifiers=0;
247+
248+ if (event->delta()>0)
249+ button|=MOUSE_4;
250+ else button|=MOUSE_5;
251+
252+ if (state & ShiftButton)
253+ modifiers|=MOUSE_SHIFT;
254+ if (state & ControlButton)
255+ modifiers|=MOUSE_CTRL;
256+ if (state & AltButton)
257+ modifiers|=MOUSE_ALT;
258+
259+ gui_send_mouse_event(button,event->x(),event->y(),FALSE,modifiers);
260+#if QT_VERSION>=300
261+ QByteArray params;
262+ QDataStream stream(params, IO_WriteOnly);
263+ stream << kapp->dcopClient()->appId() << button << modifiers << gui.row << gui.col;
264+ kapp->dcopClient()->emitDCOPSignal("mouseWhlEvent(QCString, int, int,int,int)", params);
265+#endif
266+ event->accept();
267+}//}}}
268+
269+void VimWidget::mouseDoubleClickEvent(QMouseEvent *event)//{{{
270+{
271+ ButtonState state = event->state();
272+ ButtonState buttons = event->button();
273+ int modifiers=0;
274+ int button=0;
275+
276+ //Look at button states
277+ if (buttons & LeftButton)
278+ button|=MOUSE_LEFT;
279+ if (buttons & RightButton)
280+ button|=MOUSE_RIGHT;
281+ if (buttons & MidButton)
282+ button|=MOUSE_MIDDLE;
283+
284+ //Look for keyboard modifiers
285+ if (state & ShiftButton)
286+ modifiers|=MOUSE_SHIFT;
287+ if (state & ControlButton)
288+ modifiers|=MOUSE_CTRL;
289+ if (state & AltButton)
290+ modifiers|=MOUSE_ALT;
291+
292+ gui_send_mouse_event(button,event->x(),event->y(),TRUE,modifiers);
293+#if QT_VERSION>=300
294+ QByteArray params;
295+ QDataStream stream(params, IO_WriteOnly);
296+ stream << kapp->dcopClient()->appId() << button << modifiers << gui.row << gui.col;
297+ kapp->dcopClient()->emitDCOPSignal("mouseDblClickEvent(QCString, int, int,int,int)", params);
298+#endif
299+ event->accept();
300+}//}}}
301+
302+void VimWidget::mouseMoveEvent(QMouseEvent *event){//{{{
303+ ButtonState state = event->state();
304+ int modifiers=0;
305+ int button=0;
306+
307+ gui_mch_mousehide(FALSE);
308+
309+ //Look at button states
310+ //warning: we use state here, this is important !
311+ if (state & QMouseEvent::LeftButton || state & QMouseEvent::RightButton || state & QMouseEvent::MidButton)
312+ button|=MOUSE_DRAG;
313+
314+ //Look for keyboard modifiers
315+ if (state & ShiftButton)
316+ modifiers|=MOUSE_SHIFT;
317+ if (state & ControlButton)
318+ modifiers|=MOUSE_CTRL;
319+ if (state & AltButton)
320+ modifiers|=MOUSE_ALT;
321+ if (button!=MOUSE_DRAG)
322+ gui_mouse_moved(event->x(),event->y());
323+ else
324+ gui_send_mouse_event(MOUSE_DRAG,event->x(),event->y(),FALSE,modifiers);
325+}//}}}
326+
327+void VimWidget::mouseReleaseEvent(QMouseEvent *event)//{{{
328+{
329+ ButtonState state = event->state();
330+ int modifiers=0;
331+
332+ //Look for keyboard modifiers
333+ if (state & ShiftButton)
334+ modifiers|=MOUSE_SHIFT;
335+ if (state & ControlButton)
336+ modifiers|=MOUSE_CTRL;
337+ if (state & AltButton)
338+ modifiers|=MOUSE_ALT;
339+
340+ gui_send_mouse_event(MOUSE_RELEASE,event->x(),event->y(),FALSE,modifiers);
341+ event->accept();
342+}//}}}
343+
344+/*
345+ * The main widget (everything but toolbar/menubar)
346+ */
347+ VimWidget::VimWidget( QWidget *parent, const char *name, WFlags f )//{{{
348+:QWidget(parent, name, f)
349+ ,DCOPObject("KVim")
350+#ifdef FEAT_MZSCHEME
351+ ,mzscheme_timer_id(-1)
352+#endif
353+{
354+ //to be able to show/hide the cursor when moving the mouse
355+ setMouseTracking(true);
356+ painter=new QPainter(this);
357+
358+ setKeyCompression(true);
359+ setFocusPolicy( QWidget::StrongFocus );
360+ setAcceptDrops(TRUE); // DND
361+ blink_state = BLINK_NONE;
362+ blink_on_time = 700;
363+ blink_off_time = 400;
364+ blink_wait_time = 250;
365+ connect( &blink_timer, SIGNAL( timeout() ), SLOT( blink_cursor() ));
366+ connect( &wait_timer, SIGNAL( timeout() ), SLOT ( wait_timeout() ));
367+}//}}}
368+
369+void VimWidget::execNormal(QString command)//{{{
370+{
371+ QString cmd("execute 'normal ");
372+ cmd+=command;
373+ cmd+="'";
374+ QCString unistring = vmw->codec->fromUnicode(cmd);
375+ do_cmdline_cmd((char_u *)(const char*)unistring);
376+ gui_update_screen();
377+}//}}}
378+
379+void VimWidget::execInsert(QString command)//{{{
380+{
381+ QString cmd("execute 'normal i");
382+ cmd+=command;
383+ cmd+="'";
384+ QCString unistring = vmw->codec->fromUnicode(cmd);
385+ do_cmdline_cmd((char_u *)(const char*)unistring);
386+ gui_update_screen();
387+}//}}}
388+
389+void VimWidget::execRaw(QString command)//{{{
390+{
391+ QString cmd("execute '");
392+ cmd+=command;
393+ cmd+="'";
394+ QCString unistring = vmw->codec->fromUnicode(cmd);
395+ do_cmdline_cmd((char_u *)(const char*)unistring);
396+ gui_update_screen();
397+}//}}}
398+
399+void VimWidget::execCmd(QString command)//{{{
400+{
401+ QCString unistring = vmw->codec->fromUnicode(command);
402+ do_cmdline_cmd((char_u *)(const char*)unistring);
403+ gui_update_screen();
404+}//}}}
405+
406+QString VimWidget::eval(QString expr)//{{{
407+{
408+#ifdef FEAT_EVAL
409+ QCString unistring = vmw->codec->fromUnicode(expr);
410+ QString val((const char *)eval_to_string((char_u *)(const char*)unistring,NULL));
411+ return val;
412+#else
413+ return QString::null;
414+#endif
415+}//}}}
416+
417+void VimWidget::wait(long wtime)//{{{
418+{
419+ if ( wait_timer.isActive() ) wait_timer.stop();
420+ wait_done = false;
421+ wait_timer.start( wtime, true);
422+}//}}}
423+
424+void VimWidget::wait_timeout() //{{{
425+{
426+ wait_done = true;
427+}//}}}
428+
429+void VimWidget::dragEnterEvent (QDragEnterEvent *e)//{{{
430+{
431+#if (defined(FEAT_WINDOWS) && defined(HAVE_DROP_FILE)) || defined(PROTO)
432+ e->accept(QUriDrag::canDecode(e));
433+#else
434+ e->ignore();
435+#endif
436+}//}}}
437+
438+void VimWidget::dropEvent (QDropEvent *e) // {{{
439+{
440+#if (defined(FEAT_WINDOWS) && defined(HAVE_DROP_FILE)) || defined(PROTO)
441+ QStrList urls;
442+
443+ char_u **fnames;
444+ int redo_dirs = FALSE;
445+ int i;
446+ int n;
447+ int nfiles;
448+ int url = FALSE;
449+
450+ /* Count how many items there may be and normalize delimiters. */
451+
452+ if (QUriDrag::decode(e, urls))
453+ {
454+ n = urls.count();
455+ fnames = (char_u **)lalloc((n+1) * sizeof(char_u *), TRUE);
456+ nfiles = 0;
457+#if QT_VERSION>=300
458+ QPtrListIterator<char> it(urls);
459+ for (; it.current(); ++it )
460+ {
461+ KURL u(*it);
462+#else
463+ for (i=0;i<urls.count();++i)
464+ {
465+ KURL u(urls.at(i));
466+#endif
467+ if ( !u.isLocalFile() )
468+ url = TRUE;
469+ else
470+ {
471+ fnames[nfiles] = (char_u *)strdup((const char *)u.path());
472+ ++nfiles;
473+ }
474+ }
475+ /* Real files (i.e. not http and not ftp) */
476+ if (url == FALSE)
477+ {
478+ if (nfiles == 1)
479+ {
480+ if (mch_isdir(fnames[0]))
481+ {
482+ /* Handle dropping a directory on Vim. */
483+ if (mch_chdir((char *)fnames[0]) == 0)
484+ {
485+ free(fnames[0]);
486+ fnames[0] = NULL;
487+ redo_dirs = TRUE;
488+ }
489+ }
490+ }
491+ else
492+ {
493+ /* Ignore any directories */
494+ for (i = 0; i < nfiles; ++i)
495+ {
496+ if (mch_isdir(fnames[i]))
497+ {
498+ vim_free(fnames[i]);
499+ fnames[i] = NULL;
500+ }
501+ }
502+ }
503+
504+ if (0)
505+ {
506+ /* Shift held down, change to first file's directory */
507+ if (fnames[0] != NULL && vim_chdirfile(fnames[0]) == OK)
508+ redo_dirs = TRUE;
509+ }
510+ else
511+ {
512+ char_u dirname[MAXPATHL];
513+ char_u *s;
514+ if (mch_dirname(dirname, MAXPATHL) == OK)
515+ for (i = 0; i < nfiles; ++i)
516+ if (fnames[i] != NULL)
517+ {
518+ s = shorten_fname(fnames[i], dirname);
519+ if (s != NULL && (s = vim_strsave(s)) != NULL)
520+ {
521+ vim_free(fnames[i]);
522+ fnames[i] = s;
523+ }
524+ }
525+ }
526+ }
527+
528+ /* Handle the drop, :edit or :split to get to the file */
529+ handle_drop(nfiles, fnames, FALSE);
530+
531+ if (redo_dirs)
532+ shorten_fnames(TRUE);
533+ }
534+
535+ /* Update the screen display */
536+ update_screen(NOT_VALID);
537+#ifdef FEAT_MENU
538+ gui_update_menus(0);
539+#endif
540+ setcursor();
541+ out_flush();
542+ gui_update_cursor(FALSE, FALSE);
543+ gui_mch_flush();
544+#endif
545+} // }}}
546+
547+void VimWidget::keyPressEvent( QKeyEvent *e ) // {{{
548+{
549+ gui_keypress(e);
550+} // }}}
551+
552+void gui_keypress(QKeyEvent *e) { // {{{
553+ int key = (int)e->key();
554+ int modifiers = 0,i;
555+ uchar string[256],string2[256];
556+ uchar *s,*d;
557+ Qt::ButtonState state = e->state();
558+
559+ QCString unistring = vmw->codec->fromUnicode(e->text());
560+ if (unistring.length()>0)
561+ strncpy((char*)string, (const char*)unistring,unistring.length());
562+ string[unistring.length()] = 0;
563+ int len=unistring.length();
564+
565+ // ignore certain keys
566+ if (key == Qt::Key_Shift || key == Qt::Key_Alt || key == Qt::Key_Control || key == Qt::Key_Meta
567+ || key == Qt::Key_CapsLock || key == Qt::Key_NumLock || key == Qt::Key_ScrollLock )
568+ {
569+ e->ignore();
570+ return;
571+ }
572+
573+#ifdef FEAT_MBYTE
574+ if (input_conv.vc_type != CONV_NONE)
575+ {
576+ mch_memmove(string2, string, len);
577+ len = convert_input(string2, len, sizeof(string2));
578+ s = string2;
579+ }
580+ else
581+#endif
582+ s = string;
583+ d = string;
584+ for (i = 0; i < len; ++i)
585+ {
586+ *d++ = s[i];
587+ if (d[-1] == CSI && d + 2 < string + sizeof(string))
588+ {
589+ /* Turn CSI into K_CSI. */
590+ *d++ = KS_EXTRA;
591+ *d++ = (int)KE_CSI;
592+ }
593+ }
594+ len = d - string;
595+
596+
597+ // change shift-tab (backtab) into S_TAB
598+ if ( key == Qt::Key_BackTab && state & Qt::ShiftButton)
599+ key = Qt::Key_Tab;
600+
601+ // Change C-@ and C-2 in NUL ? Gtk does this
602+ if ( (key == Qt::Key_2 || key == Qt::Key_At)
603+ && state & Qt::ControlButton )
604+ {
605+ string[0] = NUL;
606+ len = 1;
607+ }
608+ else if (len == 0 && (key == Qt::Key_Space || key == Qt::Key_Tab))
609+ {
610+ /* When there are modifiers, these keys get zero length; we need the
611+ * original key here to be able to add a modifier below. */
612+ string[0] = (key & 0xff);
613+ len = 1;
614+ }
615+ /* Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character
616+ * that already has the 8th bit set.
617+ * Don't do this for <S-M-Tab>, that should become K_S_TAB with ALT. */
618+ if (len == 1
619+ && (key != Qt::Key_BackSpace && key != Qt::Key_Delete)
620+ && (string[0] & 0x80) == 0
621+ && (state & Qt::AltButton)
622+ && !(key == Qt::Key_Tab && (state & Qt::ShiftButton)))
623+ {
624+ string[0] |= 0x80;
625+#ifdef FEAT_MBYTE
626+ if (enc_utf8) // convert to utf-8
627+ {
628+ string[1] = string[0] & 0xbf;
629+ string[0] = ((unsigned)string[0] >> 6) + 0xc0;
630+ if (string[1] == CSI)
631+ {
632+ string[2] = KS_EXTRA;
633+ string[3] = (int)KE_CSI;
634+ len = 4;
635+ }
636+ else
637+ len = 2;
638+ }
639+#endif
640+ }
641+
642+ /* Check for special keys, making sure BS and DEL are recognised. */
643+ if (len == 0 || key == Qt::Key_BackSpace || key == Qt::Key_Delete)
644+ {
645+ while (special_keys[i].qtkey != 0 && special_keys[i].qtkey != key ) i++;
646+ if (special_keys[i].qtkey != 0)
647+ {
648+ string[0] = CSI;
649+ string[1] = special_keys[i].code0;
650+ string[2] = special_keys[i].code1;
651+ len = -3;
652+ }
653+/*
654+ for (i = 0; special_keys[i].qtkey != 0 ; i++)
655+ {
656+ if (special_keys[i].qtkey == key )
657+ {
658+ string[0] = CSI;
659+ string[1] = special_keys[i].code0;
660+ string[2] = special_keys[i].code1;
661+ len = -3;
662+ break;
663+ }
664+ }*/
665+ }
666+
667+ if (len == 0)
668+ {
669+ //no need to dump that, that's a QT problem, we can't do anything
670+ //dbf("Unrecognised Key : %X %s", key, e->text().latin1());
671+ e->ignore();
672+ return;
673+ }
674+
675+
676+ /* Special keys (and a few others) may have modifiers */
677+ if (len == -3 || key == Qt::Key_Space || key == Qt::Key_Tab ||
678+ key == Qt::Key_Return || key == Qt::Key_Enter ||
679+ key == Qt::Key_Escape)
680+ {
681+
682+ modifiers = 0;
683+ if (state & Qt::ShiftButton) modifiers |= MOD_MASK_SHIFT;
684+ if (state & Qt::ControlButton) modifiers |= MOD_MASK_CTRL;
685+ if (state & Qt::AltButton) modifiers |= MOD_MASK_ALT;
686+
687+ /*
688+ * For some keys a shift modifier is translated into another key
689+ * code. Do we need to handle the case where len != 1 and
690+ * string[0] != CSI?
691+ */
692+ if (len == -3)
693+ key = TO_SPECIAL(string[1], string[2]);
694+ else
695+ key = string[0];
696+
697+ key = simplify_key(key, &modifiers);
698+ if (key == CSI) key=K_CSI;
699+
700+ if (IS_SPECIAL(key))
701+ {
702+ string[0] = CSI;
703+ string[1] = K_SECOND(key);
704+ string[2] = K_THIRD(key);
705+ len = 3;
706+ }
707+ else
708+ {
709+ string[0] = key;
710+ len = 1;
711+ }
712+
713+
714+ if (modifiers!=0)
715+ {
716+ uchar string2[10];
717+ string2[0] = CSI;
718+ string2[1] = KS_MODIFIER;
719+ string2[2] = modifiers;
720+ add_to_input_buf(string2, 3);
721+ }
722+
723+ } /* special keys */
724+
725+ if (len == 1 && ((string[0] == Ctrl_C && ctrl_c_interrupts)
726+ || (string[0] == intr_char && intr_char != Ctrl_C)))
727+ {
728+ trash_input_buf();
729+ got_int = TRUE;
730+ }
731+
732+ add_to_input_buf(string, len);
733+ if (p_mh)
734+ gui_mch_mousehide(TRUE);
735+
736+ //DCOP Embedding stuff
737+ //if we are here then the user has type something in the window, thus we can easily imagine that :
738+ // 1 - text has changed (emit textChanged())
739+ // 2 - characters were interactively inserted (emit charactersInteractivelyInserted())
740+ // 3 - cursor position has changed ( emit cursorPositionChanged() )
741+ // 4 - selection has changed ? dunno yet //XXX
742+ // 5 - undo changed too ? (each character typed in makes the undo changes anyway)
743+ // conclusion : this makes a lot of things to send to the vim kpart, maybe too much
744+ // for now i'll just send : keyboardEvent to the kpart with the event string as parameter,
745+ // with current current position
746+ // i'll do the same for mouseEvents
747+#if QT_VERSION>=300
748+ QByteArray params;
749+ QDataStream stream(params, IO_WriteOnly);
750+ stream << kapp->dcopClient()->appId() << unistring << gui.row << gui.col;
751+ kapp->dcopClient()->emitDCOPSignal("keyboardEvent(QCString, QCString,int,int)", params);
752+#endif
753+ e->ignore();
754+} // }}}
755+
756+#ifdef FEAT_CLIENTSERVER
757+void VimWidget::serverActivate(WId id) //{{{
758+{
759+ if (serverName == NULL && serverDelayedStartName != NULL)
760+ {
761+ commWindow = id;
762+ (void)serverRegisterName(qt_xdisplay(), serverDelayedStartName);
763+ }
764+ else
765+ serverChangeRegisteredWindow( qt_xdisplay(), id);
766+}//}}}
767+#endif
768+
769+#ifdef FEAT_XIM
770+void VimWidget::imStartEvent(QIMEvent *e)
771+{
772+ e->accept();
773+}
774+
775+void VimWidget::imEndEvent(QIMEvent *e)
776+{
777+ uchar string[256];
778+
779+ QCString unistring = vmw->codec->fromUnicode(e->text());
780+ if (unistring.length()>0)
781+ strncpy((char*)string, (const char*)unistring,unistring.length());
782+ string[unistring.length()] = 0;
783+ int len=unistring.length();
784+
785+ add_to_input_buf(string, len);
786+ e->accept();
787+}
788+
789+void VimWidget::imComposeEvent(QIMEvent *e)
790+{
791+ //i should do something here, displaying the text somewhere ... (status area ?)
792+ e->accept();
793+}
794+#endif
795+
796+
797+void VimMainWindow::lock()
798+{
799+ locked=true;
800+}
801+
802+void VimMainWindow::unlock()
803+{
804+ locked=false;
805+}
806+
807+bool VimMainWindow::isLocked()
808+{
809+ return locked;
810+}
811+
812+// ->resize VimWidget if not locked
813+//
814+void VimMainWindow::resizeEvent ( QResizeEvent *e ) //{{{
815+{
816+ if ( vmw->isLocked() ) return;
817+ //remove toolbar and menubar height
818+ int height = e->size().height();
819+ int width = e->size().width();
820+
821+ if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled()
822+#if QT_VERSION>=300
823+ && !vmw->menuBar()->isTopLevelMenu()
824+#endif
825+ )
826+ height -= vmw->menuBar()->height();
827+#ifdef FEAT_TOOLBAR
828+ if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
829+ (vmw->toolBar()->barPos()==KToolBar::Top ||
830+ vmw->toolBar()->barPos()==KToolBar::Bottom))
831+ height -= vmw->toolBar()->height();
832+
833+ if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
834+ (vmw->toolBar()->barPos()==KToolBar::Left ||
835+ vmw->toolBar()->barPos()==KToolBar::Right))
836+ width -= vmw->toolBar()->width();
837+#endif
838+ height = ( ((int)(height/gui.char_height))*gui.char_height );
839+ if (!vmw->isLocked()) gui_resize_shell(width,height);
840+}//}}}
841+
842+void VimWidget::focusInEvent( QFocusEvent * fe ) // {{{
843+{
844+ gui_focus_change(true);
845+
846+ if (blink_state == BLINK_NONE)
847+ gui_mch_start_blink();
848+} // }}}
849+
850+void VimWidget::focusOutEvent( QFocusEvent * fe )//{{{
851+{
852+ gui_focus_change(false);
853+
854+ if (blink_state != BLINK_NONE)
855+ gui_mch_stop_blink();
856+}//}}}
857+
858+void VimWidget::set_blink_time( long wait, long on, long off)//{{{
859+{
860+ blink_wait_time = wait;
861+ blink_on_time = on;
862+ blink_off_time = off;
863+}//}}}
864+
865+void VimWidget::start_cursor_blinking()//{{{
866+{
867+ if (blink_timer.isActive()) blink_timer.stop();
868+
869+ /* Only switch blinking on if none of the times is zero */
870+ if (blink_wait_time && blink_on_time && blink_off_time && gui.in_focus)
871+ {
872+ blink_state = BLINK_ON;
873+ gui_update_cursor(TRUE, FALSE);
874+ // The first blink appears after wait_time
875+ blink_timer.start( blink_wait_time, true);
876+ }
877+}//}}}
878+
879+void VimWidget::blink_cursor()//{{{
880+{
881+ if (blink_state == BLINK_ON)
882+ {
883+ // set cursor off
884+ gui_undraw_cursor();
885+ blink_state = BLINK_OFF;
886+ blink_timer.start( blink_off_time, true);
887+ }
888+ else
889+ {
890+ // set cursor on
891+ gui_update_cursor(TRUE, FALSE);
892+ blink_state = BLINK_ON;
893+ blink_timer.start( blink_on_time, true);
894+ }
895+}//}}}
896+
897+void VimWidget::stop_cursor_blinking()//{{{
898+{
899+ if (blink_timer.isActive()) blink_timer.stop();
900+
901+ if (blink_state == BLINK_OFF)
902+ gui_update_cursor(TRUE, FALSE);
903+
904+ blink_state = BLINK_NONE;
905+}//}}}
906+
907+#ifdef FEAT_MZSCHEME
908+void VimWidget::timerEvent( QTimerEvent * evnt)//{{{
909+{
910+ if (evnt->timerId() == mzscheme_timer_id)
911+ timer_proc();
912+}//}}}
913+
914+void VimWidget::enable_mzscheme_threads()//{{{
915+{
916+ mzscheme_timer_id = startTimer(p_mzq);
917+}//}}}
918+
919+void VimWidget::disable_mzscheme_threads()//{{{
920+{
921+ killTimer(mzscheme_timer_id);
922+}//}}}
923+#endif
924+
925+void VimWidget::flash()//{{{
926+{
927+ QPainter p(this);
928+
929+ p.setRasterOp(Qt::XorROP);
930+ p.fillRect(geometry(),QColor(0xFF,0xFF,0xFF));
931+ p.flush();
932+ //FIXME: Make this a little smarter. Maybe add a timer or something
933+ usleep(19000);
934+ p.fillRect(geometry(),QColor(0xFF,0xFF,0xFF));
935+ p.flush();
936+ p.end();
937+}//}}}
938+
939+
940+/*
941+ * The main Window
942+ */
943+ VimMainWindow::VimMainWindow ( const char *name , WFlags f)//{{{
944+:KMainWindow(0L, name,f)
945+{
946+#ifdef FEAT_CLIENTSERVER
947+ oldFilter = qt_set_x11_event_filter( kvim_x11_event_filter );
948+#endif
949+ if (echo_wid_arg== 1)
950+ {
951+ fprintf(stderr, "WID: %ld\n", (long)winId());
952+ fflush(stderr);
953+ }
954+
955+ w = new VimWidget(this, "main vim widget");
956+ gui.w = w;
957+ setFocusProxy(w);
958+ w->setFocus();
959+ have_tearoff=0;
960+
961+ finddlg=new KEdFind (this,0,false);
962+ repldlg=new KEdReplace (this,0,false);
963+ QObject::connect( finddlg, SIGNAL(search()), this, SLOT(slotSearch()) );
964+ QObject::connect( repldlg, SIGNAL(find()), this, SLOT(slotFind()) );
965+ QObject::connect( repldlg, SIGNAL(replace()), this, SLOT(slotReplace()) );
966+ QObject::connect( repldlg, SIGNAL(replaceAll()), this, SLOT(slotReplaceAll()) );
967+
968+#ifdef FEAT_TOOLBAR
969+ connect(toolBar(), SIGNAL(clicked(int)), this, SLOT(menu_activated(int)));
970+#endif
971+#ifdef FEAT_CLIENTSERVER
972+ w->serverActivate(winId());
973+
974+ if (serverName!=NULL)
975+ kapp->dcopClient()->registerAs(QCString((const char*)serverName),false);
976+ else if (serverDelayedStartName!=NULL)
977+ kapp->dcopClient()->registerAs(QCString((const char*)serverDelayedStartName),false);
978+ else if (argServerName!=NULL)
979+ kapp->dcopClient()->registerAs(argServerName->utf8(),false);
980+#else
981+ if (argServerName!=NULL)
982+ kapp->dcopClient()->registerAs(argServerName->utf8(),false);
983+#endif
984+ QXEmbed::initialize();
985+
986+}//{{{
987+
988+bool VimMainWindow::queryClose()//{{{
989+{
990+ gui_shell_closed();
991+ return true;
992+}//}}}
993+
994+bool VimMainWindow::queryExit()//{{{
995+{
996+ return true;
997+}//}}}
998+
999+void VimMainWindow::menu_activated(int dx)//{{{
1000+{
1001+#ifdef FEAT_MENU
1002+ if (!dx) { // tearoff
1003+ return;
1004+ }
1005+ gui_mch_set_foreground();
1006+ gui_menu_cb((VimMenu *) dx);
1007+#endif
1008+}//}}}
1009+
1010+
1011+void VimMainWindow::clipboard_selection_update(){//{{{
1012+ if (kapp->clipboard()->ownsSelection())
1013+ clip_own_selection(&clip_star);
1014+ else
1015+ clip_lose_selection(&clip_star);
1016+}//}}}
1017+
1018+void VimMainWindow::clipboard_data_update(){//{{{
1019+#if QT_VERSION>=300
1020+ if (kapp->clipboard()->ownsClipboard())
1021+ clip_own_selection(&clip_plus);
1022+ else
1023+ clip_lose_selection(&clip_plus);
1024+#else
1025+ if (kapp->clipboard()->ownsSelection())
1026+ clip_own_selection(&clip_star);
1027+ else
1028+ clip_lose_selection(&clip_star);
1029+#endif
1030+}//}}}
1031+
1032+void VimMainWindow::slotSearch()//{{{
1033+{
1034+ QString find_text;
1035+ bool direction_down = TRUE;
1036+ bool casesensitive = TRUE;
1037+ int flags = FRD_FINDNEXT;
1038+
1039+ find_text = finddlg->getText();
1040+ direction_down = !(finddlg->get_direction());
1041+ casesensitive = finddlg->case_sensitive();
1042+ // if (casesensitive) find_text = "\\C" + find_text;
1043+ // else find_text = "\\c" + find_text;
1044+ if (casesensitive) flags|=FRD_MATCH_CASE;
1045+ QCString unistring = vmw->codec->fromUnicode(find_text);
1046+ gui_do_findrepl(flags, (char_u *)(const char *)unistring, NULL,(int)direction_down);
1047+}//}}}
1048+
1049+void VimMainWindow::slotFind()//{{{
1050+{
1051+ QString find_text;
1052+ bool direction_down=TRUE;
1053+ bool casesensitive = TRUE;
1054+ int flags = FRD_R_FINDNEXT;
1055+
1056+ find_text=repldlg->getText();
1057+ direction_down = !(repldlg->get_direction());
1058+ casesensitive = repldlg->case_sensitive();
1059+ // if (casesensitive) find_text = "\\C" + find_text;
1060+ // else find_text = "\\c" + find_text;
1061+ if (casesensitive) flags|=FRD_MATCH_CASE;
1062+
1063+ QCString unistring = vmw->codec->fromUnicode(find_text);
1064+ gui_do_findrepl(flags, (char_u *)(const char *)unistring, NULL,(int)direction_down);
1065+}//}}}
1066+
1067+void VimMainWindow::slotReplace()//{{{
1068+{
1069+ QString find_text;
1070+ QString repl_text;
1071+ bool direction_down=TRUE;
1072+ bool casesensitive = TRUE;
1073+ int flags = FRD_REPLACE;
1074+
1075+ find_text=repldlg->getText();
1076+ repl_text=repldlg->getReplaceText();
1077+ direction_down = !(repldlg->get_direction());
1078+ //if (casesensitive) find_text = "\\C" + find_text;
1079+ //else find_text = "\\c" + find_text;
1080+ if (casesensitive) flags|=FRD_MATCH_CASE;
1081+
1082+ QCString unistring = vmw->codec->fromUnicode(find_text);
1083+ QCString unistring2 = vmw->codec->fromUnicode(repl_text);
1084+ gui_do_findrepl(flags, (char_u *)(const char *)unistring,(char_u *)(const char*)unistring2,(int)direction_down);
1085+}//}}}
1086+
1087+void VimMainWindow::slotReplaceAll()//{{{
1088+{
1089+ QString find_text;
1090+ QString repl_text;
1091+ bool direction_down=TRUE;
1092+ bool casesensitive = TRUE;
1093+ int flags = FRD_REPLACEALL;
1094+
1095+ find_text=repldlg->getText();
1096+ repl_text=repldlg->getReplaceText();
1097+ direction_down = !(repldlg->get_direction());
1098+ casesensitive = repldlg->case_sensitive();
1099+ // if (casesensitive) find_text = "\\C" + find_text;
1100+ // else find_text = "\\c" + find_text;
1101+ if (casesensitive) flags|=FRD_MATCH_CASE;
1102+ QCString unistring = vmw->codec->fromUnicode(find_text);
1103+ QCString unistring2 = vmw->codec->fromUnicode(repl_text);
1104+ gui_do_findrepl(flags, (char_u *)(const char *)unistring,(char_u *)(const char*)unistring2,(int)direction_down);
1105+}//}}}
1106+
1107+void VimMainWindow::showAboutKDE()
1108+{
1109+ KAboutKDE *kde = new KAboutKDE(this);
1110+ kde->show();
1111+}
1112+
1113+void VimMainWindow::showAboutApplication()//{{{
1114+{
1115+ KAboutData *aboutData = new KAboutData (
1116+ "kvim"
1117+ , I18N_NOOP("KVim")
1118+ , VIM_VERSION_SHORT
1119+ , I18N_NOOP("Vim in a KDE interface")
1120+ , 0
1121+ , "(c) Vim Team, \":help credits\" for more infos.\nType \":help iccf\" to see how you can help the children in Uganda"
1122+ , 0l
1123+ , "http://freehackers.org/kvim"
1124+ , "kvim-dev@freenux.org"
1125+ );
1126+
1127+ aboutData->addAuthor("Bram Moolenaar",
1128+ I18N_NOOP("Main vim author"),
1129+ "Bram@vim.org",
1130+ "http://www.vim.org/");
1131+ aboutData->addAuthor("Thomas Capricelli",
1132+ I18N_NOOP("KDE porting"),
1133+ "orzel@freehackers.org",
1134+ "http://orzel.freehackers.org");
1135+ aboutData->addAuthor("Philippe Fremy",
1136+ I18N_NOOP("KDE porting"),
1137+ "pfremy@chez.com",
1138+ "http://www.freehackers.org/kvim");
1139+ aboutData->addAuthor("Mark Westcott",
1140+ I18N_NOOP("Qtopia porting, maintainer of the Qtopia part"),
1141+ "mark@houseoffish.org",
1142+ "http://houseoffish.org");
1143+ aboutData->addAuthor("Mickael Marchand",
1144+ I18N_NOOP("KDE porting, maintainer"),
1145+ "marchand@kde.org",
1146+ "http://freenux.org");
1147+ aboutData->addAuthor("Many other people",
1148+ I18N_NOOP("type :help credits for more infos")
1149+ );
1150+ aboutData->addCredit("Vince Negri",
1151+ I18N_NOOP("Antialiasing support, Color fixes"),
1152+ "vnegri@asl-electronics.co.uk");
1153+ aboutData->addCredit("Malte Starostik",
1154+ I18N_NOOP("Patch for performance improvement"),
1155+ "malte@kde.org");
1156+ aboutData->addCredit("Mark Stosberg",
1157+ I18N_NOOP("Provided a FreeBSD box to debug KVim on BSD"),
1158+ "mark@summersault.com"
1159+ );
1160+ aboutData->addCredit("Henrik Skott",
1161+ I18N_NOOP("Font patch when KDE not configured"),
1162+ "henrik.skott@hem.utfors.se"
1163+ );
1164+ aboutData->addCredit("Kailash Sethuraman",
1165+ I18N_NOOP("NetBSD configure/compilation fixes")
1166+ );
1167+ aboutData->setLicenseText(
1168+"KVim as an extension of Vim follows Vim license : \n\
1169+Vim is Charityware. You can use and copy it as much as you like, but you are\n\
1170+encouraged to make a donation to orphans in Uganda. Please read the file\n\
1171+runtime/doc/uganda.txt for details.\n\
1172+\n\
1173+There are no restrictions on distributing an unmodified copy of Vim. Parts of\n\
1174+Vim may also be distributed, but this text must always be included. You are\n\
1175+allowed to include executables that you made from the unmodified Vim sources,\n\
1176+your own usage examples and Vim scripts.\n\
1177+\n\
1178+If you distribute a modified version of Vim, you are encouraged to send the\n\
1179+maintainer a copy, including the source code. Or make it available to the\n\
1180+maintainer through ftp; let him know where it can be found. If the number of\n\
1181+changes is small (e.g., a modified Makefile) e-mailing the diffs will do.\n\
1182+When the maintainer asks for it (in any way) you must make your changes,\n\
1183+including source code, available to him.\n\
1184+\n\
1185+The maintainer reserves the right to include any changes in the official\n\
1186+version of Vim. This is negotiable. You are not allowed to distribute a\n\
1187+modified version of Vim when you are not willing to make the source code\n\
1188+available to the maintainer.\n\
1189+\n\
1190+The current maintainer is Bram Moolenaar <Bram@vim.org>. If this changes, it\n\
1191+will be announced in appropriate places (most likely www.vim.org and\n\
1192+comp.editors). When it is completely impossible to contact the maintainer,\n\
1193+the obligation to send him modified source code ceases.\n\
1194+\n\
1195+It is not allowed to remove these restrictions from the distribution of the\n\
1196+Vim sources or parts of it. These restrictions may also be used for previous\n\
1197+Vim releases instead of the text that was included with it.");
1198+
1199+ KAboutApplication *about = new KAboutApplication(aboutData);
1200+ about->show();
1201+}//}}}
1202+
1203+void VimMainWindow::showTipOfTheDay()
1204+{
1205+#if QT_VERSION>=300
1206+ KTipDialog::showTip (vmw,QString::null,true);
1207+#endif
1208+}
1209+
1210+void VimMainWindow::buffersToolbar()
1211+{
1212+
1213+}
1214+
1215+void VimMainWindow::showBugReport()
1216+{
1217+ KBugReport *bug= new KBugReport(this,true);
1218+ bug->show();
1219+}
1220+/*
1221+ * Vim Dialog
1222+ *
1223+ * Returns:
1224+ * 0: Cancel
1225+ * 1- : nb of the pressed button
1226+ */
1227+
1228+VimDialog::VimDialog (int type, /* type of dialog *///{{{
1229+ char_u * title, /* title of dialog */
1230+ char_u * message, /* message text */
1231+ char_u * buttons, /* names of buttons */
1232+ int def_but, /* default button */
1233+ char_u *textfield ) /* input field */
1234+:QDialog(vmw, "vim generic dialog", true), // true is for "modal"
1235+ mapper(this, "dialog signal mapper")
1236+{
1237+ /*
1238+ * Create Icon
1239+ */
1240+ char ** icon_data;
1241+ switch (type)
1242+ {
1243+ case VIM_GENERIC:
1244+ icon_data = generic_xpm;
1245+ break;
1246+ case VIM_ERROR:
1247+ icon_data = error_xpm;
1248+ break;
1249+ case VIM_WARNING:
1250+ icon_data = alert_xpm;
1251+ break;
1252+ case VIM_INFO:
1253+ icon_data = info_xpm;
1254+ break;
1255+ case VIM_QUESTION:
1256+ icon_data = quest_xpm;
1257+ break;
1258+ default:
1259+ icon_data = generic_xpm;
1260+ };
1261+ QLabel * icon = new QLabel( this );
1262+ icon->setPixmap( QPixmap( (const char **) icon_data ) );
1263+ icon->setFixedSize( icon->sizeHint() );
1264+
1265+ QLabel * text = new QLabel( (const char *)message, this );
1266+ text->setAlignment( AlignHCenter | AlignVCenter | ExpandTabs );
1267+
1268+ QStringList buttonText = QStringList::split( DLG_BUTTON_SEP, (char *) buttons);
1269+ int butNb = buttonText.count();
1270+
1271+ /*
1272+ * Layout
1273+ */
1274+
1275+ QVBoxLayout * vly = new QVBoxLayout( this, 5, 5 );
1276+ QHBoxLayout * hly1 = new QHBoxLayout( vly, 5);
1277+ hly1->addWidget( icon );
1278+ hly1->addWidget( text );
1279+ QHBoxLayout * hly3 = new QHBoxLayout ( vly , 5);
1280+ if (textfield!=NULL)
1281+ {
1282+ entry = new QLineEdit((const char *)textfield,this);
1283+ entry->setText((const char *)textfield);
1284+ hly3->addWidget( entry );
1285+ ret=textfield;
1286+ }
1287+ else
1288+ entry=NULL;
1289+
1290+ QHBoxLayout * hly2 = new QHBoxLayout( vly, 15);
1291+ QString s;
1292+ QPushButton * pushButton = 0L;
1293+ for (int i=0; i<butNb; i++)
1294+ {
1295+ s = buttonText[i];
1296+ pushButton = new QPushButton(s, this );
1297+ if (s.find('&') != -1)
1298+ pushButton->setAccel(s.at(s.find('&')+1).latin1());
1299+
1300+ hly2->addWidget( pushButton );
1301+ if (i == def_but-1)
1302+ {
1303+ pushButton->setDefault( true );
1304+ pushButton->setAutoDefault( true );
1305+ setResult( i+1 );
1306+ }
1307+ connect(pushButton, SIGNAL(clicked()), &mapper, SLOT(map()));
1308+ mapper.setMapping(pushButton, i+1);
1309+ }
1310+ connect( &mapper, SIGNAL(mapped(int)), this, SLOT(done(int)));
1311+
1312+ setCaption((const char *) title);
1313+
1314+ vly->activate();
1315+}//}}}
1316+
1317+void VimDialog::done(int r)
1318+{
1319+ if (entry!=NULL)
1320+ {
1321+ if (r)
1322+ {
1323+ QCString unistring=vmw->codec->fromUnicode(entry->text());
1324+ STRCPY(ret,(const char*)unistring);
1325+ }
1326+ else
1327+ *ret=NUL;
1328+ }
1329+ QDialog::done(r);
1330+}
1331+
1332+/*
1333+ * ScrollBar pool handling
1334+ */
1335+SBPool::SBPool(void)//{{{
1336+ :mapper(this, "SBPool signal mapper")
1337+{
1338+ connect(&mapper, SIGNAL(mapped(int)), this, SLOT(sbUsed(int)));
1339+}//}}}
1340+
1341+
1342+void SBPool::create(GuiScrollbar * sb, int orient)//{{{
1343+{
1344+ switch(orient)
1345+ {
1346+ case SBAR_HORIZ:
1347+ sb->w = new QScrollBar(QScrollBar::Horizontal, vmw);
1348+ break;
1349+ case SBAR_VERT:
1350+ sb->w = new QScrollBar(QScrollBar::Vertical, vmw);
1351+ break;
1352+ default:
1353+ sb->w = 0;
1354+ return;
1355+ }
1356+
1357+ connect(sb->w, SIGNAL(valueChanged(int)), &mapper, SLOT(map()));
1358+ mapper.setMapping(sb->w, (int)sb);
1359+}//}}}
1360+
1361+
1362+void SBPool::sbUsed(int who)//{{{
1363+{
1364+ GuiScrollbar *sb = (GuiScrollbar*)who;
1365+ gui_drag_scrollbar( sb, sb->w->value(), FALSE);
1366+}//}}}
1367+
1368+
1369+void SBPool::destroy(GuiScrollbar * sb)//{{{
1370+{
1371+ if (!sb->w) return;
1372+
1373+ delete sb->w;
1374+ sb->w = 0;
1375+}//}}}
1376+
1377+#ifdef FEAT_CLIENTSERVER
1378+static int kvim_x11_event_filter( XEvent* e)//{{{
1379+{
1380+ if (e->xproperty.type == PropertyNotify
1381+ && e->xproperty.atom == commProperty
1382+ && e->xproperty.window == commWindow
1383+ && e->xproperty.state == PropertyNewValue)
1384+ serverEventProc(qt_xdisplay(), e);
1385+
1386+ if (oldFilter) return oldFilter( e );
1387+ return FALSE;
1388+}//}}}
1389+#endif
1390+
1391+//add some QT 3 fonts usefull functions
1392+#if QT_VERSION<300
1393+QString KVimUtils::toString(QFont *f)
1394+{
1395+ QStringList l;
1396+ l.append(f->family());
1397+ l.append(QString::number(f->pointSize()));
1398+ l.append(QString::number(f->pixelSize()));
1399+ l.append(QString::number((int)f->styleHint()));
1400+ l.append(QString::number(f->weight()));
1401+ l.append(QString::number((int)f->italic()));
1402+ l.append(QString::number((int)f->underline()));
1403+ l.append(QString::number((int)f->strikeOut()));
1404+ l.append(QString::number((int)f->fixedPitch()));
1405+ l.append(QString::number((int)f->rawMode()));
1406+ return l.join(",");
1407+}
1408+
1409+bool KVimUtils::fromString(QFont *f, QString descrip)
1410+{
1411+ QStringList l(QStringList::split(',', descrip));
1412+
1413+ int count = l.count();
1414+ if (count != 10 && count != 9)
1415+ return FALSE;
1416+
1417+ f->setFamily(l[0]);
1418+ f->setPointSize(l[1].toInt());
1419+ if ( count == 9 )
1420+ {
1421+ f->setStyleHint((QFont::StyleHint) l[2].toInt());
1422+ f->setWeight(l[3].toInt());
1423+ f->setItalic(l[4].toInt());
1424+ f->setUnderline(l[5].toInt());
1425+ f->setStrikeOut(l[6].toInt());
1426+ f->setFixedPitch(l[7].toInt());
1427+ f->setRawMode(l[8].toInt());
1428+ }
1429+ else
1430+ {
1431+ f->setPixelSize(l[2].toInt());
1432+ f->setStyleHint((QFont::StyleHint) l[3].toInt());
1433+ f->setWeight(l[4].toInt());
1434+ f->setItalic(l[5].toInt());
1435+ f->setUnderline(l[6].toInt());
1436+ f->setStrikeOut(l[7].toInt());
1437+ f->setFixedPitch(l[8].toInt());
1438+ f->setRawMode(l[9].toInt());
1439+ }
1440+ return TRUE;
1441+}
1442+#endif
1443+
1444+QString KVimUtils::convertEncodingName(QString name)
1445+{
1446+ if (name.startsWith("ucs") || name.startsWith("utf-16")) return QString("utf16");
1447+ if (name=="cp950") return QString("Big5");
1448+ return QString();
1449+}
diff -r a81bc802c17c -r 4ac1dce8dd5e src/gui_kde_wid.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gui_kde_wid.h Mon Jul 26 12:53:41 2004 +0000
@@ -0,0 +1,245 @@
1+/* vi:set ts=8 sts=0 sw=8:
2+ *
3+ * VIM - Vi IMproved by Bram Moolenaar
4+ *
5+ * Do ":help uganda" in Vim to read copying and usage conditions.
6+ * Do ":help credits" in Vim to see a list of people who contributed.
7+ */
8+
9+/*
10+ * Porting to KDE(2) was done by
11+ *
12+ * (C) 2000 by Thomas Capricelli <orzel@freehackers.org>
13+ *
14+ * Please visit http://freehackers.org/kvim for other vim- or
15+ * kde-related coding.
16+ *
17+ * $Id$
18+ *
19+ */
20+
21+#ifndef GUI_KDE_WIDGET
22+#define GUI_KDE_WIDGET
23+
24+#if 1
25+#define dbf( format, args... ) { printf( "%s" " : " format "\n" , __FUNCTION__ , ## args ); fflush(stdout); }
26+#define db() { printf( "%s\n", __FUNCTION__ );fflush(stdout); }
27+#else
28+#define dbf(format, args... )
29+#define db()
30+#endif
31+
32+#define UNIX // prevent a warning : a symbol is defined twice in X and Qt
33+
34+#include <qdialog.h>
35+#include <qlabel.h>
36+#include <qsignalmapper.h>
37+#include <qtimer.h>
38+#include <qmainwindow.h>
39+#include <qapplication.h>
40+#include <qevent.h>
41+#include <qlineedit.h>
42+#include <qpainter.h>
43+#include <qwidget.h>
44+#include <qpopupmenu.h>
45+#include <klocale.h>
46+#include <kapp.h>
47+#include <kcmdlineargs.h>
48+#include <kaboutdata.h>
49+#include <keditcl.h>
50+#include <kaboutdata.h>
51+#if (KDE_VERSION>=290)
52+#include <kmainwindow.h>
53+#else
54+#include <ktmainwindow.h>
55+#endif
56+#include <kparts/part.h>
57+#include <kurl.h>
58+#include "kvim_iface.h"
59+
60+#undef UNIX // prevent a warning
61+extern "C" {
62+#include "vim.h"
63+}
64+
65+class QPushButton;
66+class QDialog;
67+class QLineEdit;
68+class QSignalMapper;
69+class QPaintEvent;
70+
71+enum BlinkState {
72+ BLINK_NONE,
73+ BLINK_ON,
74+ BLINK_OFF
75+};
76+
77+class VimWidget : public QWidget, virtual public KVim
78+{
79+ Q_OBJECT
80+
81+public:
82+ VimWidget( QWidget *parent=0, const char *name=0, WFlags f=0 );
83+ virtual void paintEvent( QPaintEvent *);
84+ void draw_string(int x, int y, QString s, int len, int flags);
85+
86+ /** Init the blinking time */
87+ void set_blink_time( long, long, long );
88+ void start_cursor_blinking();
89+ void stop_cursor_blinking();
90+ void wait(long);
91+#ifdef FEAT_CLIENTSERVER
92+ void serverActivate(WId id);
93+#endif
94+#ifdef FEAT_MZSCHEME
95+ void enable_mzscheme_threads();
96+ void disable_mzscheme_threads();
97+#endif
98+ void flash();
99+
100+ /** DCOP */
101+ void execNormal(QString command);
102+ void execInsert(QString command);
103+ void execRaw(QString command);
104+ void execCmd(QString command);
105+ QString eval(QString expr);
106+
107+ bool wait_done;
108+ BlinkState blink_state;
109+ QPainter *painter;
110+ QPopupMenu *menu;
111+
112+protected:
113+ virtual void keyPressEvent( QKeyEvent * );
114+ virtual void mousePressEvent( QMouseEvent *);
115+ virtual void mouseDoubleClickEvent( QMouseEvent *);
116+ virtual void mouseReleaseEvent( QMouseEvent *);
117+ virtual void mouseMoveEvent( QMouseEvent *);
118+ virtual void focusInEvent( QFocusEvent * );
119+ virtual void focusOutEvent( QFocusEvent * );
120+ virtual void dragEnterEvent (QDragEnterEvent *);
121+ virtual void dropEvent (QDropEvent *);
122+#ifdef FEAT_XIM
123+ virtual void imStartEvent ( QIMEvent * );
124+ virtual void imEndEvent ( QIMEvent * );
125+ virtual void imComposeEvent ( QIMEvent * );
126+#endif
127+#ifdef FEAT_MZSCHEME
128+ virtual void timerEvent( QTimerEvent * );
129+#endif
130+
131+ /* cursor blinking stuff */
132+ QTimer blink_timer;
133+ long blink_wait_time, blink_on_time, blink_off_time;
134+
135+ /* wait for input */
136+ QTimer wait_timer;
137+
138+#ifdef FEAT_MZSCHEME
139+ int mzscheme_timer_id;
140+#endif
141+
142+public slots:
143+ void blink_cursor();
144+ void wait_timeout();
145+};
146+
147+class VimMainWindow : public KMainWindow
148+{
149+ Q_OBJECT
150+
151+public:
152+ VimMainWindow ( const char *name = 0L, WFlags f = WDestructiveClose );
153+
154+ /** called when the widget closes */
155+// bool close(bool alsoDelete);
156+ VimWidget *w;
157+ KEdFind *finddlg;
158+ KEdReplace *repldlg;
159+ int have_tearoff;
160+ QTextCodec *codec;
161+
162+public slots:
163+ void menu_activated(int dx);
164+ void clipboard_selection_update();
165+ void clipboard_data_update();
166+ void slotSearch();
167+ void slotFind();
168+ void slotReplace();
169+ void slotReplaceAll();
170+ void showAboutApplication();
171+ void showAboutKDE();
172+ void showBugReport();
173+ void showTipOfTheDay();
174+ void buffersToolbar();
175+ bool isLocked();
176+ void lock();
177+ void unlock();
178+
179+protected:
180+ virtual void wheelEvent (QWheelEvent *);
181+ virtual void resizeEvent ( QResizeEvent *e );
182+
183+#if defined(FEAT_SESSION)
184+ void saveGlobalProperties (KConfig *conf);
185+ void readGlobalProperties (KConfig *conf);
186+#endif
187+ bool queryClose();
188+ bool queryExit();
189+ bool locked;
190+};
191+
192+
193+class VimDialog : public QDialog
194+{
195+ Q_OBJECT
196+public:
197+ VimDialog (int type, /* type of dialog */
198+ unsigned char * title, /* title of dialog */
199+ unsigned char * message, /* message text */
200+ unsigned char * buttons, /* names of buttons */
201+ int def_but, /* default button */
202+ char_u *textfield); /* input text */
203+private:
204+ QSignalMapper mapper;
205+ QLineEdit *entry;
206+ char_u *ret;
207+ int butNb;
208+
209+protected slots:
210+ void done(int);
211+};
212+
213+
214+/*
215+ * QScrollBar pool
216+ */
217+struct GuiScrollbar;
218+
219+class SBPool : public QObject
220+{
221+ Q_OBJECT
222+public:
223+ SBPool(void);
224+ void create(GuiScrollbar * sb, int orient);
225+ void destroy(GuiScrollbar * sb);
226+public slots:
227+ void sbUsed(int who);
228+private:
229+ QSignalMapper mapper;
230+};
231+
232+class KVimUtils {
233+public:
234+ static QString convertEncodingName(QString);
235+#if QT_VERSION<300
236+ static bool fromString(QFont*,QString);
237+ static QString toString(QFont*);
238+#endif
239+};
240+
241+extern VimMainWindow *vmw;
242+extern SBPool *sbpool;
243+extern QString *argServerName;
244+
245+#endif // GUI_KDE_WIDGET
diff -r a81bc802c17c -r 4ac1dce8dd5e src/gui_kde_widget.cc
--- a/src/gui_kde_widget.cc Mon Jul 19 20:55:54 2004 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1417 +0,0 @@
1-/* vi:set ts=8 sts=4 sw=4:
2- *
3- * VIM - Vi IMproved by Bram Moolenaar
4- *
5- * Do ":help uganda" in Vim to read copying and usage conditions.
6- * Do ":help credits" in Vim to see a list of people who contributed.
7- */
8-
9-/*
10- * Porting to KDE(2) was done by
11- *
12- * (C) 2000 by Thomas Capricelli <orzel@freehackers.org>
13- *
14- * Please visit http://freehackers.org/kvim for other vim- or
15- * kde-related coding.
16- *
17- * $Id$
18- *
19- */
20-
21-#include <assert.h>
22-#include <qpainter.h>
23-#include <qevent.h>
24-#include <qpushbutton.h>
25-#include <qscrollbar.h>
26-#include <qlayout.h>
27-#include <qclipboard.h>
28-#include <qdragobject.h>
29-#include <qstrlist.h>
30-#include <qmenubar.h>
31-#include <qtextcodec.h>
32-#if QT_VERSION>=300
33-#include <qptrlist.h>
34-#include <ktip.h>
35-#endif
36-#include <kglobal.h>
37-#include <kconfig.h>
38-#include <kaboutapplication.h>
39-#include <dcopclient.h>
40-#include <kaboutkde.h>
41-#include <kbugreport.h>
42-#include <kurldrag.h>
43-#include <kmenubar.h>
44-#include <ktoolbar.h>
45-#include <kstandarddirs.h>
46-#include "gui_kde_widget.h"
47-#include <qxembed.h>
48-
49-extern "C" {
50-#include "version.h"
51-}
52-
53-// Pixmap for dialog
54-#ifdef FEAT_GUI_DIALOG
55-# include "../../pixmaps/alert.xpm"
56-# include "../../pixmaps/error.xpm"
57-# include "../../pixmaps/generic.xpm"
58-# include "../../pixmaps/info.xpm"
59-# include "../../pixmaps/quest.xpm"
60-#endif
61-
62-/**
63- * Keycodes recognized by vim.
64- */
65-struct special_key {//{{{
66- int qtkey;
67- char_u code0;
68- char_u code1;
69-} special_keys[] =
70-{
71- { Qt::Key_Up, 'k', 'u' },
72- { Qt::Key_Down, 'k', 'd' },
73- { Qt::Key_Left, 'k', 'l' },
74- { Qt::Key_Right, 'k', 'r' },
75- { Qt::Key_F1, 'k', '1' },
76- { Qt::Key_F2, 'k', '2' },
77- { Qt::Key_F3, 'k', '3' },
78- { Qt::Key_F4, 'k', '4' },
79- { Qt::Key_F5, 'k', '5' },
80- { Qt::Key_F6, 'k', '6' },
81- { Qt::Key_F7, 'k', '7' },
82- { Qt::Key_F8, 'k', '8' },
83- { Qt::Key_F9, 'k', '9' },
84- { Qt::Key_F10, 'k', ';' },
85- { Qt::Key_F11, 'F', '1' },
86- { Qt::Key_F12, 'F', '2' },
87- { Qt::Key_F13, 'F', '3' },
88- { Qt::Key_F14, 'F', '4' },
89- { Qt::Key_F15, 'F', '5' },
90- { Qt::Key_F16, 'F', '6' },
91- { Qt::Key_F17, 'F', '7' },
92- { Qt::Key_F18, 'F', '8' },
93- { Qt::Key_F19, 'F', '9' },
94- { Qt::Key_F20, 'F', 'A' },
95- { Qt::Key_F21, 'F', 'B' },
96- { Qt::Key_F22, 'F', 'C' },
97- { Qt::Key_F23, 'F', 'D' },
98- { Qt::Key_F24, 'F', 'E' },
99- { Qt::Key_F25, 'F', 'F' },
100- { Qt::Key_F26, 'F', 'G' },
101- { Qt::Key_F27, 'F', 'H' },
102- { Qt::Key_F28, 'F', 'I' },
103- { Qt::Key_F29, 'F', 'J' },
104- { Qt::Key_F30, 'F', 'K' },
105- { Qt::Key_F31, 'F', 'L' },
106- { Qt::Key_F32, 'F', 'M' },
107- { Qt::Key_F33, 'F', 'N' },
108- { Qt::Key_F34, 'F', 'O' },
109- { Qt::Key_F35, 'F', 'P' },
110- { Qt::Key_Help, '%', '1' },
111- // { Qt::Key_Undo, '&', '8' }, <= hmmm ?
112- { Qt::Key_BackSpace, 'k', 'b' },
113- { Qt::Key_Insert, KS_EXTRA, KE_KINS },
114- { Qt::Key_Delete, KS_EXTRA, KE_KDEL },
115- { Qt::Key_Home, 'K', '1' },
116- { Qt::Key_End, 'K', '4' },
117- { Qt::Key_Prior, 'K', '3' },
118- { Qt::Key_Next, 'K', '5' },
119- { Qt::Key_Print, '%', '9' },
120-
121- { Qt::Key_Plus, 'K', '6'},
122- { Qt::Key_Minus, 'K', '7'},
123- { Qt::Key_Slash, 'K', '8'},
124- { Qt::Key_multiply, 'K', '9'},
125- { Qt::Key_Enter, 'K', 'A'},
126- { Qt::Key_Period, 'K', 'B'},
127-
128- { Qt::Key_0, 'K', 'C'},
129- { Qt::Key_1, 'K', 'D'},
130- { Qt::Key_2, 'K', 'E'},
131- { Qt::Key_3, 'K', 'F'},
132- { Qt::Key_4, 'K', 'G'},
133- { Qt::Key_5, 'K', 'H'},
134- { Qt::Key_6, 'K', 'I'},
135- { Qt::Key_7, 'K', 'J'},
136- { Qt::Key_8, 'K', 'K'},
137- { Qt::Key_9, 'K', 'L'},
138- /* End of list marker: */
139- { 0, 0, 0 }
140-};//}}}
141-
142-#ifdef FEAT_CLIENTSERVER
143-typedef int (*QX11EventFilter) (XEvent*);
144-extern QX11EventFilter qt_set_x11_event_filter (QX11EventFilter filter);
145-static QX11EventFilter oldFilter = 0;
146-static int kvim_x11_event_filter( XEvent* e);
147-#endif
148-void gui_keypress(QKeyEvent *e);
149-
150-/*
151- * Return OK if the key with the termcap name "name" is supported.
152- */
153- int
154-gui_mch_haskey(char_u * name)//{{{
155-{
156- for (int i=0; special_keys[i].qtkey != 0; i++)
157- if (name[0] == special_keys[i].code0 &&
158- name[1] == special_keys[i].code1)
159- return OK;
160- return FAIL;
161-}//}}}
162-
163-/*
164- * custom Frame for drawing ...
165- */
166-void VimWidget::paintEvent( QPaintEvent *e)//{{{
167-{
168- QRect r = e->rect();
169- gui_redraw(r.x(), r.y(), r.width(), r.height() );
170-}//}}}
171-
172-void VimWidget::draw_string(int x, int y, QString s, int len, int flags)//{{{
173-{
174- gui.current_font->setBold( flags & DRAW_BOLD );
175- gui.current_font->setUnderline( flags & DRAW_UNDERL );
176- gui.current_font->setItalic(flags & DRAW_ITALIC);
177- painter->setBackgroundMode( flags & DRAW_TRANSP ? Qt::TransparentMode : Qt::OpaqueMode);
178- painter->setFont( *(gui.current_font) );
179- painter->drawText( x, y, s, len);
180-}//}}}
181-
182-void VimWidget::mousePressEvent(QMouseEvent *event)//{{{
183-{
184- int button=0;
185- int modifiers=0;
186- ButtonState state = event->state();
187- ButtonState buttons = event->button();
188-
189- //Look at button states
190- if(buttons & QMouseEvent::LeftButton) {
191- button|=MOUSE_LEFT;
192- }
193- if(buttons & QMouseEvent::RightButton) {
194- button|=MOUSE_RIGHT;
195- }
196- if(buttons & QMouseEvent::MidButton) {
197- button|=MOUSE_MIDDLE;
198- }
199- //Look for keyboard modifiers
200- if(state & QMouseEvent::ShiftButton) {
201- modifiers|=MOUSE_SHIFT;
202- }
203- if(state & QMouseEvent::ControlButton){
204- modifiers|=MOUSE_CTRL;
205- }
206- if(state & QMouseEvent::AltButton){
207- modifiers|=MOUSE_ALT;
208- }
209- gui_send_mouse_event(button,event->x(),event->y(),FALSE,modifiers);
210-#if QT_VERSION>=300
211- QByteArray params;
212- QDataStream stream(params, IO_WriteOnly);
213- stream << kapp->dcopClient()->appId() << button << modifiers << gui.row << gui.col;
214- kapp->dcopClient()->emitDCOPSignal("mousePEvent(QCString,int,int,int,int)", params);
215-#endif
216- event->accept();
217-}//}}}
218-
219-#if defined(FEAT_SESSION)
220-void VimMainWindow::saveGlobalProperties (KConfig *conf)
221-{
222- //we write a mksession file to a file written in the user's ~/.kde/share/config/
223- //the name of the file in saved in 'conf'
224- //when restoring app, we source this file
225-#if 0 //disabled for release
226- QString filename = KGlobal::dirs()->localkdedir() + KGlobal::dirs()->kde_default("config") + kapp->randomString(10);
227- QString cmd("mksession ");
228- cmd+=filename;
229- do_cmdline_cmd((char_u*)cmd.latin1());
230- conf->writePathEntry("sessionfile", filename);
231- conf->sync();
232-#endif
233-}
234-
235-void VimMainWindow::readGlobalProperties (KConfig *conf)
236-{
237-#if 0
238- QString filename = conf->readPathEntry("sessionfile");
239- if (filename.isNull()) return;
240- QString cmd("source ");
241- cmd+=filename;
242- do_cmdline_cmd((char_u*)cmd.latin1());
243-#endif
244-}
245-#endif
246-
247-void VimMainWindow::wheelEvent (QWheelEvent *event)//{{{
248-{
249- ButtonState state = event->state();
250- int button=0;
251- int modifiers=0;
252-
253- if (event->delta()>0)
254- button|=MOUSE_4;
255- else button|=MOUSE_5;
256-
257- if(state & ShiftButton)
258- modifiers|=MOUSE_SHIFT;
259- if(state & ControlButton)
260- modifiers|=MOUSE_CTRL;
261- if(state & AltButton)
262- modifiers|=MOUSE_ALT;
263-
264- gui_send_mouse_event(button,event->x(),event->y(),FALSE,modifiers);
265-#if QT_VERSION>=300
266- QByteArray params;
267- QDataStream stream(params, IO_WriteOnly);
268- stream << kapp->dcopClient()->appId() << button << modifiers << gui.row << gui.col;
269- kapp->dcopClient()->emitDCOPSignal("mouseWhlEvent(QCString, int, int,int,int)", params);
270-#endif
271- event->accept();
272-}//}}}
273-
274-void VimWidget::mouseDoubleClickEvent(QMouseEvent *event)//{{{
275-{
276- ButtonState state = event->state();
277- ButtonState buttons = event->button();
278- int modifiers=0;
279- int button=0;
280-
281- //Look at button states
282- if(buttons & LeftButton)
283- button|=MOUSE_LEFT;
284- if(buttons & RightButton)
285- button|=MOUSE_RIGHT;
286- if(buttons & MidButton)
287- button|=MOUSE_MIDDLE;
288-
289- //Look for keyboard modifiers
290- if(state & ShiftButton)
291- modifiers|=MOUSE_SHIFT;
292- if(state & ControlButton)
293- modifiers|=MOUSE_CTRL;
294- if(state & AltButton)
295- modifiers|=MOUSE_ALT;
296-
297- gui_send_mouse_event(button,event->x(),event->y(),TRUE,modifiers);
298-#if QT_VERSION>=300
299- QByteArray params;
300- QDataStream stream(params, IO_WriteOnly);
301- stream << kapp->dcopClient()->appId() << button << modifiers << gui.row << gui.col;
302- kapp->dcopClient()->emitDCOPSignal("mouseDblClickEvent(QCString, int, int,int,int)", params);
303-#endif
304- event->accept();
305-}//}}}
306-
307-void VimWidget::mouseMoveEvent(QMouseEvent *event){//{{{
308- ButtonState state = event->state();
309- int modifiers=0;
310- int button=0;
311-
312- gui_mch_mousehide(FALSE);
313-
314- //Look at button states
315- //warning: we use state here, this is important !
316- if(state & QMouseEvent::LeftButton || state & QMouseEvent::RightButton || state & QMouseEvent::MidButton)
317- button|=MOUSE_DRAG;
318-
319- //Look for keyboard modifiers
320- if(state & ShiftButton)
321- modifiers|=MOUSE_SHIFT;
322- if(state & ControlButton)
323- modifiers|=MOUSE_CTRL;
324- if(state & AltButton)
325- modifiers|=MOUSE_ALT;
326- if (button!=MOUSE_DRAG)
327- gui_mouse_moved(event->x(),event->y());
328- else
329- gui_send_mouse_event(MOUSE_DRAG,event->x(),event->y(),FALSE,modifiers);
330-}//}}}
331-
332-void VimWidget::mouseReleaseEvent(QMouseEvent *event)//{{{
333-{
334- ButtonState state = event->state();
335- int modifiers=0;
336-
337- //Look for keyboard modifiers
338- if(state & ShiftButton)
339- modifiers|=MOUSE_SHIFT;
340- if(state & ControlButton)
341- modifiers|=MOUSE_CTRL;
342- if(state & AltButton)
343- modifiers|=MOUSE_ALT;
344-
345- gui_send_mouse_event(MOUSE_RELEASE,event->x(),event->y(),FALSE,modifiers);
346- event->accept();
347-}//}}}
348-
349-/*
350- * The main widget (everything but toolbar/menubar)
351- */
352- VimWidget::VimWidget( QWidget *parent, const char *name, WFlags f )//{{{
353-:QWidget(parent, name, f)
354- ,DCOPObject("KVim")
355-#ifdef FEAT_MZSCHEME
356- ,mzscheme_timer_id(-1)
357-#endif
358-{
359- //to be able to show/hide the cursor when moving the mouse
360- setMouseTracking(true);
361- painter=new QPainter(this);
362-
363- setKeyCompression(true);
364- setFocusPolicy( QWidget::StrongFocus );
365- setAcceptDrops(TRUE); // DND
366- blink_state = BLINK_NONE;
367- blink_on_time = 700;
368- blink_off_time = 400;
369- blink_wait_time = 250;
370- connect( &blink_timer, SIGNAL( timeout() ), SLOT( blink_cursor() ));
371- connect( &wait_timer, SIGNAL( timeout() ), SLOT ( wait_timeout() ));
372-}//}}}
373-
374-void VimWidget::execNormal(QString command)//{{{
375-{
376- QString cmd("execute 'normal ");
377- cmd+=command;
378- cmd+="'";
379- QCString unistring = vmw->codec->fromUnicode(cmd);
380- do_cmdline_cmd((char_u *)(const char*)unistring);
381- gui_update_screen();
382-}//}}}
383-
384-void VimWidget::execInsert(QString command)//{{{
385-{
386- QString cmd("execute 'normal i");
387- cmd+=command;
388- cmd+="'";
389- QCString unistring = vmw->codec->fromUnicode(cmd);
390- do_cmdline_cmd((char_u *)(const char*)unistring);
391- gui_update_screen();
392-}//}}}
393-
394-void VimWidget::execRaw(QString command)//{{{
395-{
396- QString cmd("execute '");
397- cmd+=command;
398- cmd+="'";
399- QCString unistring = vmw->codec->fromUnicode(cmd);
400- do_cmdline_cmd((char_u *)(const char*)unistring);
401- gui_update_screen();
402-}//}}}
403-
404-void VimWidget::execCmd(QString command)//{{{
405-{
406- QCString unistring = vmw->codec->fromUnicode(command);
407- do_cmdline_cmd((char_u *)(const char*)unistring);
408- gui_update_screen();
409-}//}}}
410-
411-QString VimWidget::eval(QString expr)//{{{
412-{
413-#ifdef FEAT_EVAL
414- QCString unistring = vmw->codec->fromUnicode(expr);
415- QString val((const char *)eval_to_string((char_u *)(const char*)unistring,NULL));
416- return val;
417-#else
418- return QString::null;
419-#endif
420-}//}}}
421-
422-void VimWidget::wait(long wtime)//{{{
423-{
424- if ( wait_timer.isActive() ) wait_timer.stop();
425- wait_done = false;
426- wait_timer.start( wtime, true);
427-}//}}}
428-
429-void VimWidget::wait_timeout() //{{{
430-{
431- wait_done = true;
432-}//}}}
433-
434-void VimWidget::dragEnterEvent (QDragEnterEvent *e)//{{{
435-{
436-#if (defined(FEAT_WINDOWS) && defined(HAVE_DROP_FILE)) || defined(PROTO)
437- e->accept(QUriDrag::canDecode(e));
438-#else
439- e->ignore();
440-#endif
441-}//}}}
442-
443-void VimWidget::dropEvent (QDropEvent *e) // {{{
444-{
445-#if (defined(FEAT_WINDOWS) && defined(HAVE_DROP_FILE)) || defined(PROTO)
446- QStrList urls;
447-
448- char_u **fnames;
449- int redo_dirs = FALSE;
450- int i;
451- int n;
452- int nfiles;
453- int url = FALSE;
454-
455- /* Count how many items there may be and normalize delimiters. */
456-
457- if (QUriDrag::decode(e, urls)) {
458- n = urls.count();
459- fnames = (char_u **)lalloc((n+1) * sizeof(char_u *), TRUE);
460- nfiles = 0;
461-#if QT_VERSION>=300
462- QPtrListIterator<char> it(urls);
463- for( ; it.current(); ++it ) {
464- KURL u(*it);
465-#else
466- for (i=0;i<urls.count();++i) {
467- KURL u(urls.at(i));
468-#endif
469- if ( !u.isLocalFile() )
470- url = TRUE;
471- else {
472- fnames[nfiles] = (char_u *)strdup((const char *)u.path());
473- ++nfiles;
474- }
475- }
476- /* Real files (i.e. not http and not ftp) */
477- if (url == FALSE)
478- {
479- if (nfiles == 1)
480- {
481- if (mch_isdir(fnames[0]))
482- {
483- /* Handle dropping a directory on Vim. */
484- if (mch_chdir((char *)fnames[0]) == 0)
485- {
486- free(fnames[0]);
487- fnames[0] = NULL;
488- redo_dirs = TRUE;
489- }
490- }
491- } else {
492- /* Ignore any directories */
493- for (i = 0; i < nfiles; ++i)
494- {
495- if (mch_isdir(fnames[i]))
496- {
497- vim_free(fnames[i]);
498- fnames[i] = NULL;
499- }
500- }
501- }
502-
503- if (0)
504- {
505- /* Shift held down, change to first file's directory */
506- if (fnames[0] != NULL && vim_chdirfile(fnames[0]) == OK)
507- redo_dirs = TRUE;
508- } else {
509- char_u dirname[MAXPATHL];
510- char_u *s;
511- if (mch_dirname(dirname, MAXPATHL) == OK)
512- for (i = 0; i < nfiles; ++i)
513- if (fnames[i] != NULL)
514- {
515- s = shorten_fname(fnames[i], dirname);
516- if (s != NULL && (s = vim_strsave(s)) != NULL)
517- {
518- vim_free(fnames[i]);
519- fnames[i] = s;
520- }
521- }
522- }
523- }
524-
525- /* Handle the drop, :edit or :split to get to the file */
526- handle_drop(nfiles, fnames, FALSE);
527-
528- if (redo_dirs)
529- shorten_fnames(TRUE);
530- }
531-
532- /* Update the screen display */
533- update_screen(NOT_VALID);
534-#ifdef FEAT_MENU
535- gui_update_menus(0);
536-#endif
537- setcursor();
538- out_flush();
539- gui_update_cursor(FALSE, FALSE);
540- gui_mch_flush();
541-#endif
542-} // }}}
543-
544-void VimWidget::keyPressEvent( QKeyEvent *e ) // {{{
545-{
546- gui_keypress(e);
547-} // }}}
548-
549-void gui_keypress(QKeyEvent *e) { // {{{
550- int key = (int)e->key();
551- int modifiers = 0,i;
552- uchar string[256],string2[256];
553- uchar *s,*d;
554- Qt::ButtonState state = e->state();
555-
556- QCString unistring = vmw->codec->fromUnicode(e->text());
557- if (unistring.length()>0)
558- strncpy((char*)string, (const char*)unistring,unistring.length());
559- string[unistring.length()] = 0;
560- int len=unistring.length();
561-
562- // ignore certain keys
563- if (key == Qt::Key_Shift || key == Qt::Key_Alt || key == Qt::Key_Control || key == Qt::Key_Meta
564- || key == Qt::Key_CapsLock || key == Qt::Key_NumLock || key == Qt::Key_ScrollLock ) {
565- e->ignore();
566- return;
567- }
568-
569-#ifdef FEAT_MBYTE
570- if (input_conv.vc_type != CONV_NONE)
571- {
572- mch_memmove(string2, string, len);
573- len = convert_input(string2, len, sizeof(string2));
574- s = string2;
575- }
576- else
577-#endif
578- s = string;
579- d = string;
580- for (i = 0; i < len; ++i)
581- {
582- *d++ = s[i];
583- if (d[-1] == CSI && d + 2 < string + sizeof(string))
584- {
585- /* Turn CSI into K_CSI. */
586- *d++ = KS_EXTRA;
587- *d++ = (int)KE_CSI;
588- }
589- }
590- len = d - string;
591-
592-
593- // change shift-tab (backtab) into S_TAB
594- if ( key == Qt::Key_BackTab && state & Qt::ShiftButton) {
595- key = Qt::Key_Tab;
596- }
597-
598- // Change C-@ and C-2 in NUL ? Gtk does this
599- if ( (key == Qt::Key_2 || key == Qt::Key_At)
600- && state & Qt::ControlButton ) {
601- string[0] = NUL;
602- len = 1;
603- }
604- else if (len == 0 && (key == Qt::Key_Space || key == Qt::Key_Tab))
605- {
606- /* When there are modifiers, these keys get zero length; we need the
607- * original key here to be able to add a modifier below. */
608- string[0] = (key & 0xff);
609- len = 1;
610- }
611- /* Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character
612- * that already has the 8th bit set.
613- * Don't do this for <S-M-Tab>, that should become K_S_TAB with ALT. */
614- if (len == 1
615- && (key != Qt::Key_BackSpace && key != Qt::Key_Delete)
616- && (string[0] & 0x80) == 0
617- && (state & Qt::AltButton)
618- && !(key == Qt::Key_Tab && (state & Qt::ShiftButton)))
619- {
620- string[0] |= 0x80;
621-#ifdef FEAT_MBYTE
622- if (enc_utf8) // convert to utf-8
623- {
624- string[1] = string[0] & 0xbf;
625- string[0] = ((unsigned)string[0] >> 6) + 0xc0;
626- if (string[1] == CSI)
627- {
628- string[2] = KS_EXTRA;
629- string[3] = (int)KE_CSI;
630- len = 4;
631- }
632- else
633- len = 2;
634- }
635-#endif
636- }
637-
638- /* Check for special keys, making sure BS and DEL are recognised. */
639- if (len == 0 || key == Qt::Key_BackSpace || key == Qt::Key_Delete)
640- {
641- while (special_keys[i].qtkey != 0 && special_keys[i].qtkey != key ) i++;
642- if (special_keys[i].qtkey != 0) {
643- string[0] = CSI;
644- string[1] = special_keys[i].code0;
645- string[2] = special_keys[i].code1;
646- len = -3;
647- }
648-/*
649- for (i = 0; special_keys[i].qtkey != 0 ; i++)
650- {
651- if (special_keys[i].qtkey == key ) {
652- string[0] = CSI;
653- string[1] = special_keys[i].code0;
654- string[2] = special_keys[i].code1;
655- len = -3;
656- break;
657- }
658- }*/
659- }
660-
661- if (len == 0) {
662- //no need to dump that, that's a QT problem, we can't do anything
663- //dbf("Unrecognised Key : %X %s", key, e->text().latin1());
664- e->ignore();
665- return;
666- }
667-
668-
669- /* Special keys (and a few others) may have modifiers */
670- if (len == -3 || key == Qt::Key_Space || key == Qt::Key_Tab ||
671- key == Qt::Key_Return || key == Qt::Key_Enter ||
672- key == Qt::Key_Escape) {
673-
674- modifiers = 0;
675- if (state & Qt::ShiftButton) modifiers |= MOD_MASK_SHIFT;
676- if (state & Qt::ControlButton) modifiers |= MOD_MASK_CTRL;
677- if (state & Qt::AltButton) modifiers |= MOD_MASK_ALT;
678-
679- /*
680- * For some keys a shift modifier is translated into another key
681- * code. Do we need to handle the case where len != 1 and
682- * string[0] != CSI?
683- */
684- if (len == -3)
685- key = TO_SPECIAL(string[1], string[2]);
686- else
687- key = string[0];
688-
689- key = simplify_key(key, &modifiers);
690- if (key == CSI) key=K_CSI;
691-
692- if (IS_SPECIAL(key)) {
693- string[0] = CSI;
694- string[1] = K_SECOND(key);
695- string[2] = K_THIRD(key);
696- len = 3;
697- } else {
698- string[0] = key;
699- len = 1;
700- }
701-
702-
703- if (modifiers!=0) {
704- uchar string2[10];
705- string2[0] = CSI;
706- string2[1] = KS_MODIFIER;
707- string2[2] = modifiers;
708- add_to_input_buf(string2, 3);
709- }
710-
711- } /* special keys */
712-
713- if (len == 1 && ((string[0] == Ctrl_C && ctrl_c_interrupts)
714- || (string[0] == intr_char && intr_char != Ctrl_C)))
715- {
716- trash_input_buf();
717- got_int = TRUE;
718- }
719-
720- add_to_input_buf(string, len);
721- if (p_mh) {
722- gui_mch_mousehide(TRUE);
723- }
724- //DCOP Embedding stuff
725- //if we are here then the user has type something in the window, thus we can easily imagine that :
726- // 1 - text has changed (emit textChanged())
727- // 2 - characters were interactively inserted (emit charactersInteractivelyInserted())
728- // 3 - cursor position has changed ( emit cursorPositionChanged() )
729- // 4 - selection has changed ? dunno yet //XXX
730- // 5 - undo changed too ? (each character typed in makes the undo changes anyway)
731- // conclusion : this makes a lot of things to send to the vim kpart, maybe too much
732- // for now i'll just send : keyboardEvent to the kpart with the event string as parameter,
733- // with current current position
734- // i'll do the same for mouseEvents
735-#if QT_VERSION>=300
736- QByteArray params;
737- QDataStream stream(params, IO_WriteOnly);
738- stream << kapp->dcopClient()->appId() << unistring << gui.row << gui.col;
739- kapp->dcopClient()->emitDCOPSignal("keyboardEvent(QCString, QCString,int,int)", params);
740-#endif
741- e->ignore();
742-} // }}}
743-
744-#ifdef FEAT_CLIENTSERVER
745-void VimWidget::serverActivate(WId id) //{{{
746-{
747- if (serverName == NULL && serverDelayedStartName != NULL) {
748- commWindow = id;
749- (void)serverRegisterName(qt_xdisplay(), serverDelayedStartName);
750- } else {
751- serverChangeRegisteredWindow( qt_xdisplay(), id );
752- }
753-}//}}}
754-#endif
755-
756-#ifdef FEAT_XIM
757-void VimWidget::imStartEvent(QIMEvent *e) {
758- e->accept();
759-}
760-
761-void VimWidget::imEndEvent(QIMEvent *e) {
762- uchar string[256];
763-
764- QCString unistring = vmw->codec->fromUnicode(e->text());
765- if (unistring.length()>0)
766- strncpy((char*)string, (const char*)unistring,unistring.length());
767- string[unistring.length()] = 0;
768- int len=unistring.length();
769-
770- add_to_input_buf(string, len);
771- e->accept();
772-}
773-
774-void VimWidget::imComposeEvent(QIMEvent *e) {
775- //i should do something here, displaying the text somewhere ... (status area ?)
776- e->accept();
777-}
778-#endif
779-
780-
781-void VimMainWindow::lock()
782-{
783- locked=true;
784-}
785-
786-void VimMainWindow::unlock()
787-{
788- locked=false;
789-}
790-
791-bool VimMainWindow::isLocked()
792-{
793- return locked;
794-}
795-
796-// ->resize VimWidget if not locked
797-//
798-void VimMainWindow::resizeEvent ( QResizeEvent *e ) //{{{
799-{
800- if ( vmw->isLocked() ) return;
801- //remove toolbar and menubar height
802- int height = e->size().height();
803- int width = e->size().width();
804-
805- if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled()
806-#if QT_VERSION>=300
807- && !vmw->menuBar()->isTopLevelMenu()
808-#endif
809- )
810- height -= vmw->menuBar()->height();
811-#ifdef FEAT_TOOLBAR
812- if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
813- (vmw->toolBar()->barPos()==KToolBar::Top ||
814- vmw->toolBar()->barPos()==KToolBar::Bottom))
815- height -= vmw->toolBar()->height();
816-
817- if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
818- (vmw->toolBar()->barPos()==KToolBar::Left ||
819- vmw->toolBar()->barPos()==KToolBar::Right))
820- width -= vmw->toolBar()->width();
821-#endif
822- height = ( ((int)(height/gui.char_height))*gui.char_height );
823- if (!vmw->isLocked()) gui_resize_shell(width,height);
824-}//}}}
825-
826-void VimWidget::focusInEvent( QFocusEvent * fe ) // {{{
827-{
828- gui_focus_change(true);
829-
830- if (blink_state == BLINK_NONE)
831- gui_mch_start_blink();
832-} // }}}
833-
834-void VimWidget::focusOutEvent( QFocusEvent * fe )//{{{
835-{
836- gui_focus_change(false);
837-
838- if (blink_state != BLINK_NONE)
839- gui_mch_stop_blink();
840-}//}}}
841-
842-void VimWidget::set_blink_time( long wait, long on, long off)//{{{
843-{
844- blink_wait_time = wait;
845- blink_on_time = on;
846- blink_off_time = off;
847-}//}}}
848-
849-void VimWidget::start_cursor_blinking()//{{{
850-{
851- if (blink_timer.isActive()) blink_timer.stop();
852-
853- /* Only switch blinking on if none of the times is zero */
854- if (blink_wait_time && blink_on_time && blink_off_time && gui.in_focus) {
855- blink_state = BLINK_ON;
856- gui_update_cursor(TRUE, FALSE);
857- // The first blink appears after wait_time
858- blink_timer.start( blink_wait_time, true);
859- }
860-}//}}}
861-
862-void VimWidget::blink_cursor()//{{{
863-{
864- if (blink_state == BLINK_ON) {
865- // set cursor off
866- gui_undraw_cursor();
867- blink_state = BLINK_OFF;
868- blink_timer.start( blink_off_time, true);
869- } else {
870- // set cursor on
871- gui_update_cursor(TRUE, FALSE);
872- blink_state = BLINK_ON;
873- blink_timer.start( blink_on_time, true);
874- }
875-}//}}}
876-
877-void VimWidget::stop_cursor_blinking()//{{{
878-{
879- if (blink_timer.isActive()) blink_timer.stop();
880-
881- if (blink_state == BLINK_OFF)
882- gui_update_cursor(TRUE, FALSE);
883-
884- blink_state = BLINK_NONE;
885-}//}}}
886-
887-#ifdef FEAT_MZSCHEME
888-void VimWidget::timerEvent( QTimerEvent * evnt)//{{{
889-{
890- if (evnt->timerId() == mzscheme_timer_id)
891- timer_proc();
892-}//}}}
893-
894-void VimWidget::enable_mzscheme_threads()//{{{
895-{
896- mzscheme_timer_id = startTimer(p_mzq);
897-}//}}}
898-
899-void VimWidget::disable_mzscheme_threads()//{{{
900-{
901- killTimer(mzscheme_timer_id);
902-}//}}}
903-#endif
904-
905-void VimWidget::flash()//{{{
906-{
907- QPainter p(this);
908-
909- p.setRasterOp(Qt::XorROP);
910- p.fillRect(geometry(),QColor(0xFF,0xFF,0xFF));
911- p.flush();
912- //FIXME: Make this a little smarter. Maybe add a timer or something
913- usleep(19000);
914- p.fillRect(geometry(),QColor(0xFF,0xFF,0xFF));
915- p.flush();
916- p.end();
917-}//}}}
918-
919-
920-/*
921- * The main Window
922- */
923- VimMainWindow::VimMainWindow ( const char *name , WFlags f)//{{{
924-:KMainWindow(0L, name,f)
925-{
926-#ifdef FEAT_CLIENTSERVER
927- oldFilter = qt_set_x11_event_filter( kvim_x11_event_filter );
928-#endif
929- if (echo_wid_arg== 1) {
930- fprintf(stderr, "WID: %ld\n", (long)winId());
931- fflush(stderr);
932- }
933-
934- w = new VimWidget(this, "main vim widget");
935- gui.w = w;
936- setFocusProxy(w);
937- w->setFocus();
938- have_tearoff=0;
939-
940- finddlg=new KEdFind (this,0,false);
941- repldlg=new KEdReplace (this,0,false);
942- QObject::connect( finddlg, SIGNAL(search()), this, SLOT(slotSearch()) );
943- QObject::connect( repldlg, SIGNAL(find()), this, SLOT(slotFind()) );
944- QObject::connect( repldlg, SIGNAL(replace()), this, SLOT(slotReplace()) );
945- QObject::connect( repldlg, SIGNAL(replaceAll()), this, SLOT(slotReplaceAll()) );
946-
947-#ifdef FEAT_TOOLBAR
948- connect(toolBar(), SIGNAL(clicked(int)), this, SLOT(menu_activated(int)));
949-#endif
950-#ifdef FEAT_CLIENTSERVER
951- w->serverActivate(winId());
952-
953- if (serverName!=NULL)
954- kapp->dcopClient()->registerAs(QCString((const char*)serverName),false);
955- else if (serverDelayedStartName!=NULL)
956- kapp->dcopClient()->registerAs(QCString((const char*)serverDelayedStartName),false);
957- else if (argServerName!=NULL)
958- kapp->dcopClient()->registerAs(argServerName->utf8(),false);
959-#else
960- if (argServerName!=NULL)
961- kapp->dcopClient()->registerAs(argServerName->utf8(),false);
962-#endif
963- QXEmbed::initialize();
964-
965-}//{{{
966-
967-bool VimMainWindow::queryClose()//{{{
968-{
969- gui_shell_closed();
970- return true;
971-}//}}}
972-
973-bool VimMainWindow::queryExit()//{{{
974-{
975- return true;
976-}//}}}
977-
978-void VimMainWindow::menu_activated(int dx)//{{{
979-{
980-#ifdef FEAT_MENU
981- if (!dx) { // tearoff
982- return;
983- }
984- gui_mch_set_foreground();
985- gui_menu_cb((VimMenu *) dx);
986-#endif
987-}//}}}
988-
989-
990-void VimMainWindow::clipboard_selection_update(){//{{{
991- if(kapp->clipboard()->ownsSelection()) {
992- clip_own_selection(&clip_star);
993- } else {
994- clip_lose_selection(&clip_star);
995- }
996-}//}}}
997-
998-void VimMainWindow::clipboard_data_update(){//{{{
999-#if QT_VERSION>=300
1000- if (kapp->clipboard()->ownsClipboard()) {
1001- clip_own_selection(&clip_plus);
1002- } else {
1003- clip_lose_selection(&clip_plus);
1004- }
1005-#else
1006- if (kapp->clipboard()->ownsSelection()) {
1007- clip_own_selection(&clip_star);
1008- } else {
1009- clip_lose_selection(&clip_star);
1010- }
1011-#endif
1012-}//}}}
1013-
1014-void VimMainWindow::slotSearch()//{{{
1015-{
1016- QString find_text;
1017- bool direction_down = TRUE;
1018- bool casesensitive = TRUE;
1019- int flags = FRD_FINDNEXT;
1020-
1021- find_text = finddlg->getText();
1022- direction_down = !(finddlg->get_direction());
1023- casesensitive = finddlg->case_sensitive();
1024- // if (casesensitive) find_text = "\\C" + find_text;
1025- // else find_text = "\\c" + find_text;
1026- if (casesensitive) flags|=FRD_MATCH_CASE;
1027- QCString unistring = vmw->codec->fromUnicode(find_text);
1028- gui_do_findrepl(flags, (char_u *)(const char *)unistring, NULL,(int)direction_down);
1029-}//}}}
1030-
1031-void VimMainWindow::slotFind()//{{{
1032-{
1033- QString find_text;
1034- bool direction_down=TRUE;
1035- bool casesensitive = TRUE;
1036- int flags = FRD_R_FINDNEXT;
1037-
1038- find_text=repldlg->getText();
1039- direction_down = !(repldlg->get_direction());
1040- casesensitive = repldlg->case_sensitive();
1041- // if (casesensitive) find_text = "\\C" + find_text;
1042- // else find_text = "\\c" + find_text;
1043- if (casesensitive) flags|=FRD_MATCH_CASE;
1044-
1045- QCString unistring = vmw->codec->fromUnicode(find_text);
1046- gui_do_findrepl(flags, (char_u *)(const char *)unistring, NULL,(int)direction_down);
1047-}//}}}
1048-
1049-void VimMainWindow::slotReplace()//{{{
1050-{
1051- QString find_text;
1052- QString repl_text;
1053- bool direction_down=TRUE;
1054- bool casesensitive = TRUE;
1055- int flags = FRD_REPLACE;
1056-
1057- find_text=repldlg->getText();
1058- repl_text=repldlg->getReplaceText();
1059- direction_down = !(repldlg->get_direction());
1060- //if (casesensitive) find_text = "\\C" + find_text;
1061- //else find_text = "\\c" + find_text;
1062- if (casesensitive) flags|=FRD_MATCH_CASE;
1063-
1064- QCString unistring = vmw->codec->fromUnicode(find_text);
1065- QCString unistring2 = vmw->codec->fromUnicode(repl_text);
1066- gui_do_findrepl(flags, (char_u *)(const char *)unistring,(char_u *)(const char*)unistring2,(int)direction_down);
1067-}//}}}
1068-
1069-void VimMainWindow::slotReplaceAll()//{{{
1070-{
1071- QString find_text;
1072- QString repl_text;
1073- bool direction_down=TRUE;
1074- bool casesensitive = TRUE;
1075- int flags = FRD_REPLACEALL;
1076-
1077- find_text=repldlg->getText();
1078- repl_text=repldlg->getReplaceText();
1079- direction_down = !(repldlg->get_direction());
1080- casesensitive = repldlg->case_sensitive();
1081- // if (casesensitive) find_text = "\\C" + find_text;
1082- // else find_text = "\\c" + find_text;
1083- if (casesensitive) flags|=FRD_MATCH_CASE;
1084- QCString unistring = vmw->codec->fromUnicode(find_text);
1085- QCString unistring2 = vmw->codec->fromUnicode(repl_text);
1086- gui_do_findrepl(flags, (char_u *)(const char *)unistring,(char_u *)(const char*)unistring2,(int)direction_down);
1087-}//}}}
1088-
1089-void VimMainWindow::showAboutKDE()
1090-{
1091- KAboutKDE *kde = new KAboutKDE(this);
1092- kde->show();
1093-}
1094-
1095-void VimMainWindow::showAboutApplication()//{{{
1096-{
1097- KAboutData *aboutData = new KAboutData (
1098- "kvim"
1099- , I18N_NOOP("KVim")
1100- , VIM_VERSION_SHORT
1101- , I18N_NOOP("Vim in a KDE interface")
1102- , 0
1103- , "(c) Vim Team, \":help credits\" for more infos.\nType \":help iccf\" to see how you can help the children in Uganda"
1104- , 0l
1105- , "http://freehackers.org/kvim"
1106- , "kvim-dev@freenux.org"
1107- );
1108-
1109- aboutData->addAuthor("Bram Moolenaar",
1110- I18N_NOOP("Main vim author"),
1111- "Bram@vim.org",
1112- "http://www.vim.org/");
1113- aboutData->addAuthor("Thomas Capricelli",
1114- I18N_NOOP("KDE porting"),
1115- "orzel@freehackers.org",
1116- "http://orzel.freehackers.org");
1117- aboutData->addAuthor("Philippe Fremy",
1118- I18N_NOOP("KDE porting"),
1119- "pfremy@chez.com",
1120- "http://www.freehackers.org/kvim");
1121- aboutData->addAuthor("Mark Westcott",
1122- I18N_NOOP("Qtopia porting, maintainer of the Qtopia part"),
1123- "mark@houseoffish.org",
1124- "http://houseoffish.org");
1125- aboutData->addAuthor("Mickael Marchand",
1126- I18N_NOOP("KDE porting, maintainer"),
1127- "marchand@kde.org",
1128- "http://freenux.org");
1129- aboutData->addAuthor("Many other people",
1130- I18N_NOOP("type :help credits for more infos")
1131- );
1132- aboutData->addCredit("Vince Negri",
1133- I18N_NOOP("Antialiasing support, Color fixes"),
1134- "vnegri@asl-electronics.co.uk");
1135- aboutData->addCredit("Malte Starostik",
1136- I18N_NOOP("Patch for performance improvement"),
1137- "malte@kde.org");
1138- aboutData->addCredit("Mark Stosberg",
1139- I18N_NOOP("Provided a FreeBSD box to debug KVim on BSD"),
1140- "mark@summersault.com"
1141- );
1142- aboutData->addCredit("Henrik Skott",
1143- I18N_NOOP("Font patch when KDE not configured"),
1144- "henrik.skott@hem.utfors.se"
1145- );
1146- aboutData->addCredit("Kailash Sethuraman",
1147- I18N_NOOP("NetBSD configure/compilation fixes")
1148- );
1149- aboutData->setLicenseText(
1150-"KVim as an extension of Vim follows Vim license : \n\
1151-Vim is Charityware. You can use and copy it as much as you like, but you are\n\
1152-encouraged to make a donation to orphans in Uganda. Please read the file\n\
1153-runtime/doc/uganda.txt for details.\n\
1154-\n\
1155-There are no restrictions on distributing an unmodified copy of Vim. Parts of\n\
1156-Vim may also be distributed, but this text must always be included. You are\n\
1157-allowed to include executables that you made from the unmodified Vim sources,\n\
1158-your own usage examples and Vim scripts.\n\
1159-\n\
1160-If you distribute a modified version of Vim, you are encouraged to send the\n\
1161-maintainer a copy, including the source code. Or make it available to the\n\
1162-maintainer through ftp; let him know where it can be found. If the number of\n\
1163-changes is small (e.g., a modified Makefile) e-mailing the diffs will do.\n\
1164-When the maintainer asks for it (in any way) you must make your changes,\n\
1165-including source code, available to him.\n\
1166-\n\
1167-The maintainer reserves the right to include any changes in the official\n\
1168-version of Vim. This is negotiable. You are not allowed to distribute a\n\
1169-modified version of Vim when you are not willing to make the source code\n\
1170-available to the maintainer.\n\
1171-\n\
1172-The current maintainer is Bram Moolenaar <Bram@vim.org>. If this changes, it\n\
1173-will be announced in appropriate places (most likely www.vim.org and\n\
1174-comp.editors). When it is completely impossible to contact the maintainer,\n\
1175-the obligation to send him modified source code ceases.\n\
1176-\n\
1177-It is not allowed to remove these restrictions from the distribution of the\n\
1178-Vim sources or parts of it. These restrictions may also be used for previous\n\
1179-Vim releases instead of the text that was included with it.");
1180-
1181- KAboutApplication *about = new KAboutApplication(aboutData);
1182- about->show();
1183-}//}}}
1184-
1185-void VimMainWindow::showTipOfTheDay() {
1186-#if QT_VERSION>=300
1187- KTipDialog::showTip (vmw,QString::null,true);
1188-#endif
1189-}
1190-
1191-void VimMainWindow::buffersToolbar() {
1192-
1193-}
1194-
1195-void VimMainWindow::showBugReport() {
1196- KBugReport *bug= new KBugReport(this,true);
1197- bug->show();
1198-}
1199-/*
1200- * Vim Dialog
1201- *
1202- * Returns:
1203- * 0: Cancel
1204- * 1- : nb of the pressed button
1205- */
1206-
1207-VimDialog::VimDialog (int type, /* type of dialog *///{{{
1208- char_u * title, /* title of dialog */
1209- char_u * message, /* message text */
1210- char_u * buttons, /* names of buttons */
1211- int def_but, /* default button */
1212- char_u *textfield ) /* input field */
1213-:QDialog(vmw, "vim generic dialog", true), // true is for "modal"
1214- mapper(this, "dialog signal mapper")
1215-{
1216- /*
1217- * Create Icon
1218- */
1219- char ** icon_data;
1220- switch (type) {
1221- case VIM_GENERIC:
1222- icon_data = generic_xpm;
1223- break;
1224- case VIM_ERROR:
1225- icon_data = error_xpm;
1226- break;
1227- case VIM_WARNING:
1228- icon_data = alert_xpm;
1229- break;
1230- case VIM_INFO:
1231- icon_data = info_xpm;
1232- break;
1233- case VIM_QUESTION:
1234- icon_data = quest_xpm;
1235- break;
1236- default:
1237- icon_data = generic_xpm;
1238- };
1239- QLabel * icon = new QLabel( this );
1240- icon->setPixmap( QPixmap( (const char **) icon_data ) );
1241- icon->setFixedSize( icon->sizeHint() );
1242-
1243- QLabel * text = new QLabel( (const char *)message, this );
1244- text->setAlignment( AlignHCenter | AlignVCenter | ExpandTabs );
1245-
1246- QStringList buttonText = QStringList::split( DLG_BUTTON_SEP, (char *) buttons);
1247- int butNb = buttonText.count();
1248-
1249- /*
1250- * Layout
1251- */
1252-
1253- QVBoxLayout * vly = new QVBoxLayout( this, 5, 5 );
1254- QHBoxLayout * hly1 = new QHBoxLayout( vly, 5);
1255- hly1->addWidget( icon );
1256- hly1->addWidget( text );
1257- QHBoxLayout * hly3 = new QHBoxLayout ( vly , 5);
1258- if (textfield!=NULL) {
1259- entry = new QLineEdit((const char *)textfield,this);
1260- entry->setText((const char *)textfield);
1261- hly3->addWidget( entry );
1262- ret=textfield;
1263- } else entry=NULL;
1264-
1265- QHBoxLayout * hly2 = new QHBoxLayout( vly, 15);
1266- QString s;
1267- QPushButton * pushButton = 0L;
1268- for( int i=0; i<butNb; i++) {
1269- s = buttonText[i];
1270- pushButton = new QPushButton(s, this );
1271- if (s.find('&') != -1) {
1272- pushButton->setAccel( s.at(s.find('&')+1).latin1() );
1273- }
1274-
1275- hly2->addWidget( pushButton );
1276- if (i == def_but-1) {
1277- pushButton->setDefault( true );
1278- pushButton->setAutoDefault( true );
1279- setResult( i+1 );
1280- }
1281- connect(pushButton, SIGNAL(clicked()), &mapper, SLOT(map()));
1282- mapper.setMapping(pushButton, i+1);
1283- }
1284- connect( &mapper, SIGNAL(mapped(int)), this, SLOT(done(int)));
1285-
1286- setCaption((const char *) title);
1287-
1288- vly->activate();
1289-}//}}}
1290-
1291-void VimDialog::done(int r) {
1292- if (entry!=NULL) {
1293- if (r) {
1294- QCString unistring=vmw->codec->fromUnicode(entry->text());
1295- STRCPY(ret,(const char*)unistring);
1296- } else
1297- *ret=NUL;
1298- }
1299- QDialog::done(r);
1300-}
1301-
1302-/*
1303- * ScrollBar pool handling
1304- */
1305-SBPool::SBPool(void)//{{{
1306- :mapper(this, "SBPool signal mapper")
1307-{
1308- connect(&mapper, SIGNAL(mapped(int)), this, SLOT(sbUsed(int)));
1309-}//}}}
1310-
1311-
1312-void SBPool::create(GuiScrollbar * sb, int orient)//{{{
1313-{
1314- switch(orient) {
1315- case SBAR_HORIZ:
1316- sb->w = new QScrollBar(QScrollBar::Horizontal, vmw);
1317- break;
1318- case SBAR_VERT:
1319- sb->w = new QScrollBar(QScrollBar::Vertical, vmw);
1320- break;
1321- default:
1322- sb->w = 0;
1323- return;
1324- }
1325-
1326- connect(sb->w, SIGNAL(valueChanged(int)), &mapper, SLOT(map()));
1327- mapper.setMapping(sb->w, (int)sb);
1328-}//}}}
1329-
1330-
1331-void SBPool::sbUsed(int who)//{{{
1332-{
1333- GuiScrollbar *sb = (GuiScrollbar*)who;
1334- gui_drag_scrollbar( sb, sb->w->value(), FALSE);
1335-}//}}}
1336-
1337-
1338-void SBPool::destroy(GuiScrollbar * sb)//{{{
1339-{
1340- if (!sb->w) return;
1341-
1342- delete sb->w;
1343- sb->w = 0;
1344-}//}}}
1345-
1346-#ifdef FEAT_CLIENTSERVER
1347-static int kvim_x11_event_filter( XEvent* e)//{{{
1348-{
1349- if (e->xproperty.type == PropertyNotify
1350- && e->xproperty.atom == commProperty
1351- && e->xproperty.window == commWindow
1352- && e->xproperty.state == PropertyNewValue ) {
1353- serverEventProc(qt_xdisplay(), e);
1354- }
1355-
1356- if (oldFilter) return oldFilter( e );
1357- return FALSE;
1358-}//}}}
1359-#endif
1360-
1361-//add some QT 3 fonts usefull functions
1362-#if QT_VERSION<300
1363-QString KVimUtils::toString(QFont *f)
1364-{
1365- QStringList l;
1366- l.append(f->family());
1367- l.append(QString::number(f->pointSize()));
1368- l.append(QString::number(f->pixelSize()));
1369- l.append(QString::number((int)f->styleHint()));
1370- l.append(QString::number(f->weight()));
1371- l.append(QString::number((int)f->italic()));
1372- l.append(QString::number((int)f->underline()));
1373- l.append(QString::number((int)f->strikeOut()));
1374- l.append(QString::number((int)f->fixedPitch()));
1375- l.append(QString::number((int)f->rawMode()));
1376- return l.join(",");
1377-}
1378-
1379-bool KVimUtils::fromString(QFont *f, QString descrip)
1380-{
1381- QStringList l(QStringList::split(',', descrip));
1382-
1383- int count = l.count();
1384- if (count != 10 && count != 9) {
1385- return FALSE;
1386- }
1387-
1388- f->setFamily(l[0]);
1389- f->setPointSize(l[1].toInt());
1390- if ( count == 9 ) {
1391- f->setStyleHint((QFont::StyleHint) l[2].toInt());
1392- f->setWeight(l[3].toInt());
1393- f->setItalic(l[4].toInt());
1394- f->setUnderline(l[5].toInt());
1395- f->setStrikeOut(l[6].toInt());
1396- f->setFixedPitch(l[7].toInt());
1397- f->setRawMode(l[8].toInt());
1398- } else {
1399- f->setPixelSize(l[2].toInt());
1400- f->setStyleHint((QFont::StyleHint) l[3].toInt());
1401- f->setWeight(l[4].toInt());
1402- f->setItalic(l[5].toInt());
1403- f->setUnderline(l[6].toInt());
1404- f->setStrikeOut(l[7].toInt());
1405- f->setFixedPitch(l[8].toInt());
1406- f->setRawMode(l[9].toInt());
1407- }
1408- return TRUE;
1409-}
1410-#endif
1411-
1412-QString KVimUtils::convertEncodingName(QString name)
1413-{
1414- if (name.startsWith("ucs") || name.startsWith("utf-16")) return QString("utf16");
1415- if (name=="cp950") return QString("Big5");
1416- return QString();
1417-}
diff -r a81bc802c17c -r 4ac1dce8dd5e src/gui_kde_widget.h
--- a/src/gui_kde_widget.h Mon Jul 19 20:55:54 2004 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,245 +0,0 @@
1-/* vi:set ts=8 sts=0 sw=8:
2- *
3- * VIM - Vi IMproved by Bram Moolenaar
4- *
5- * Do ":help uganda" in Vim to read copying and usage conditions.
6- * Do ":help credits" in Vim to see a list of people who contributed.
7- */
8-
9-/*
10- * Porting to KDE(2) was done by
11- *
12- * (C) 2000 by Thomas Capricelli <orzel@freehackers.org>
13- *
14- * Please visit http://freehackers.org/kvim for other vim- or
15- * kde-related coding.
16- *
17- * $Id$
18- *
19- */
20-
21-#ifndef GUI_KDE_WIDGET
22-#define GUI_KDE_WIDGET
23-
24-#if 1
25-#define dbf( format, args... ) { printf( "%s" " : " format "\n" , __FUNCTION__ , ## args ); fflush(stdout); }
26-#define db() { printf( "%s\n", __FUNCTION__ );fflush(stdout); }
27-#else
28-#define dbf(format, args... )
29-#define db()
30-#endif
31-
32-#define UNIX // prevent a warning : a symbol is defined twice in X and Qt
33-
34-#include <qdialog.h>
35-#include <qlabel.h>
36-#include <qsignalmapper.h>
37-#include <qtimer.h>
38-#include <qmainwindow.h>
39-#include <qapplication.h>
40-#include <qevent.h>
41-#include <qlineedit.h>
42-#include <qpainter.h>
43-#include <qwidget.h>
44-#include <qpopupmenu.h>
45-#include <klocale.h>
46-#include <kapp.h>
47-#include <kcmdlineargs.h>
48-#include <kaboutdata.h>
49-#include <keditcl.h>
50-#include <kaboutdata.h>
51-#if (KDE_VERSION>=290)
52-#include <kmainwindow.h>
53-#else
54-#include <ktmainwindow.h>
55-#endif
56-#include <kparts/part.h>
57-#include <kurl.h>
58-#include "kvim_iface.h"
59-
60-#undef UNIX // prevent a warning
61-extern "C" {
62-#include "vim.h"
63-}
64-
65-class QPushButton;
66-class QDialog;
67-class QLineEdit;
68-class QSignalMapper;
69-class QPaintEvent;
70-
71-enum BlinkState {
72- BLINK_NONE,
73- BLINK_ON,
74- BLINK_OFF
75-};
76-
77-class VimWidget : public QWidget, virtual public KVim
78-{
79- Q_OBJECT
80-
81-public:
82- VimWidget( QWidget *parent=0, const char *name=0, WFlags f=0 );
83- virtual void paintEvent( QPaintEvent *);
84- void draw_string(int x, int y, QString s, int len, int flags);
85-
86- /** Init the blinking time */
87- void set_blink_time( long, long, long );
88- void start_cursor_blinking();
89- void stop_cursor_blinking();
90- void wait(long);
91-#ifdef FEAT_CLIENTSERVER
92- void serverActivate(WId id);
93-#endif
94-#ifdef FEAT_MZSCHEME
95- void enable_mzscheme_threads();
96- void disable_mzscheme_threads();
97-#endif
98- void flash();
99-
100- /** DCOP */
101- void execNormal(QString command);
102- void execInsert(QString command);
103- void execRaw(QString command);
104- void execCmd(QString command);
105- QString eval(QString expr);
106-
107- bool wait_done;
108- BlinkState blink_state;
109- QPainter *painter;
110- QPopupMenu *menu;
111-
112-protected:
113- virtual void keyPressEvent( QKeyEvent * );
114- virtual void mousePressEvent( QMouseEvent *);
115- virtual void mouseDoubleClickEvent( QMouseEvent *);
116- virtual void mouseReleaseEvent( QMouseEvent *);
117- virtual void mouseMoveEvent( QMouseEvent *);
118- virtual void focusInEvent( QFocusEvent * );
119- virtual void focusOutEvent( QFocusEvent * );
120- virtual void dragEnterEvent (QDragEnterEvent *);
121- virtual void dropEvent (QDropEvent *);
122-#ifdef FEAT_XIM
123- virtual void imStartEvent ( QIMEvent * );
124- virtual void imEndEvent ( QIMEvent * );
125- virtual void imComposeEvent ( QIMEvent * );
126-#endif
127-#ifdef FEAT_MZSCHEME
128- virtual void timerEvent( QTimerEvent * );
129-#endif
130-
131- /* cursor blinking stuff */
132- QTimer blink_timer;
133- long blink_wait_time, blink_on_time, blink_off_time;
134-
135- /* wait for input */
136- QTimer wait_timer;
137-
138-#ifdef FEAT_MZSCHEME
139- int mzscheme_timer_id;
140-#endif
141-
142-public slots:
143- void blink_cursor();
144- void wait_timeout();
145-};
146-
147-class VimMainWindow : public KMainWindow
148-{
149- Q_OBJECT
150-
151-public:
152- VimMainWindow ( const char *name = 0L, WFlags f = WDestructiveClose );
153-
154- /** called when the widget closes */
155-// bool close(bool alsoDelete);
156- VimWidget *w;
157- KEdFind *finddlg;
158- KEdReplace *repldlg;
159- int have_tearoff;
160- QTextCodec *codec;
161-
162-public slots:
163- void menu_activated(int dx);
164- void clipboard_selection_update();
165- void clipboard_data_update();
166- void slotSearch();
167- void slotFind();
168- void slotReplace();
169- void slotReplaceAll();
170- void showAboutApplication();
171- void showAboutKDE();
172- void showBugReport();
173- void showTipOfTheDay();
174- void buffersToolbar();
175- bool isLocked();
176- void lock();
177- void unlock();
178-
179-protected:
180- virtual void wheelEvent (QWheelEvent *);
181- virtual void resizeEvent ( QResizeEvent *e );
182-
183-#if defined(FEAT_SESSION)
184- void saveGlobalProperties (KConfig *conf);
185- void readGlobalProperties (KConfig *conf);
186-#endif
187- bool queryClose();
188- bool queryExit();
189- bool locked;
190-};
191-
192-
193-class VimDialog : public QDialog
194-{
195- Q_OBJECT
196-public:
197- VimDialog (int type, /* type of dialog */
198- unsigned char * title, /* title of dialog */
199- unsigned char * message, /* message text */
200- unsigned char * buttons, /* names of buttons */
201- int def_but, /* default button */
202- char_u *textfield); /* input text */
203-private:
204- QSignalMapper mapper;
205- QLineEdit *entry;
206- char_u *ret;
207- int butNb;
208-
209-protected slots:
210- void done(int);
211-};
212-
213-
214-/*
215- * QScrollBar pool
216- */
217-struct GuiScrollbar;
218-
219-class SBPool : public QObject
220-{
221- Q_OBJECT
222-public:
223- SBPool(void);
224- void create(GuiScrollbar * sb, int orient);
225- void destroy(GuiScrollbar * sb);
226-public slots:
227- void sbUsed(int who);
228-private:
229- QSignalMapper mapper;
230-};
231-
232-class KVimUtils {
233-public:
234- static QString convertEncodingName(QString);
235-#if QT_VERSION<300
236- static bool fromString(QFont*,QString);
237- static QString toString(QFont*);
238-#endif
239-};
240-
241-extern VimMainWindow *vmw;
242-extern SBPool *sbpool;
243-extern QString *argServerName;
244-
245-#endif // GUI_KDE_WIDGET
diff -r a81bc802c17c -r 4ac1dce8dd5e src/gui_kde_x11.cc
--- a/src/gui_kde_x11.cc Mon Jul 19 20:55:54 2004 +0000
+++ b/src/gui_kde_x11.cc Mon Jul 26 12:53:41 2004 +0000
@@ -45,7 +45,7 @@
4545 #include <qfont.h>
4646
4747
48-#include "gui_kde_widget.h"
48+#include "gui_kde_wid.h"
4949
5050
5151 extern "C" {
diff -r a81bc802c17c -r 4ac1dce8dd5e src/if_python.c
--- a/src/if_python.c Mon Jul 19 20:55:54 2004 +0000
+++ b/src/if_python.c Mon Jul 26 12:53:41 2004 +0000
@@ -2731,6 +2731,7 @@
27312731 char *save;
27322732 int len;
27332733 int i;
2734+ char *p;
27342735
27352736 if (obj == NULL || !PyString_Check(obj))
27362737 {
@@ -2741,14 +2742,22 @@
27412742 str = PyString_AsString(obj);
27422743 len = PyString_Size(obj);
27432744
2744- /* Error checking: String must not contain newlines, as we
2745+ /*
2746+ * Error checking: String must not contain newlines, as we
27452747 * are replacing a single line, and we must replace it with
27462748 * a single line.
2749+ * A trailing newline is removed, so that append(f.readlines()) works.
27472750 */
2748- if (memchr(str, '\n', len))
2751+ p = memchr(str, '\n', len);
2752+ if (p != NULL)
27492753 {
2750- PyErr_SetVim(_("string cannot contain newlines"));
2751- return NULL;
2754+ if (p == str + len - 1)
2755+ --len;
2756+ else
2757+ {
2758+ PyErr_SetVim(_("string cannot contain newlines"));
2759+ return NULL;
2760+ }
27522761 }
27532762
27542763 /* Create a copy of the string, with internal nulls replaced by
diff -r a81bc802c17c -r 4ac1dce8dd5e src/main.aap
--- a/src/main.aap Mon Jul 19 20:55:54 2004 +0000
+++ b/src/main.aap Mon Jul 26 12:53:41 2004 +0000
@@ -100,9 +100,9 @@
100100 GUI_TESTTARGET = gui
101101 KDE
102102 GUI_SRC = gui.c pty.c gui_kde.cc gui_kde_x11.cc
103- gui_kde_widget_moc.cc
103+ gui_kde_wid_moc.cc
104104 kvim_iface_skel.cc
105- GUI_OBJ = $BDIR/gui_kde_widget.o
105+ GUI_OBJ = $BDIR/gui_kde_wid.o
106106 GUI_DEFS = -DFEAT_GUI_KDE $NARROW_PROTO
107107 GUI_IPATH = $GUI_INC_LOC
108108 GUI_LIBS_DIR = $GUI_LIB_LOC
@@ -218,7 +218,7 @@
218218 testclean {virtual}:
219219 :del {force} testdir/*.out testdir/test.log
220220
221-CLEANFILES += gui_kde_widget_moc.cc kvim_iface_skel.cc *.kidl
221+CLEANFILES += gui_kde_wid_moc.cc kvim_iface_skel.cc *.kidl
222222
223223 # When no fetch target exists we are not a child of the ../main.aap recipe,
224224 # Use ../main.aap to do the fetching.
@@ -356,18 +356,18 @@
356356 :sys $PERL $PERLLIB/ExtUtils/xsubpp -prototypes -typemap \
357357 $PERLLIB/ExtUtils/typemap if_perl.xs >> $target
358358
359-$BDIR/gui_kde_widget.o: gui_kde_widget.cc
360- :sys $MOC -o gui_kde_widget_moc.cc gui_kde_widget.h
359+$BDIR/gui_kde_wid.o: gui_kde_wid.cc
360+ :sys $MOC -o gui_kde_wid_moc.cc gui_kde_wid.h
361361 @try:
362362 :sys $KDE_PREFIX/bin/dcopidl kvim_iface.h > kvim_iface.kidl
363363 @except:
364364 :del {f} kvim_iface.kidl
365365 :sys $KDE_PREFIX/bin/dcopidl2cpp --c++-suffix cc --no-stub kvim_iface.kidl
366- :do compile gui_kde_widget.cc
366+ :do compile gui_kde_wid.cc
367367
368-gui_kde_widget_moc.cc: $BDIR/gui_kde_widget.o
368+gui_kde_wid_moc.cc: $BDIR/gui_kde_wid.o
369369
370-kvim_iface_skel.cc: $BDIR/gui_kde_widget.o
370+kvim_iface_skel.cc: $BDIR/gui_kde_wid.o
371371
372372
373373 auto/osdef.h: auto/config.h osdef.sh osdef1.h.in osdef2.h.in
diff -r a81bc802c17c -r 4ac1dce8dd5e src/memline.c
--- a/src/memline.c Mon Jul 19 20:55:54 2004 +0000
+++ b/src/memline.c Mon Jul 26 12:53:41 2004 +0000
@@ -4338,8 +4338,17 @@
43384338 curline = buf->b_ml.ml_locked_high + 1;
43394339 }
43404340
4341- if (ffdos)
4342- size += line - 1;
4341+ if (line != 0)
4342+ {
4343+ /* Count extra CR characters. */
4344+ if (ffdos)
4345+ size += line - 1;
4346+
4347+ /* Don't count the last line break if 'bin' and 'noeol'. */
4348+ if (buf->b_p_bin && !buf->b_p_eol)
4349+ size -= ffdos + 1;
4350+ }
4351+
43434352 return size;
43444353 }
43454354
diff -r a81bc802c17c -r 4ac1dce8dd5e src/misc2.c
--- a/src/misc2.c Mon Jul 19 20:55:54 2004 +0000
+++ b/src/misc2.c Mon Jul 26 12:53:41 2004 +0000
@@ -3606,8 +3606,7 @@
36063606 }
36073607
36083608 /* Store information on starting dir now if path is relative.
3609- * If path is absolute, we do that later.
3610- */
3609+ * If path is absolute, we do that later. */
36113610 if (path[0] == '.'
36123611 && (vim_ispathsep(path[1]) || path[1] == NUL)
36133612 && (!tagfile || vim_strchr(p_cpo, CPO_DOTTAG) == NULL)
@@ -3886,7 +3885,7 @@
38863885 * Return a pointer to an allocated file name or NULL if nothing found.
38873886 * To get all matching files call this function until you get NULL.
38883887 *
3889- * If the passed search_context is NULL, it the returns NULL.
3888+ * If the passed search_context is NULL, NULL is returned.
38903889 *
38913890 * The search algorithm is depth first. To change this replace the
38923891 * stack with a list (don't forget to leave partly searched directories on the
diff -r a81bc802c17c -r 4ac1dce8dd5e src/ops.c
--- a/src/ops.c Mon Jul 19 20:55:54 2004 +0000
+++ b/src/ops.c Mon Jul 26 12:53:41 2004 +0000
@@ -1129,7 +1129,7 @@
11291129 new_last_cmdline = NULL;
11301130 /* Escape all control characters with a CTRL-V */
11311131 p = vim_strsave_escaped_ext(last_cmdline,
1132- "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", Ctrl_V, FALSE);
1132+ (char_u *)"\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", Ctrl_V, FALSE);
11331133 if (p != NULL)
11341134 retval = put_in_typebuf(p, TRUE);
11351135 vim_free(p);
diff -r a81bc802c17c -r 4ac1dce8dd5e src/os_mac.h
--- a/src/os_mac.h Mon Jul 19 20:55:54 2004 +0000
+++ b/src/os_mac.h Mon Jul 26 12:53:41 2004 +0000
@@ -119,8 +119,8 @@
119119 * ~/Library/Vim or ~/Library/Preferences/org.vim.vim/ ? (Dany)
120120 */
121121 /* When compiled under MacOS X (including CARBON version)
122- * we use the Unix File path style */
123-#if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX
122+ * we use the Unix File path style. Also when UNIX is defined. */
123+#if defined(UNIX) || (defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX)
124124 # undef COLON_AS_PATHSEP
125125 # define USE_UNIXFILENAME
126126 #else
@@ -140,14 +140,16 @@
140140 #define CASE_INSENSITIVE_FILENAME /* ignore case when comparing file names */
141141 #define SPACE_IN_FILENAME
142142 #define BREAKCHECK_SKIP 32 /* call mch_breakcheck() each time, it's
143- quite fast. Did I forgot to update the comment */
143+ quite fast. Did I forgot to update the
144+ comment */
144145
145146
146-#undef USE_FNAME_CASE /* So that :e os_Mac.c, :w, save back the file as os_mac.c */
147+#undef USE_FNAME_CASE /* So that :e os_Mac.c, :w, save back the file
148+ as os_mac.c */
147149 #define BINARY_FILE_IO
148150 #define EOL_DEFAULT EOL_MAC
149-#ifndef MACOS_X_UNIX /* I hope that switching these two lines */
150-# define USE_CR /* does what I want -- BNF */
151+#ifndef MACOS_X_UNIX /* I hope that switching these two lines */
152+# define USE_CR /* does what I want -- BNF */
151153 # define NO_CONSOLE /* don't include console mode */
152154 #endif
153155 #define HAVE_AVAIL_MEM
diff -r a81bc802c17c -r 4ac1dce8dd5e src/os_mac_conv.c
--- a/src/os_mac_conv.c Mon Jul 19 20:55:54 2004 +0000
+++ b/src/os_mac_conv.c Mon Jul 26 12:53:41 2004 +0000
@@ -16,6 +16,7 @@
1616 #define NO_X11_INCLUDES
1717 #include "vim.h"
1818
19+#ifdef FEAT_MBYTE
1920 extern char_u *mac_string_convert __ARGS((char_u *ptr, int len, int *lenp, int fail_on_error, int from, int to, int *unconvlenp));
2021 extern int macroman2enc __ARGS((char_u *ptr, long *sizep, long real_size));
2122 extern int enc2macroman __ARGS((char_u *from, size_t fromlen, char_u *to, int *tolenp, int maxtolen, char_u *rest, int *restlenp));
@@ -228,3 +229,5 @@
228229 *tolenp = l;
229230 return OK;
230231 }
232+
233+#endif /* FEAT_MBYTE */
diff -r a81bc802c17c -r 4ac1dce8dd5e src/po/ru.cp1251.po
--- a/src/po/ru.cp1251.po Mon Jul 19 20:55:54 2004 +0000
+++ b/src/po/ru.cp1251.po Mon Jul 26 12:53:41 2004 +0000
@@ -1239,7 +1239,7 @@
12391239 #: ex_docmd.c:4584
12401240 #, c-format
12411241 msgid "E173: %ld more files to edit"
1242-msgstr "E173: Åñòü íåîòðåäàêòèðîâàííûå ôàéëû (%d)."
1242+msgstr "E173: Åñòü íåîòðåäàêòèðîâàííûå ôàéëû (%ld)."
12431243
12441244 #: ex_docmd.c:4679
12451245 msgid "E174: Command already exists: add ! to replace it"
@@ -2446,7 +2446,7 @@
24462446 #: if_cscope.c:589
24472447 #, c-format
24482448 msgid "E262: error reading cscope connection %ld"
2449-msgstr "E262: îøèáêà ïîëó÷åíèÿ èíôîðìàöèè îò ñîåäèíåíèÿ cscope %d"
2449+msgstr "E262: îøèáêà ïîëó÷åíèÿ èíôîðìàöèè îò ñîåäèíåíèÿ cscope %ld"
24502450
24512451 #: if_cscope.c:694
24522452 msgid "E561: unknown cscope search type"
@@ -2524,7 +2524,7 @@
25242524 #: if_cscope.c:1458
25252525 #, c-format
25262526 msgid "cscope connection %s closed"
2527-msgstr "ñîåäèíåíèå ñ cscope çàêðûòî"
2527+msgstr "ñîåäèíåíèå ñ cscope %s çàêðûòî"
25282528
25292529 #. should not reach here
25302530 #: if_cscope.c:1598
diff -r a81bc802c17c -r 4ac1dce8dd5e src/po/ru.po
--- a/src/po/ru.po Mon Jul 19 20:55:54 2004 +0000
+++ b/src/po/ru.po Mon Jul 26 12:53:41 2004 +0000
@@ -1239,7 +1239,7 @@
12391239 #: ex_docmd.c:4584
12401240 #, c-format
12411241 msgid "E173: %ld more files to edit"
1242-msgstr "E173: Есть неотредактированные файлы (%d)."
1242+msgstr "E173: Есть неотредактированные файлы (%ld)."
12431243
12441244 #: ex_docmd.c:4679
12451245 msgid "E174: Command already exists: add ! to replace it"
@@ -2446,7 +2446,7 @@
24462446 #: if_cscope.c:589
24472447 #, c-format
24482448 msgid "E262: error reading cscope connection %ld"
2449-msgstr "E262: ошибка получения информации от соединения cscope %d"
2449+msgstr "E262: ошибка получения информации от соединения cscope %ld"
24502450
24512451 #: if_cscope.c:694
24522452 msgid "E561: unknown cscope search type"
@@ -2524,7 +2524,7 @@
25242524 #: if_cscope.c:1458
25252525 #, c-format
25262526 msgid "cscope connection %s closed"
2527-msgstr "соединение с cscope закрыто"
2527+msgstr "соединение с cscope %s закрыто"
25282528
25292529 #. should not reach here
25302530 #: if_cscope.c:1598
diff -r a81bc802c17c -r 4ac1dce8dd5e src/search.c
--- a/src/search.c Mon Jul 19 20:55:54 2004 +0000
+++ b/src/search.c Mon Jul 26 12:53:41 2004 +0000
@@ -3760,10 +3760,11 @@
37603760 * Find quote under the cursor, cursor at end.
37613761 * Returns TRUE if found, else FALSE.
37623762 */
3763+/*ARGSUSED*/
37633764 int
37643765 current_quote(oap, count, include, quotechar)
37653766 oparg_T *oap;
3766- long count;
3767+ long count; /* not used */
37673768 int include; /* TRUE == include quote char */
37683769 int quotechar; /* Quote character */
37693770 {
Show on old repository browser