mirror of
https://github.com/vim/vim
synced 2025-07-16 09:12:00 +00:00
updated for version 7.0026
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
*change.txt* For Vim version 7.0aa. Last change: 2004 Dec 24
|
||||
*change.txt* For Vim version 7.0aa. Last change: 2004 Dec 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -985,10 +985,11 @@ Vim fills this register with text deleted with the "d", "c", "s", "x" commands
|
||||
or copied with the yank "y" command, regardless of whether or not a specific
|
||||
register was used (e.g. "xdd). This is like the unnamed register is pointing
|
||||
to the last used register. An exception is the '_' register: "_dd does not
|
||||
store the deleted text in any register. Vim uses the contents of this
|
||||
register for any put command (p or P) which does not specify a register.
|
||||
Additionally you can access it with the name '"'. This means you have to type
|
||||
two double quotes. Writing to the "" register writes to register "0.
|
||||
store the deleted text in any register.
|
||||
Vim uses the contents of the unnamed register for any put command (p or P)
|
||||
which does not specify a register. Additionally you can access it with the
|
||||
name '"'. This means you have to type two double quotes. Writing to the ""
|
||||
register writes to register "0.
|
||||
{Vi: register contents are lost when changing files, no '"'}
|
||||
|
||||
2. Numbered registers "0 to "9 *quote_number* *quote0* *quote1*
|
||||
@ -999,9 +1000,9 @@ unless the command specified another register with ["x].
|
||||
Numbered register 1 contains the text deleted by the most recent delete or
|
||||
change command, unless the command specified another register or the text is
|
||||
less than one line (the small delete register is used then). An exception is
|
||||
made for these commands: |%|, |(|, |)|, |`|, |/|, |?|, |n|, |N|, |{| and |}|.
|
||||
Register "1 is always used then (this is Vi compatible). The "- register is
|
||||
used as well if the delete is within a line.
|
||||
made for the delete operator with these movement commands: |%|, |(|, |)|, |`|,
|
||||
|/|, |?|, |n|, |N|, |{| and |}|. Register "1 is always used then (this is Vi
|
||||
compatible). The "- register is used as well if the delete is within a line.
|
||||
With each successive deletion or change, Vim shifts the previous contents
|
||||
of register 1 into register 2, 2 into 3, and so forth, losing the previous
|
||||
contents of register 9.
|
||||
|
@ -1,4 +1,4 @@
|
||||
*editing.txt* For Vim version 7.0aa. Last change: 2004 Dec 16
|
||||
*editing.txt* For Vim version 7.0aa. Last change: 2004 Dec 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -46,7 +46,7 @@ However, the alternate file name is not changed when |:keepalt| is used.
|
||||
name. {not in Vi}
|
||||
|
||||
All file names are remembered in the buffer list. When you enter a file name,
|
||||
for editing (e.g., with ":e filename") or writing (e.g., with (:w file name"),
|
||||
for editing (e.g., with ":e filename") or writing (e.g., with ":w file name"),
|
||||
the file name is added to the list. You can use the buffer list to remember
|
||||
which files you edited and to quickly switch from one file to another (e.g.,
|
||||
to copy text) with the |CTRL-^| command. First type the number of the file
|
||||
@ -57,7 +57,7 @@ CTRL-G or *CTRL-G* *:f* *:fi* *:file*
|
||||
:f[ile] Prints the current file name (as typed), the
|
||||
cursor position (unless the 'ruler' option is set),
|
||||
and the file status (readonly, modified, read errors,
|
||||
new file)). See the 'shortmess' option about how tho
|
||||
new file). See the 'shortmess' option about how tho
|
||||
make this message shorter. {Vi does not include
|
||||
column number}
|
||||
|
||||
@ -111,7 +111,7 @@ string, it is often displayed with HOME replaced with "~". This was done to
|
||||
keep file names short. When reading or writing files the full name is still
|
||||
used, the "~" is only used when displaying file names. When replacing the
|
||||
file name would result in just "~", "~/" is used instead (to avoid confusion
|
||||
with 'backupext' set to "~").
|
||||
between options set to $HOME with 'backupext' set to "~").
|
||||
|
||||
When writing the buffer, the default is to use the current file name. Thus
|
||||
when you give the "ZZ" or ":wq" command, the original file will be
|
||||
@ -260,12 +260,12 @@ If you want to keep the changed buffer without saving it, switch on the
|
||||
|
||||
*:vi* *:visual*
|
||||
:vi[sual][!] [++opt] [+cmd] [file]
|
||||
When entered in Ex mode: Leave |Ex-mode|, go back to
|
||||
When used in Ex mode: Leave |Ex-mode|, go back to
|
||||
Normal mode. Otherwise same as |:edit|.
|
||||
|
||||
*:vie* *:view*
|
||||
:vie[w] [++opt] [+cmd] file
|
||||
When entered in Ex mode: Leave Ex mode, go back to
|
||||
When used in Ex mode: Leave |Ex mode|, go back to
|
||||
Normal mode. Otherwise same as |:edit|, but set
|
||||
'readonly' option for this buffer. {not in Vi}
|
||||
|
||||
@ -666,7 +666,7 @@ list of the current window.
|
||||
in Vi}
|
||||
|
||||
:[count]wN[ext][!] [++opt] [+cmd] [file] *:wN* *:wNext*
|
||||
:[count]wp[revous][!] [++opt] [+cmd] [file] *:wp* *:wprevious*
|
||||
:[count]wp[revious][!] [++opt] [+cmd] [file] *:wp* *:wprevious*
|
||||
Same as :wnext, but go to previous file instead of
|
||||
next. {not in Vi}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
*fold.txt* For Vim version 7.0aa. Last change: 2004 Oct 15
|
||||
*fold.txt* For Vim version 7.0aa. Last change: 2004 Dec 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -279,7 +279,7 @@ zF Create a fold for N lines. Works like "zf".
|
||||
Create a fold for the lines in {range}. Works like "zf".
|
||||
|
||||
*zd* *E351*
|
||||
zd Delete one fold at the cursor. When the cursor is on folded
|
||||
zd Delete one fold at the cursor. When the cursor is on a folded
|
||||
line, that fold is deleted. Nested folds are moved one level
|
||||
up. In Visual mode all folds (partially) in the selected area
|
||||
are deleted. Careful: This easily deletes more folds than you
|
||||
@ -457,7 +457,7 @@ FOLDLEVEL *fold-foldlevel*
|
||||
|
||||
'foldlevel' is a number option: The higher the more folded regions are open.
|
||||
When 'foldlevel' is 0, all folds are closed.
|
||||
When 'foldlevel' is positive, some folds closed.
|
||||
When 'foldlevel' is positive, some folds are closed.
|
||||
When 'foldlevel' is very high, all folds are open.
|
||||
'foldlevel' is applied when it is changed. After that manually folds can be
|
||||
opened and closed.
|
||||
|
@ -1,4 +1,4 @@
|
||||
*gui.txt* For Vim version 7.0aa. Last change: 2004 Jun 15
|
||||
*gui.txt* For Vim version 7.0aa. Last change: 2004 Dec 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -52,7 +52,8 @@ When the GUI starts up initializations are carried out, in this order:
|
||||
:let bmenu_max_pathlen = 50
|
||||
- If the "-U {gvimrc}" command-line option has been used when starting Vim,
|
||||
the {gvimrc} file will be read for initializations. The following
|
||||
initializations are skipped.
|
||||
initializations are skipped. When {gvimrc} is "NONE" no file will be read
|
||||
for initializations.
|
||||
- For Unix and MS-Windows, if the system gvimrc exists, it is sourced. The
|
||||
name of this file is normally "$VIM/gvimrc". You can check this with
|
||||
":version". Also see |$VIM|.
|
||||
|
@ -1,4 +1,4 @@
|
||||
*gui_x11.txt* For Vim version 7.0aa. Last change: 2004 Jul 02
|
||||
*gui_x11.txt* For Vim version 7.0aa. Last change: 2004 Dec 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -437,6 +437,9 @@ command line argument).
|
||||
==============================================================================
|
||||
7. KDE version *gui-kde* *kde* *KDE* *KVim*
|
||||
|
||||
NOTE: The KDE version is still under development. It is not recommended for
|
||||
daily work.
|
||||
|
||||
The KDE version of Vim works with KDE 2.x and KDE 3.x.
|
||||
KVim (name code for gui-kde) does not use traditional X settings for its
|
||||
configuration.
|
||||
|
@ -1,4 +1,4 @@
|
||||
*index.txt* For Vim version 7.0aa. Last change: 2004 Dec 24
|
||||
*index.txt* For Vim version 7.0aa. Last change: 2004 Dec 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -807,6 +807,7 @@ tag command note action in Visual mode ~
|
||||
------------------------------------------------------------------------------
|
||||
|v_CTRL-\_CTRL-N| CTRL-\ CTRL-N stop Visual mode
|
||||
|v_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to mode specified with 'insertmode'
|
||||
|v_CTRL-C| CTRL-C stop Visual mode
|
||||
|v_CTRL-G| CTRL-G toggle between Visual mode and Select mode
|
||||
|v_<BS>| <BS> 2 Select mode: delete highlighted area
|
||||
|v_CTRL-H| CTRL-H 2 same as <BS>
|
||||
@ -814,6 +815,7 @@ tag command note action in Visual mode ~
|
||||
command
|
||||
|v_CTRL-V| CTRL-V make Visual mode blockwise or stop Visual
|
||||
mode
|
||||
|v_<Esc>| <Esc> stop Visual mode
|
||||
|v_CTRL-]| CTRL-] jump to highlighted tag
|
||||
|v_!| !{filter} 2 filter the highlighted lines through the
|
||||
external command {filter}
|
||||
|
@ -1,4 +1,4 @@
|
||||
*map.txt* For Vim version 7.0aa. Last change: 2004 Dec 09
|
||||
*map.txt* For Vim version 7.0aa. Last change: 2004 Dec 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -613,7 +613,7 @@ Examples: ({CURSOR} is where you type a non-keyword character) >
|
||||
< "#i{CURSOR}" is expanded to "#include"
|
||||
">#i{CURSOR}" is not expanded
|
||||
>
|
||||
:ab ;; <endofline>"
|
||||
:ab ;; <endofline>
|
||||
< "test;;" is not expanded
|
||||
"test ;;" is expanded to "test <endofline>"
|
||||
|
||||
@ -750,7 +750,7 @@ Stored as: esc ^V^[
|
||||
Later, when the abbreviation is expanded because the user typed in
|
||||
the word "esc", the long form is subjected to the same type of
|
||||
^V interpretation as keyboard input. So the ^V protects the ^[
|
||||
character from being interpreted as the "exit input-mode" character.
|
||||
character from being interpreted as the "exit Insert mode" character.
|
||||
Instead, the ^[ is inserted into the text.
|
||||
|
||||
Expands to: ^[
|
||||
@ -778,7 +778,7 @@ make it local to the script. But when a mapping is executed from outside of
|
||||
the script, it doesn't know in which script the function was defined. To
|
||||
avoid this problem, use "<SID>" instead of "s:". The same translation is done
|
||||
as for mappings. This makes it possible to define a call to the function in
|
||||
mapping.
|
||||
a mapping.
|
||||
|
||||
When a local function is executed, it runs in the context of the script it was
|
||||
defined in. This means that new functions and mappings it defines can also
|
||||
@ -1054,7 +1054,7 @@ Examples >
|
||||
Replace <line1>-pu_|<line1>,<line2>d|r <args>|<line1>d
|
||||
|
||||
" Count the number of lines in the range
|
||||
:com! -range -nargs=0 Lines :echo <line2> - <line1> + 1 "lines"
|
||||
:com! -range -nargs=0 Lines echo <line2> - <line1> + 1 "lines"
|
||||
|
||||
" Call a user function (example of <f-args>)
|
||||
:com -nargs=* Mycmd call Myfunc(<f-args>)
|
||||
|
@ -1,4 +1,4 @@
|
||||
*motion.txt* For Vim version 7.0aa. Last change: 2004 Nov 23
|
||||
*motion.txt* For Vim version 7.0aa. Last change: 2004 Dec 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -831,8 +831,8 @@ was made yet in the current file.
|
||||
|
||||
*'^* *`^*
|
||||
'^ `^ To the position where the cursor was the last time
|
||||
when Insert mode was stopped This is used by the |gi|
|
||||
command. Not set when the |:keepjumps| command
|
||||
when Insert mode was stopped. This is used by the
|
||||
|gi| command. Not set when the |:keepjumps| command
|
||||
modifier was used. {not in Vi}
|
||||
|
||||
*'.* *`.*
|
||||
|
@ -1,4 +1,4 @@
|
||||
*pi_expl.txt* For Vim version 7.0aa. Last change: 2002 Nov 08
|
||||
*pi_expl.txt* For Vim version 7.0aa. Last change: 2004 Dec 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by M A Aziz Ahmed
|
||||
@ -65,7 +65,7 @@ splitting horizontally, use the variable: >
|
||||
The default for this is the setting of splitbelow at the time the plugin is
|
||||
loaded.
|
||||
|
||||
To control where the windows goes relative to the explorer window when
|
||||
To control where the window goes relative to the explorer window when
|
||||
splitting vertically, use the variable: >
|
||||
let g:explSplitRight=1 " Put new window to the right of the explorer
|
||||
let g:explSplitRight=0 " Put new window to the left of the explorer
|
||||
@ -77,14 +77,14 @@ To use a different split method for the explorer window, use: >
|
||||
" current window
|
||||
let g:explStartRight=0 " Put new explorer window to the left of the
|
||||
" current window
|
||||
The default for this set to g:explSplitRight at the time the plugin is loaded.
|
||||
The default is the value of g:explSplitRight at the time the plugin is loaded.
|
||||
|
||||
To use a different split method for the explorer window, use: >
|
||||
let g:explStartBelow=1 " Put new explorer window below the
|
||||
" current window
|
||||
let g:explStartBelow=0 " Put new explorer window above the
|
||||
" current window
|
||||
The default for this set to g:explSplitBelow at the time the plugin is loaded.
|
||||
The default is the value of g:explSplitBelow at the time the plugin is loaded.
|
||||
|
||||
The start splits allow for the explorer window to be placed in a file browser
|
||||
type arrangement, where the directories are shown on the left and the contents
|
||||
|
@ -2520,6 +2520,10 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
|
||||
:vi editing.txt /*:vi*
|
||||
:vie editing.txt /*:vie*
|
||||
:view editing.txt /*:view*
|
||||
:vim quickfix.txt /*:vim*
|
||||
:vimgrep quickfix.txt /*:vimgrep*
|
||||
:vimgrepa quickfix.txt /*:vimgrepa*
|
||||
:vimgrepadd quickfix.txt /*:vimgrepadd*
|
||||
:visual editing.txt /*:visual*
|
||||
:visual_example visual.txt /*:visual_example*
|
||||
:viu various.txt /*:viu*
|
||||
@ -4951,7 +4955,6 @@ hebrew hebrew.txt /*hebrew*
|
||||
hebrew.txt hebrew.txt /*hebrew.txt*
|
||||
help various.txt /*help*
|
||||
help-context help.txt /*help-context*
|
||||
help-tags tags 1
|
||||
help-translated various.txt /*help-translated*
|
||||
help-xterm-window various.txt /*help-xterm-window*
|
||||
help.txt help.txt /*help.txt*
|
||||
@ -5601,6 +5604,7 @@ new-user-manual version6.txt /*new-user-manual*
|
||||
new-utf-8 version6.txt /*new-utf-8*
|
||||
new-vertsplit version6.txt /*new-vertsplit*
|
||||
new-vim-server version6.txt /*new-vim-server*
|
||||
new-vimgrep version7.txt /*new-vimgrep*
|
||||
new-virtedit version6.txt /*new-virtedit*
|
||||
news intro.txt /*news*
|
||||
nextnonblank() eval.txt /*nextnonblank()*
|
||||
|
@ -1,4 +1,4 @@
|
||||
*usr_40.txt* For Vim version 7.0aa. Last change: 2004 Feb 13
|
||||
*usr_40.txt* For Vim version 7.0aa. Last change: 2004 Dec 29
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@ -60,7 +60,8 @@ It looks a lot like the mapping for <F2> in Normal mode, only the start is
|
||||
different. The <F2> mapping for Normal mode is still there. Thus you can map
|
||||
the same key differently for each mode.
|
||||
Notice that, although this mapping starts in Insert mode, it ends in Normal
|
||||
mode. If you want it to continue in Insert mode, append a "a" to the mapping.
|
||||
mode. If you want it to continue in Insert mode, append an "a" to the
|
||||
mapping.
|
||||
|
||||
Here is an overview of map commands and in which mode they work:
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
*visual.txt* For Vim version 7.0aa. Last change: 2004 Jun 08
|
||||
*visual.txt* For Vim version 7.0aa. Last change: 2004 Dec 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -46,7 +46,7 @@ However, when the 'selection' option is set to "exclusive" and the cursor is
|
||||
after the Visual area, the character under the cursor is not included.
|
||||
|
||||
With "v" the text before the start position and after the end position will
|
||||
not be highlighted. However, All uppercase and non-alpha operators, except
|
||||
not be highlighted. However, all uppercase and non-alpha operators, except
|
||||
"~" and "U", will work on whole lines anyway. See the list of operators
|
||||
below.
|
||||
|
||||
@ -139,6 +139,9 @@ extended to the rightmost column of the longest line.
|
||||
If you want to highlight exactly the same area as the last time, you can use
|
||||
"gv" |gv| |v_gv|.
|
||||
|
||||
*v_<Esc>*
|
||||
<Esc> In Visual mode: Stop Visual mode.
|
||||
|
||||
*v_CTRL-C*
|
||||
CTRL-C In Visual mode: Stop Visual mode. When insert mode is
|
||||
pending (the mode message shows
|
||||
@ -176,7 +179,7 @@ When switching to another window on the same buffer, the cursor position in
|
||||
that window is adjusted, so that the same Visual area is still selected. This
|
||||
is especially useful to view the start of the Visual area in one window, and
|
||||
the end in another. You can then use <RightMouse> (or <S-LeftMouse> when
|
||||
'mousemodel' is "popup") to move either end of the Visual area.
|
||||
'mousemodel' is "popup") to drag either end of the Visual area.
|
||||
|
||||
==============================================================================
|
||||
4. Operating on the Visual area *visual-operators*
|
||||
@ -362,7 +365,7 @@ Note that special characters (like '.' and '*') will cause problems.
|
||||
Visual-block Examples *blockwise-examples*
|
||||
With the following text, I will indicate the commands to produce the block and
|
||||
the results below. In all cases, the cursor begins on the 'a' in the first
|
||||
line if the test text.
|
||||
line of the test text.
|
||||
The following modeline settings are assumed ":ts=8:sw=4:".
|
||||
|
||||
It will be helpful to
|
||||
|
@ -1,4 +1,4 @@
|
||||
*windows.txt* For Vim version 7.0aa. Last change: 2004 Dec 21
|
||||
*windows.txt* For Vim version 7.0aa. Last change: 2004 Dec 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -877,7 +877,7 @@ list of buffers. |unlisted-buffer|
|
||||
|
||||
1 #h "/test/text" line 1 ~
|
||||
2u "asdf" line 0 ~
|
||||
3 %l+ "version.c" line 1 ~
|
||||
3 %a+ "version.c" line 1 ~
|
||||
|
||||
When the [!] is included the list will show unlisted buffers
|
||||
(the term "unlisted" is a bit confusing then...).
|
||||
|
@ -3,7 +3,7 @@
|
||||
" Author: Miles Lott <milos@groupwhere.org>
|
||||
" URL: http://milosch.dyndns.org/php.vim
|
||||
" Last Change: 2004 May 18
|
||||
" Version: 0.5
|
||||
" Version: 0.4
|
||||
" Notes: Close all switches with default:\nbreak; and it will look better.
|
||||
" Also, open and close brackets should be alone on a line.
|
||||
" This is my preference, and the only way this will look nice.
|
||||
@ -11,9 +11,7 @@
|
||||
" switch/case. It is nearly perfect for anyone regardless of your
|
||||
" stance on brackets.
|
||||
"
|
||||
" Changes: 0.5 - fix duplicate indent on open tag, and empty bracketed
|
||||
" statements.
|
||||
" 0.4 - Fixes for closing php tag, switch statement closure, and php_indent_shortopentags
|
||||
" Changes: Fixes for closing php tag, switch statement closure, and php_indent_shortopentags
|
||||
" option from Steffen Bruentjen <vim@kontraphon.de>
|
||||
"
|
||||
" Options: php_noindent_switch=1 -- do not try to indent switch/case statements (version 0.1 behavior)
|
||||
@ -51,16 +49,16 @@ function GetPhpIndent()
|
||||
let pline = getline(lnum - 1) " previous to last line
|
||||
let ind = indent(lnum)
|
||||
|
||||
" Indent after php open tag
|
||||
" Indent after php open tags
|
||||
if line =~ '<?php'
|
||||
let ind = ind + &sw
|
||||
elseif exists('g:php_indent_shortopentags')
|
||||
" indent after short open tag
|
||||
" indent after short open tags
|
||||
endif
|
||||
if exists('g:php_indent_shortopentags')
|
||||
if line =~ '<?'
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
endif
|
||||
" indent after php closing tag
|
||||
if cline =~ '\M?>'
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
@ -74,17 +72,7 @@ function GetPhpIndent()
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
return ind
|
||||
else
|
||||
" Search the matching bracket (with searchpair()) and set the indent of
|
||||
" to the indent of the matching line.
|
||||
if cline =~ '^\s*}'
|
||||
call cursor(line('.'), 1)
|
||||
let ind = indent(searchpair('{', '', '}',
|
||||
'bW', 'synIDattr(synID(line("."), col("."),
|
||||
0), "name") =~? "string"'))
|
||||
return ind
|
||||
endif
|
||||
" Try to indent switch/case statements as well
|
||||
else " Try to indent switch/case statements as well
|
||||
" Indent blocks enclosed by {} or () or case statements, with some anal requirements
|
||||
if line =~ 'case.*:\|[{(]\s*\(#[^)}]*\)\=$'
|
||||
let ind = ind + &sw
|
||||
|
@ -1 +1 @@
|
||||
source <sfile>:p:h/menu_chinese(taiwan)_taiwan.950.vim
|
||||
source <sfile>:p:h/menu_chinese_taiwan.950.vim
|
||||
|
@ -1 +1 @@
|
||||
source <sfile>:p:h/menu_chinese(taiwan)_taiwan.950.vim
|
||||
source <sfile>:p:h/menu_chinese_taiwan.950.vim
|
||||
|
@ -1,7 +1,7 @@
|
||||
" netrw.vim: Handles file transfer and remote directory listing across a network
|
||||
" last change: Dec 06, 2004
|
||||
" last change: Dec 29, 2004
|
||||
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
|
||||
" Version: 53
|
||||
" Version: 54
|
||||
" License: Vim License (see vim's :help license)
|
||||
"
|
||||
" But be doers of the Word, and not only hearers, deluding your own selves
|
||||
@ -14,7 +14,7 @@
|
||||
if exists("g:loaded_netrw") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrw = "v53"
|
||||
let g:loaded_netrw = "v54"
|
||||
let s:save_cpo = &cpo
|
||||
let loaded_explorer = 1
|
||||
set cpo&vim
|
||||
@ -228,9 +228,9 @@ if version >= 600
|
||||
au BufReadCmd file://localhost/* exe "silent doau BufReadPre ".expand("<afile>")|exe 'e /'.substitute(expand("<afile>"),"file:/*","","")|exe "silent doau BufReadPost ".expand("<afile>")
|
||||
endif
|
||||
au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("<afile>")|exe "Nread 0r ".expand("<afile>")|exe "silent doau BufReadPost ".expand("<afile>")
|
||||
au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("<afile>")|exe "Nread " .expand("<afile>")|exe "silent doau BufReadPost ".expand("<afile>")
|
||||
au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("<afile>")|exe "Nread " .expand("<afile>")|exe "silent doau FileReadPost ".expand("<afile>")
|
||||
au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("<afile>")|exe "Nwrite " .expand("<afile>")|exe "silent doau BufWritePost ".expand("<afile>")
|
||||
au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("<afile>")|exe "'[,']Nwrite " .expand("<afile>")|exe "silent doau BufWritePost ".expand("<afile>")
|
||||
au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("<afile>")|exe "'[,']Nwrite " .expand("<afile>")|exe "silent doau FileWritePost ".expand("<afile>")
|
||||
augroup END
|
||||
endif
|
||||
|
||||
@ -262,15 +262,21 @@ endfun
|
||||
fun! <SID>NetRestorePosn()
|
||||
" call Dfunc("NetRestorePosn() winnr=".s:netrw_winnr." line=".s:netrw_line." col=".s:netrw_col." hline=".s:netrw_hline)
|
||||
|
||||
" restore window
|
||||
" call Decho("restore window: exe silent! ".s:netrw_winnr."wincmd w")
|
||||
exe "silent! ".s:netrw_winnr."wincmd w"
|
||||
if v:shell_error == 0
|
||||
" as suggested by Bram M: redraw on no error
|
||||
" allows protocol error messages to remain visible
|
||||
redraw!
|
||||
endif
|
||||
|
||||
" restore top-of-screen line
|
||||
" call Decho("restore topofscreen: exe norm! ".s:netrw_hline."G0z")
|
||||
exe "norm! ".s:netrw_hline."G0z\<CR>"
|
||||
|
||||
" restore position
|
||||
" call Decho("restore posn: exe norm! ".s:netrw_line."G0".s:netrw_col."|")
|
||||
exe "norm! ".s:netrw_line."G0".s:netrw_col."\<bar>"
|
||||
|
||||
" call Dret("NetRestorePosn")
|
||||
@ -670,77 +676,40 @@ fun! s:NetGetFile(readcmd, fname, method)
|
||||
" call Decho("(copied) fname<".fname.">")
|
||||
endif
|
||||
|
||||
" get the file, but disable undo when reading a new buffer
|
||||
if a:readcmd[0] == '0'
|
||||
let use_e_cmd = 0 " 1 when using ':edit'
|
||||
let delline = 0 " 1 when have to delete empty last line
|
||||
if line("$") == 1 && getline(1) == ""
|
||||
" Now being asked to 0r a file into an empty file.
|
||||
" Safe to :e it instead, unless there is another window on the same buffer.
|
||||
let curbufnr = bufnr("%")
|
||||
let use_e_cmd = 1
|
||||
let delline = 1
|
||||
" Loop over all windows,
|
||||
" reset use_e_cmd when another one is editing the current buffer.
|
||||
let i = 1
|
||||
while 1
|
||||
if i != winnr() && winbufnr(i) == curbufnr
|
||||
let use_e_cmd = 0
|
||||
break
|
||||
endif
|
||||
let i = i + 1
|
||||
if winbufnr(i) < 0
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
endif
|
||||
" get file into buffer
|
||||
" record remote filename
|
||||
let rfile= bufname("%")
|
||||
" call Decho("edit remotefile<".rfile.">")
|
||||
" rename the current buffer to the temp file (ie. fname)
|
||||
exe "keepalt file ".fname
|
||||
" edit temporary file
|
||||
e
|
||||
" rename buffer back to remote filename
|
||||
exe "keepalt file ".rfile
|
||||
" wipe out the buffer with the temp file name
|
||||
exe "bwipe ".fname
|
||||
let line1 = 1
|
||||
let line2 = line("$")
|
||||
|
||||
if use_e_cmd > 0
|
||||
" ':edit' the temp file, wipe out the old buffer and rename the buffer
|
||||
let curfilename = expand("%")
|
||||
|
||||
let binlocal = &l:bin
|
||||
let binglobal = &g:bin
|
||||
if binlocal
|
||||
setglobal bin " Need to set 'bin' globally for ":e" command.
|
||||
endif
|
||||
silent exe "e! ".v:cmdarg." ".fname
|
||||
if binlocal && !binglobal
|
||||
setglobal nobin
|
||||
setlocal bin
|
||||
endif
|
||||
|
||||
exe curbufnr . "bwipe!"
|
||||
exe "f ".escape(curfilename," ")
|
||||
" the ":f newname" apparently leaves the temporary file as the alternate
|
||||
" file in the buffer list (see :ls!). The following command wipes it out.
|
||||
exe bufnr("#")."bwipe!"
|
||||
else
|
||||
let oldul= &ul
|
||||
setlocal ul=-1
|
||||
exe a:readcmd." ".v:cmdarg." ".escape(fname," ")
|
||||
if delline > 0
|
||||
" wipe out last line, which should be a blank line anyway
|
||||
$del
|
||||
endif
|
||||
let &ul= oldul
|
||||
endif
|
||||
elseif filereadable(fname)
|
||||
" call Decho("exe<".a:readcmd." ".v:cmdarg." ".fname.">")
|
||||
" read file after current line
|
||||
let curline = line(".")
|
||||
let lastline= line("$")
|
||||
" call Decho("exe<".a:readcmd." ".v:cmdarg." ".fname."> line#".curline)
|
||||
exe a:readcmd." ".v:cmdarg." ".fname
|
||||
let line1 = curline + 1
|
||||
let line2 = line("$") - lastline + 1
|
||||
let s:netrw_line = s:netrw_line + 1
|
||||
let s:netrw_col = 1
|
||||
else
|
||||
" call Dret("NetGetFile")
|
||||
" not readable
|
||||
" call Dret("NetGetFile : fname<".fname."> not readable")
|
||||
return
|
||||
endif
|
||||
|
||||
" User-provided (ie. optional) fix-it-up command
|
||||
if exists("*NetReadFixup")
|
||||
let line1= line(".")
|
||||
if a:readcmd == "r"
|
||||
let line2= line("$") - line2 + line1
|
||||
else
|
||||
let line2= line("$") - line2
|
||||
endif
|
||||
" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")")
|
||||
call NetReadFixup(a:method, line1, line2)
|
||||
endif
|
||||
@ -2604,7 +2573,7 @@ fun! s:NetMethod(choice) " globals: method machine id passwd fname
|
||||
" call Decho("scp://...")
|
||||
let b:netrw_method = 4
|
||||
let g:netrw_machine= substitute(a:choice,scpurm,'\1',"")
|
||||
let b:netrw_port = substitute(a:choice,scpurm,'\2',"")
|
||||
let g:netrw_port = substitute(a:choice,scpurm,'\2',"")
|
||||
let b:netrw_fname = substitute(a:choice,scpurm,'\3',"")
|
||||
|
||||
" http://user@hostname/...path-to-file
|
||||
@ -2639,9 +2608,6 @@ fun! s:NetMethod(choice) " globals: method machine id passwd fname
|
||||
let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"")
|
||||
let g:netrw_port = substitute(a:choice,ftpurm,'\4',"")
|
||||
let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"")
|
||||
if g:netrw_port != ""
|
||||
let g:netrw_port = substitute(g:netrw_port,"[#:]","","")
|
||||
endif
|
||||
if userid != ""
|
||||
let g:netrw_uid= userid
|
||||
endif
|
||||
@ -2726,6 +2692,11 @@ fun! s:NetMethod(choice) " globals: method machine id passwd fname
|
||||
let b:netrw_method = -1
|
||||
endif
|
||||
|
||||
" remove any leading [:#] from port number
|
||||
if g:netrw_port != ""
|
||||
let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','')
|
||||
endif
|
||||
|
||||
" call Decho("a:choice <".a:choice.">")
|
||||
" call Decho("b:netrw_method <".b:netrw_method.">")
|
||||
" call Decho("g:netrw_machine<".g:netrw_machine.">")
|
||||
|
@ -335,6 +335,8 @@ CClink = $(CC)
|
||||
# automatically be used if it is found. If you have GNOME, but do not want to
|
||||
# use it (e.g., want a GTK-only version), then use --enable-gui=gtk.
|
||||
#
|
||||
# KDE doesn't fully work, unfortunately. See the todo list.
|
||||
#
|
||||
# If the selected GUI isn't found, the GUI is disabled automatically
|
||||
#CONF_OPT_GUI = --enable-gui=gtk
|
||||
#CONF_OPT_GUI = --enable-gui=gtk --disable-gtktest
|
||||
|
43
src/buffer.c
43
src/buffer.c
@ -1641,6 +1641,8 @@ buflist_new(ffname, sfname, lnum, flags)
|
||||
#endif
|
||||
buf->b_u_synced = TRUE;
|
||||
buf->b_flags = BF_CHECK_RO | BF_NEVERLOADED;
|
||||
if (flags & BLN_DUMMY)
|
||||
buf->b_flags |= BF_DUMMY;
|
||||
buf_clear_file(buf);
|
||||
clrallmarks(buf); /* clear marks */
|
||||
fmarks_check_names(buf); /* check file marks for this file */
|
||||
@ -1874,9 +1876,40 @@ buflist_getfpos()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(FEAT_QUICKFIX) || defined(FEAT_EVAL) || defined(PROTO)
|
||||
/*
|
||||
* Find file in buffer list by name (it has to be for the current window).
|
||||
* Returns NULL if not found.
|
||||
*/
|
||||
buf_T *
|
||||
buflist_findname_exp(fname)
|
||||
char_u *fname;
|
||||
{
|
||||
char_u *ffname;
|
||||
buf_T *buf = NULL;
|
||||
|
||||
/* First make the name into a full path name */
|
||||
ffname = FullName_save(fname,
|
||||
#ifdef UNIX
|
||||
TRUE /* force expansion, get rid of symbolic links */
|
||||
#else
|
||||
FALSE
|
||||
#endif
|
||||
);
|
||||
if (ffname != NULL)
|
||||
{
|
||||
buf = buflist_findname(ffname);
|
||||
vim_free(ffname);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Find file in buffer list by name (it has to be for the current window).
|
||||
* "ffname" must have a full path.
|
||||
* Skips dummy buffers.
|
||||
* Returns NULL if not found.
|
||||
*/
|
||||
buf_T *
|
||||
buflist_findname(ffname)
|
||||
@ -1893,6 +1926,7 @@ buflist_findname(ffname)
|
||||
/*
|
||||
* Same as buflist_findname(), but pass the stat structure to avoid getting it
|
||||
* twice for the same file.
|
||||
* Returns NULL if not found.
|
||||
*/
|
||||
static buf_T *
|
||||
buflist_findname_stat(ffname, stp)
|
||||
@ -1903,7 +1937,7 @@ buflist_findname_stat(ffname, stp)
|
||||
buf_T *buf;
|
||||
|
||||
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
||||
if (!otherfile_buf(buf, ffname
|
||||
if ((buf->b_flags & BF_DUMMY) == 0 && !otherfile_buf(buf, ffname
|
||||
#ifdef UNIX
|
||||
, stp
|
||||
#endif
|
||||
@ -2457,9 +2491,9 @@ buflist_name_nr(fnum, fname, lnum)
|
||||
setfname(buf, ffname, sfname, message)
|
||||
buf_T *buf;
|
||||
char_u *ffname, *sfname;
|
||||
int message;
|
||||
int message; /* give message when buffer already exists */
|
||||
{
|
||||
buf_T *obuf;
|
||||
buf_T *obuf = NULL;
|
||||
#ifdef UNIX
|
||||
struct stat st;
|
||||
#endif
|
||||
@ -2489,6 +2523,9 @@ setfname(buf, ffname, sfname, message)
|
||||
#ifdef UNIX
|
||||
if (mch_stat((char *)ffname, &st) < 0)
|
||||
st.st_dev = (dev_T)-1;
|
||||
#endif
|
||||
if (!(buf->b_flags & BF_DUMMY))
|
||||
#ifdef UNIX
|
||||
obuf = buflist_findname_stat(ffname, &st);
|
||||
#else
|
||||
obuf = buflist_findname(ffname);
|
||||
|
@ -820,8 +820,8 @@ win_linetabsize(wp, p, len)
|
||||
}
|
||||
|
||||
/*
|
||||
* return TRUE if 'c' is a normal identifier character
|
||||
* letters and characters from 'isident' option.
|
||||
* Return TRUE if 'c' is a normal identifier character:
|
||||
* Letters and characters from the 'isident' option.
|
||||
*/
|
||||
int
|
||||
vim_isIDc(c)
|
||||
|
@ -2153,6 +2153,10 @@ if test "x$GUITYPE:$enable_fontset" = "xGTK:yes" -a "0$gtk_major_version" -ge 2;
|
||||
AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
|
||||
enable_fontset="no"
|
||||
fi
|
||||
if test "x$GUITYPE:$enable_fontset" = "xKDE:yes"; then
|
||||
AC_MSG_RESULT(KDE GUI selected; fontset has been disabled)
|
||||
enable_fontset="no"
|
||||
fi
|
||||
|
||||
dnl There is no test for the BeOS GUI, if it's selected it's used
|
||||
if test -z "$SKIP_BEOS"; then
|
||||
|
@ -2114,7 +2114,7 @@ do_one_cmd(cmdlinep, sourcing,
|
||||
*/
|
||||
if ((ea.cmdidx == CMD_make
|
||||
|| ea.cmdidx == CMD_grep || ea.cmdidx == CMD_grepadd)
|
||||
&& !grep_internal(&ea))
|
||||
&& !grep_internal(ea.cmdidx))
|
||||
{
|
||||
char_u *new_cmdline;
|
||||
char_u *program;
|
||||
@ -3164,7 +3164,13 @@ set_one_cmd_context(xp, buff)
|
||||
p++;
|
||||
xp->xp_pattern = p;
|
||||
|
||||
if (argt & XFILE)
|
||||
if ((argt & XFILE)
|
||||
#ifdef FEAT_QUICKFIX
|
||||
|| cmdidx == CMD_vimgrep
|
||||
|| cmdidx == CMD_vimgrepadd
|
||||
|| grep_internal(cmdidx)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
int in_quote = FALSE;
|
||||
char_u *bow = NULL; /* Beginning of word */
|
||||
@ -4204,15 +4210,20 @@ separate_nextcmd(eap)
|
||||
|
||||
p = eap->arg;
|
||||
#ifdef FEAT_QUICKFIX
|
||||
if (eap->cmdidx == CMD_vimgrep
|
||||
if (*p != NUL && (eap->cmdidx == CMD_vimgrep
|
||||
|| eap->cmdidx == CMD_vimgrepadd
|
||||
|| grep_internal(eap))
|
||||
|| grep_internal(eap->cmdidx)))
|
||||
{
|
||||
/* Skip over the pattern. */
|
||||
if (vim_isIDc(*p))
|
||||
p = skiptowhite(p);
|
||||
else
|
||||
{
|
||||
p = skip_regexp(p + 1, *p, TRUE, NULL);
|
||||
if (*p == *eap->arg)
|
||||
++p;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for ( ; *p; mb_ptr_adv(p))
|
||||
|
@ -2080,7 +2080,8 @@ cmdline_at_end()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) || defined(PROTO)
|
||||
#if (defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE))) \
|
||||
|| defined(PROTO)
|
||||
/*
|
||||
* Return the virtual column number at the current cursor position.
|
||||
* This is used by the IM code to obtain the start of the preedit string.
|
||||
|
@ -650,7 +650,8 @@
|
||||
* +xfontset X fontset support. For outputting wide characters.
|
||||
*/
|
||||
#ifndef FEAT_XFONTSET
|
||||
# if defined(FEAT_MBYTE) && defined(HAVE_X11) && !defined(HAVE_GTK2)
|
||||
# if defined(FEAT_MBYTE) && defined(HAVE_X11) \
|
||||
&& !defined(HAVE_GTK2) && !defined(FEAT_GUI_KDE)
|
||||
# define FEAT_XFONTSET
|
||||
# else
|
||||
/* # define FEAT_XFONTSET */
|
||||
@ -1172,7 +1173,7 @@
|
||||
|| defined(FEAT_NETBEANS_INTG))
|
||||
# define FEAT_BEVAL
|
||||
# if !defined(FEAT_XFONTSET) && !defined(FEAT_GUI_GTK) \
|
||||
&& !defined(FEAT_GUI_W32)
|
||||
&& !defined(FEAT_GUI_KDE) && !defined(FEAT_GUI_W32)
|
||||
# define FEAT_XFONTSET
|
||||
# endif
|
||||
#endif
|
||||
|
@ -725,6 +725,7 @@ EXTERN int* (*iconv_errno) (void);
|
||||
#ifdef FEAT_XIM
|
||||
# ifdef FEAT_GUI_KDE
|
||||
EXTERN colnr_T preedit_start_col INIT(= MAXCOL);
|
||||
EXTERN colnr_T preedit_end_col INIT(= MAXCOL);
|
||||
EXTERN char *draw_feedback INIT(= NULL);
|
||||
# endif
|
||||
# ifdef FEAT_GUI_GTK
|
||||
|
@ -1918,7 +1918,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
|
||||
long_u hl_mask_todo;
|
||||
guicolor_T fg_color;
|
||||
guicolor_T bg_color;
|
||||
#if !defined(MSWIN16_FASTTEXT) && !defined(HAVE_GTK2)
|
||||
#if !defined(MSWIN16_FASTTEXT) && !defined(HAVE_GTK2) && !defined(FEAT_GUI_KDE)
|
||||
GuiFont font = NOFONT;
|
||||
# ifdef FEAT_XFONTSET
|
||||
GuiFontset fontset = NOFONTSET;
|
||||
@ -1972,7 +1972,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
|
||||
highlight_mask = gui.highlight_mask;
|
||||
hl_mask_todo = highlight_mask;
|
||||
|
||||
#if !defined(MSWIN16_FASTTEXT) && !defined(HAVE_GTK2)
|
||||
#if !defined(MSWIN16_FASTTEXT) && !defined(HAVE_GTK2) && !defined(FEAT_GUI_KDE)
|
||||
/* Set the font */
|
||||
if (aep != NULL && aep->ae_u.gui.font != NOFONT)
|
||||
font = aep->ae_u.gui.font;
|
||||
@ -2173,10 +2173,14 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
|
||||
cells = 0;
|
||||
if (dowide)
|
||||
{
|
||||
#ifndef FEAT_GUI_KDE
|
||||
gui_mch_set_font(gui.wide_font);
|
||||
#endif
|
||||
gui_mch_draw_string(gui.row, scol - cn,
|
||||
s + start, cl, draw_flags);
|
||||
#ifndef FEAT_GUI_KDE
|
||||
gui_mch_set_font(font);
|
||||
#endif
|
||||
start += cl;
|
||||
}
|
||||
|
||||
|
@ -206,9 +206,7 @@ pixmap_create_by_dir(char_u *name)//{{{
|
||||
char_u full_pathname[MAXPATHL + 1];
|
||||
|
||||
if (gui_find_bitmap(name, full_pathname, "xpm") == OK)
|
||||
{
|
||||
return QPixmap((const char *)full_pathname);
|
||||
}
|
||||
else
|
||||
return QPixmap();
|
||||
}//}}}
|
||||
@ -230,7 +228,7 @@ gui_mch_add_menu(vimmenu_T * menu, int idx)//{{{
|
||||
|
||||
if (menu_is_popup(menu->name))
|
||||
{
|
||||
menu->widget = new QPopupMenu(vmw , (const char *)menu->name);
|
||||
menu->widget = new QPopupMenu(vmw , QSTR(menu->name));
|
||||
QObject::connect(menu->widget, SIGNAL(activated(int)), vmw,
|
||||
SLOT(menu_activated(int)));
|
||||
return;
|
||||
@ -242,15 +240,13 @@ gui_mch_add_menu(vimmenu_T * menu, int idx)//{{{
|
||||
if (parent)
|
||||
{
|
||||
idx++; // for tearoffs to be first in menus
|
||||
me = new QPopupMenu(parent->widget, (const char *)menu->name);
|
||||
parent->widget->insertItem(QString((const char *)menu->name), me,
|
||||
(int)me, idx);
|
||||
me = new QPopupMenu(parent->widget, QSTR(menu->name));
|
||||
parent->widget->insertItem(QSTR(menu->name), me, (int)me, idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
me = new QPopupMenu(vmw->menuBar() , (const char *)menu->name);
|
||||
vmw->menuBar()->insertItem(QString((const char *)menu->name), me,
|
||||
(int)me, idx);
|
||||
me = new QPopupMenu(vmw->menuBar(), QSTR(menu->name));
|
||||
vmw->menuBar()->insertItem(QSTR(menu->name), me, (int)me, idx);
|
||||
}
|
||||
|
||||
me->setCaption((const char *)(menu->dname));
|
||||
@ -302,7 +298,7 @@ gui_mch_add_menu_item(vimmenu_T * menu, int idx)//{{{
|
||||
pix,
|
||||
(int)menu, // id
|
||||
true,
|
||||
(char *)(menu->strings[MENU_INDEX_TIP]), // tooltip or text
|
||||
QSTR(menu->strings[MENU_INDEX_TIP]), // tooltip or text
|
||||
idx);
|
||||
menu->parent=parent;
|
||||
return;
|
||||
@ -315,7 +311,7 @@ gui_mch_add_menu_item(vimmenu_T * menu, int idx)//{{{
|
||||
parent->widget->insertSeparator();
|
||||
return;
|
||||
}
|
||||
parent->widget->insertItem(QString((const char *)menu->name), (int)menu, idx);
|
||||
parent->widget->insertItem(QSTR(menu->name), (int)menu, idx);
|
||||
#endif
|
||||
}//}}}
|
||||
|
||||
@ -429,6 +425,7 @@ gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h)//{{{
|
||||
{
|
||||
if (!sb->w)
|
||||
return;
|
||||
|
||||
//we add the menubar and toolbar height/width
|
||||
int X = 0;
|
||||
int Y = 0;
|
||||
@ -524,8 +521,8 @@ gui_mch_browse(int saving,//{{{
|
||||
|
||||
QString s;
|
||||
if (!saving)
|
||||
s = KFileDialog::getOpenFileName((char *)initdir, (char *)filt_glob,
|
||||
vmw, (char *)title);
|
||||
s = KFileDialog::getOpenFileName(QSTR(initdir), QSTR(filt_glob),
|
||||
vmw, QSTR(title));
|
||||
else
|
||||
s = KFileDialog::getSaveFileName();
|
||||
|
||||
|
@ -136,6 +136,7 @@ struct special_key {//{{{
|
||||
{Qt::Key_7, 'K', 'J'},
|
||||
{Qt::Key_8, 'K', 'K'},
|
||||
{Qt::Key_9, 'K', 'L'},
|
||||
|
||||
/* End of list marker: */
|
||||
{0, 0, 0}
|
||||
};//}}}
|
||||
@ -164,23 +165,27 @@ gui_mch_haskey(char_u * name)//{{{
|
||||
/*
|
||||
* custom Frame for drawing ...
|
||||
*/
|
||||
void VimWidget::paintEvent(QPaintEvent *e)//{{{
|
||||
void
|
||||
VimWidget::paintEvent(QPaintEvent *e)//{{{
|
||||
{
|
||||
QRect r = e->rect();
|
||||
gui_redraw(r.x(), r.y(), r.width(), r.height());
|
||||
}//}}}
|
||||
|
||||
void VimWidget::draw_string(int x, int y, QString s, int len, int flags)//{{{
|
||||
void
|
||||
VimWidget::draw_string(int x, int y, QString s, int len, int flags)//{{{
|
||||
{
|
||||
gui.current_font->setBold(flags & DRAW_BOLD);
|
||||
gui.current_font->setUnderline(flags & DRAW_UNDERL);
|
||||
gui.current_font->setItalic(flags & DRAW_ITALIC);
|
||||
painter->setBackgroundMode(flags & DRAW_TRANSP ? Qt::TransparentMode : Qt::OpaqueMode);
|
||||
painter->setBackgroundMode(flags & DRAW_TRANSP
|
||||
? Qt::TransparentMode : Qt::OpaqueMode);
|
||||
painter->setFont(*(gui.current_font));
|
||||
painter->drawText(x, y, s, len);
|
||||
}//}}}
|
||||
|
||||
void VimWidget::mousePressEvent(QMouseEvent *event)//{{{
|
||||
void
|
||||
VimWidget::mousePressEvent(QMouseEvent *event)//{{{
|
||||
{
|
||||
int button = 0;
|
||||
int modifiers = 0;
|
||||
@ -205,14 +210,17 @@ void VimWidget::mousePressEvent(QMouseEvent *event)//{{{
|
||||
#if QT_VERSION>=300
|
||||
QByteArray params;
|
||||
QDataStream stream(params, IO_WriteOnly);
|
||||
stream << kapp->dcopClient()->appId() << button << modifiers << gui.row << gui.col;
|
||||
kapp->dcopClient()->emitDCOPSignal("mousePEvent(QCString,int,int,int,int)", params);
|
||||
stream << kapp->dcopClient()->appId() << button << modifiers
|
||||
<< gui.row << gui.col;
|
||||
kapp->dcopClient()->emitDCOPSignal(
|
||||
"mousePEvent(QCString, int, int, int, int)", params);
|
||||
#endif
|
||||
event->accept();
|
||||
}//}}}
|
||||
|
||||
#if defined(FEAT_SESSION)
|
||||
void VimMainWindow::saveGlobalProperties (KConfig *conf)
|
||||
void
|
||||
VimMainWindow::saveGlobalProperties(KConfig *conf)
|
||||
{
|
||||
//we write a mksession file to a file written in the user's ~/.kde/share/config/
|
||||
//the name of the file in saved in 'conf'
|
||||
@ -227,7 +235,8 @@ void VimMainWindow::saveGlobalProperties (KConfig *conf)
|
||||
#endif
|
||||
}
|
||||
|
||||
void VimMainWindow::readGlobalProperties (KConfig *conf)
|
||||
void
|
||||
VimMainWindow::readGlobalProperties (KConfig *conf)
|
||||
{
|
||||
#if 0
|
||||
QString filename = conf->readPathEntry("sessionfile");
|
||||
@ -239,7 +248,8 @@ void VimMainWindow::readGlobalProperties (KConfig *conf)
|
||||
}
|
||||
#endif
|
||||
|
||||
void VimMainWindow::wheelEvent (QWheelEvent *event)//{{{
|
||||
void
|
||||
VimMainWindow::wheelEvent (QWheelEvent *event)//{{{
|
||||
{
|
||||
ButtonState state = event->state();
|
||||
int button = 0;
|
||||
@ -260,13 +270,16 @@ void VimMainWindow::wheelEvent (QWheelEvent *event)//{{{
|
||||
#if QT_VERSION>=300
|
||||
QByteArray params;
|
||||
QDataStream stream(params, IO_WriteOnly);
|
||||
stream << kapp->dcopClient()->appId() << button << modifiers << gui.row << gui.col;
|
||||
kapp->dcopClient()->emitDCOPSignal("mouseWhlEvent(QCString, int, int,int,int)", params);
|
||||
stream << kapp->dcopClient()->appId() << button << modifiers
|
||||
<< gui.row << gui.col;
|
||||
kapp->dcopClient()->emitDCOPSignal(
|
||||
"mouseWhlEvent(QCString, int, int, int, int)", params);
|
||||
#endif
|
||||
event->accept();
|
||||
}//}}}
|
||||
|
||||
void VimWidget::mouseDoubleClickEvent(QMouseEvent *event)//{{{
|
||||
void
|
||||
VimWidget::mouseDoubleClickEvent(QMouseEvent *event)//{{{
|
||||
{
|
||||
ButtonState state = event->state();
|
||||
ButtonState buttons = event->button();
|
||||
@ -293,13 +306,17 @@ void VimWidget::mouseDoubleClickEvent(QMouseEvent *event)//{{{
|
||||
#if QT_VERSION>=300
|
||||
QByteArray params;
|
||||
QDataStream stream(params, IO_WriteOnly);
|
||||
stream << kapp->dcopClient()->appId() << button << modifiers << gui.row << gui.col;
|
||||
kapp->dcopClient()->emitDCOPSignal("mouseDblClickEvent(QCString, int, int,int,int)", params);
|
||||
stream << kapp->dcopClient()->appId() << button << modifiers
|
||||
<< gui.row << gui.col;
|
||||
kapp->dcopClient()->emitDCOPSignal(
|
||||
"mouseDblClickEvent(QCString, int, int, int, int)", params);
|
||||
#endif
|
||||
event->accept();
|
||||
}//}}}
|
||||
|
||||
void VimWidget::mouseMoveEvent(QMouseEvent *event){//{{{
|
||||
void
|
||||
VimWidget::mouseMoveEvent(QMouseEvent *event)//{{{
|
||||
{
|
||||
ButtonState state = event->state();
|
||||
int modifiers = 0;
|
||||
int button = 0;
|
||||
@ -308,7 +325,9 @@ void VimWidget::mouseMoveEvent(QMouseEvent *event){//{{{
|
||||
|
||||
//Look at button states
|
||||
//warning: we use state here, this is important !
|
||||
if (state & QMouseEvent::LeftButton || state & QMouseEvent::RightButton || state & QMouseEvent::MidButton)
|
||||
if (state & QMouseEvent::LeftButton
|
||||
|| state & QMouseEvent::RightButton
|
||||
|| state & QMouseEvent::MidButton)
|
||||
button |= MOUSE_DRAG;
|
||||
|
||||
//Look for keyboard modifiers
|
||||
@ -321,10 +340,12 @@ void VimWidget::mouseMoveEvent(QMouseEvent *event){//{{{
|
||||
if (button != MOUSE_DRAG)
|
||||
gui_mouse_moved(event->x(), event->y());
|
||||
else
|
||||
gui_send_mouse_event(MOUSE_DRAG,event->x(),event->y(),FALSE,modifiers);
|
||||
gui_send_mouse_event(MOUSE_DRAG, event->x(), event->y(),
|
||||
FALSE, modifiers);
|
||||
}//}}}
|
||||
|
||||
void VimWidget::mouseReleaseEvent(QMouseEvent *event)//{{{
|
||||
void
|
||||
VimWidget::mouseReleaseEvent(QMouseEvent *event)//{{{
|
||||
{
|
||||
ButtonState state = event->state();
|
||||
int modifiers = 0;
|
||||
@ -337,7 +358,8 @@ void VimWidget::mouseReleaseEvent(QMouseEvent *event)//{{{
|
||||
if (state & AltButton)
|
||||
modifiers |= MOUSE_ALT;
|
||||
|
||||
gui_send_mouse_event(MOUSE_RELEASE,event->x(),event->y(),FALSE,modifiers);
|
||||
gui_send_mouse_event(MOUSE_RELEASE, event->x(), event->y(),
|
||||
FALSE, modifiers);
|
||||
event->accept();
|
||||
}//}}}
|
||||
|
||||
@ -364,9 +386,11 @@ void VimWidget::mouseReleaseEvent(QMouseEvent *event)//{{{
|
||||
blink_wait_time = 250;
|
||||
connect( &blink_timer, SIGNAL(timeout()), SLOT(blink_cursor()));
|
||||
connect( &wait_timer, SIGNAL(timeout()), SLOT(wait_timeout()));
|
||||
setInputMethodEnabled(true);
|
||||
}//}}}
|
||||
|
||||
void VimWidget::execNormal(QString command)//{{{
|
||||
void
|
||||
VimWidget::execNormal(QString command)//{{{
|
||||
{
|
||||
QString cmd("execute 'normal ");
|
||||
cmd += command;
|
||||
@ -376,7 +400,8 @@ void VimWidget::execNormal(QString command)//{{{
|
||||
gui_update_screen();
|
||||
}//}}}
|
||||
|
||||
void VimWidget::execInsert(QString command)//{{{
|
||||
void
|
||||
VimWidget::execInsert(QString command)//{{{
|
||||
{
|
||||
QString cmd("execute 'normal i");
|
||||
cmd += command;
|
||||
@ -386,7 +411,8 @@ void VimWidget::execInsert(QString command)//{{{
|
||||
gui_update_screen();
|
||||
}//}}}
|
||||
|
||||
void VimWidget::execRaw(QString command)//{{{
|
||||
void
|
||||
VimWidget::execRaw(QString command)//{{{
|
||||
{
|
||||
QString cmd("execute '");
|
||||
cmd += command;
|
||||
@ -396,37 +422,44 @@ void VimWidget::execRaw(QString command)//{{{
|
||||
gui_update_screen();
|
||||
}//}}}
|
||||
|
||||
void VimWidget::execCmd(QString command)//{{{
|
||||
void
|
||||
VimWidget::execCmd(QString command)//{{{
|
||||
{
|
||||
QCString unistring = vmw->codec->fromUnicode(command);
|
||||
do_cmdline_cmd((char_u *)(const char*)unistring);
|
||||
gui_update_screen();
|
||||
}//}}}
|
||||
|
||||
QString VimWidget::eval(QString expr)//{{{
|
||||
QString
|
||||
VimWidget::eval(QString expr)//{{{
|
||||
{
|
||||
#ifdef FEAT_EVAL
|
||||
QCString unistring = vmw->codec->fromUnicode(expr);
|
||||
QString val((const char *)eval_to_string((char_u *)(const char*)unistring,NULL));
|
||||
QString val((const char *)eval_to_string(
|
||||
(char_u *)(const char*)unistring, NULL));
|
||||
return val;
|
||||
#else
|
||||
return QString::null;
|
||||
#endif
|
||||
}//}}}
|
||||
|
||||
void VimWidget::wait(long wtime)//{{{
|
||||
void
|
||||
VimWidget::wait(long wtime)//{{{
|
||||
{
|
||||
if ( wait_timer.isActive() ) wait_timer.stop();
|
||||
if (wait_timer.isActive())
|
||||
wait_timer.stop();
|
||||
wait_done = false;
|
||||
wait_timer.start( wtime, true);
|
||||
}//}}}
|
||||
|
||||
void VimWidget::wait_timeout() //{{{
|
||||
void
|
||||
VimWidget::wait_timeout() //{{{
|
||||
{
|
||||
wait_done = true;
|
||||
}//}}}
|
||||
|
||||
void VimWidget::dragEnterEvent (QDragEnterEvent *e)//{{{
|
||||
void
|
||||
VimWidget::dragEnterEvent (QDragEnterEvent *e)//{{{
|
||||
{
|
||||
#if (defined(FEAT_WINDOWS) && defined(HAVE_DROP_FILE)) || defined(PROTO)
|
||||
e->accept(QUriDrag::canDecode(e));
|
||||
@ -435,7 +468,8 @@ void VimWidget::dragEnterEvent (QDragEnterEvent *e)//{{{
|
||||
#endif
|
||||
}//}}}
|
||||
|
||||
void VimWidget::dropEvent (QDropEvent *e) // {{{
|
||||
void
|
||||
VimWidget::dropEvent(QDropEvent *e) // {{{
|
||||
{
|
||||
#if (defined(FEAT_WINDOWS) && defined(HAVE_DROP_FILE)) || defined(PROTO)
|
||||
QStrList urls;
|
||||
@ -511,6 +545,7 @@ void VimWidget::dropEvent (QDropEvent *e) // {{{
|
||||
{
|
||||
char_u dirname[MAXPATHL];
|
||||
char_u *s;
|
||||
|
||||
if (mch_dirname(dirname, MAXPATHL) == OK)
|
||||
for (i = 0; i < nfiles; ++i)
|
||||
if (fnames[i] != NULL)
|
||||
@ -544,12 +579,15 @@ void VimWidget::dropEvent (QDropEvent *e) // {{{
|
||||
#endif
|
||||
} // }}}
|
||||
|
||||
void VimWidget::keyPressEvent( QKeyEvent *e ) // {{{
|
||||
void
|
||||
VimWidget::keyPressEvent(QKeyEvent *e) // {{{
|
||||
{
|
||||
gui_keypress(e);
|
||||
} // }}}
|
||||
|
||||
void gui_keypress(QKeyEvent *e) { // {{{
|
||||
void
|
||||
gui_keypress(QKeyEvent *e) // {{{
|
||||
{
|
||||
int key = (int)e->key();
|
||||
int modifiers = 0, i;
|
||||
uchar string[256], string2[256];
|
||||
@ -563,8 +601,13 @@ void gui_keypress(QKeyEvent *e) { // {{{
|
||||
int len = unistring.length();
|
||||
|
||||
// ignore certain keys
|
||||
if (key == Qt::Key_Shift || key == Qt::Key_Alt || key == Qt::Key_Control || key == Qt::Key_Meta
|
||||
|| key == Qt::Key_CapsLock || key == Qt::Key_NumLock || key == Qt::Key_ScrollLock )
|
||||
if (key == Qt::Key_Shift
|
||||
|| key == Qt::Key_Alt
|
||||
|| key == Qt::Key_Control
|
||||
|| key == Qt::Key_Meta
|
||||
|| key == Qt::Key_CapsLock
|
||||
|| key == Qt::Key_NumLock
|
||||
|| key == Qt::Key_ScrollLock)
|
||||
{
|
||||
e->ignore();
|
||||
return;
|
||||
@ -599,8 +642,7 @@ void gui_keypress(QKeyEvent *e) { // {{{
|
||||
key = Qt::Key_Tab;
|
||||
|
||||
// Change C-@ and C-2 in NUL ? Gtk does this
|
||||
if ( (key == Qt::Key_2 || key == Qt::Key_At)
|
||||
&& state & Qt::ControlButton )
|
||||
if ((key == Qt::Key_2 || key == Qt::Key_At) && state & Qt::ControlButton)
|
||||
{
|
||||
string[0] = NUL;
|
||||
len = 1;
|
||||
@ -642,7 +684,8 @@ void gui_keypress(QKeyEvent *e) { // {{{
|
||||
/* Check for special keys, making sure BS and DEL are recognised. */
|
||||
if (len == 0 || key == Qt::Key_BackSpace || key == Qt::Key_Delete)
|
||||
{
|
||||
while (special_keys[i].qtkey != 0 && special_keys[i].qtkey != key ) i++;
|
||||
while (special_keys[i].qtkey != 0 && special_keys[i].qtkey != key)
|
||||
i++;
|
||||
if (special_keys[i].qtkey != 0)
|
||||
{
|
||||
string[0] = CSI;
|
||||
@ -674,15 +717,20 @@ void gui_keypress(QKeyEvent *e) { // {{{
|
||||
|
||||
|
||||
/* Special keys (and a few others) may have modifiers */
|
||||
if (len == -3 || key == Qt::Key_Space || key == Qt::Key_Tab ||
|
||||
key == Qt::Key_Return || key == Qt::Key_Enter ||
|
||||
key == Qt::Key_Escape)
|
||||
if (len == -3
|
||||
|| key == Qt::Key_Space
|
||||
|| key == Qt::Key_Tab
|
||||
|| key == Qt::Key_Return
|
||||
|| key == Qt::Key_Enter
|
||||
|| key == Qt::Key_Escape)
|
||||
{
|
||||
|
||||
modifiers = 0;
|
||||
if (state & Qt::ShiftButton) modifiers |= MOD_MASK_SHIFT;
|
||||
if (state & Qt::ControlButton) modifiers |= MOD_MASK_CTRL;
|
||||
if (state & Qt::AltButton) modifiers |= MOD_MASK_ALT;
|
||||
if (state & Qt::ShiftButton)
|
||||
modifiers |= MOD_MASK_SHIFT;
|
||||
if (state & Qt::ControlButton)
|
||||
modifiers |= MOD_MASK_CTRL;
|
||||
if (state & Qt::AltButton)
|
||||
modifiers |= MOD_MASK_ALT;
|
||||
|
||||
/*
|
||||
* For some keys a shift modifier is translated into another key
|
||||
@ -695,7 +743,8 @@ void gui_keypress(QKeyEvent *e) { // {{{
|
||||
key = string[0];
|
||||
|
||||
key = simplify_key(key, &modifiers);
|
||||
if (key == CSI) key=K_CSI;
|
||||
if (key == CSI)
|
||||
key = K_CSI;
|
||||
|
||||
if (IS_SPECIAL(key))
|
||||
{
|
||||
@ -710,7 +759,6 @@ void gui_keypress(QKeyEvent *e) { // {{{
|
||||
len = 1;
|
||||
}
|
||||
|
||||
|
||||
if (modifiers != 0)
|
||||
{
|
||||
uchar string2[10];
|
||||
@ -748,13 +796,15 @@ void gui_keypress(QKeyEvent *e) { // {{{
|
||||
QByteArray params;
|
||||
QDataStream stream(params, IO_WriteOnly);
|
||||
stream << kapp->dcopClient()->appId() << unistring << gui.row << gui.col;
|
||||
kapp->dcopClient()->emitDCOPSignal("keyboardEvent(QCString, QCString,int,int)", params);
|
||||
kapp->dcopClient()->emitDCOPSignal(
|
||||
"keyboardEvent(QCString, QCString, int, int)", params);
|
||||
#endif
|
||||
e->ignore();
|
||||
} // }}}
|
||||
|
||||
#ifdef FEAT_CLIENTSERVER
|
||||
void VimWidget::serverActivate(WId id) //{{{
|
||||
void
|
||||
VimWidget::serverActivate(WId id) //{{{
|
||||
{
|
||||
if (serverName == NULL && serverDelayedStartName != NULL)
|
||||
{
|
||||
@ -767,53 +817,175 @@ void VimWidget::serverActivate(WId id) //{{{
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_XIM
|
||||
void VimWidget::imStartEvent(QIMEvent *e)
|
||||
|
||||
static int preedit_buf_len = 0;
|
||||
static int im_preedit_cursor = 0;
|
||||
static int im_preedit_trailing = 0;
|
||||
|
||||
static void
|
||||
im_delete_preedit(void)
|
||||
{
|
||||
char_u bskey[] = {CSI, 'k', 'b'};
|
||||
char_u delkey[] = {CSI, 'k', 'D'};
|
||||
|
||||
if (State & NORMAL)
|
||||
{
|
||||
im_preedit_cursor = 0;
|
||||
return;
|
||||
}
|
||||
for (; im_preedit_cursor > 0; --im_preedit_cursor)
|
||||
add_to_input_buf(bskey, (int)sizeof(bskey));
|
||||
|
||||
for (; im_preedit_trailing > 0; --im_preedit_trailing)
|
||||
add_to_input_buf(delkey, (int)sizeof(delkey));
|
||||
}
|
||||
|
||||
void
|
||||
im_set_position(int row, int col)
|
||||
{
|
||||
vmw->w->setMicroFocusHint(
|
||||
TEXT_X(gui.col),
|
||||
TEXT_Y(gui.row), 0, 0, TRUE, &vmw->w->font());
|
||||
}
|
||||
|
||||
int
|
||||
im_is_preediting()
|
||||
{
|
||||
return (preedit_start_col != MAXCOL);
|
||||
}
|
||||
|
||||
int
|
||||
im_get_feedback_attr(int col)
|
||||
{
|
||||
if (draw_feedback != NULL && col < preedit_buf_len)
|
||||
{
|
||||
if (draw_feedback[col] & XIMReverse)
|
||||
return HL_INVERSE;
|
||||
else if (draw_feedback[col] & XIMUnderline)
|
||||
return HL_UNDERLINE;
|
||||
else
|
||||
return hl_attr(HLF_V);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
VimWidget::imStartEvent(QIMEvent *e)
|
||||
{
|
||||
if (State & CMDLINE)
|
||||
preedit_start_col = cmdline_getvcol_cursor();
|
||||
else if (curwin != NULL)
|
||||
getvcol(curwin, &curwin->w_cursor, &preedit_start_col, NULL, NULL);
|
||||
xic = (XIC)!NULL;
|
||||
e->accept();
|
||||
}
|
||||
|
||||
void VimWidget::imEndEvent(QIMEvent *e)
|
||||
void
|
||||
VimWidget::imEndEvent(QIMEvent *e)
|
||||
{
|
||||
uchar string[256];
|
||||
|
||||
im_delete_preedit();
|
||||
|
||||
QCString unistring = vmw->codec->fromUnicode(e->text());
|
||||
if (unistring.length() > 0)
|
||||
strncpy((char*)string, (const char*)unistring, unistring.length());
|
||||
string[unistring.length()] = 0;
|
||||
int len = unistring.length();
|
||||
|
||||
add_to_input_buf(string, len);
|
||||
add_to_input_buf_csi(string, len);
|
||||
im_preedit_cursor = 0;
|
||||
im_preedit_trailing = 0;
|
||||
preedit_start_col = MAXCOL;
|
||||
preedit_buf_len = 0;
|
||||
if (draw_feedback)
|
||||
{
|
||||
free(draw_feedback);
|
||||
draw_feedback = NULL;
|
||||
}
|
||||
xic = 0;
|
||||
e->accept();
|
||||
}
|
||||
|
||||
void VimWidget::imComposeEvent(QIMEvent *e)
|
||||
void
|
||||
VimWidget::imComposeEvent(QIMEvent *e)
|
||||
{
|
||||
//i should do something here, displaying the text somewhere ... (status area ?)
|
||||
uchar string[256];
|
||||
char_u backkey[] = {CSI, 'k', 'l'};
|
||||
|
||||
im_delete_preedit();
|
||||
|
||||
if (State & NORMAL)
|
||||
{
|
||||
im_preedit_cursor = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
QCString unistring = vmw->codec->fromUnicode(e->text());
|
||||
if (unistring.length() > 0)
|
||||
strncpy((char*)string, (const char*)unistring,unistring.length());
|
||||
string[unistring.length()] = 0;
|
||||
int len = unistring.length();
|
||||
add_to_input_buf_csi(string, len);
|
||||
|
||||
preedit_buf_len = e->text().length();
|
||||
if (draw_feedback == NULL)
|
||||
draw_feedback = (char *)alloc(preedit_buf_len);
|
||||
else
|
||||
draw_feedback = (char *)realloc(draw_feedback, preedit_buf_len);
|
||||
preedit_end_col = preedit_start_col;
|
||||
|
||||
char_u *p = string;
|
||||
for (int n = 0; n < preedit_buf_len; n++)
|
||||
{
|
||||
if (n < e->cursorPos() || n >= e->cursorPos() + e->selectionLength())
|
||||
draw_feedback[n] = XIMUnderline;
|
||||
else
|
||||
draw_feedback[n] = XIMReverse;
|
||||
preedit_end_col += (*mb_ptr2cells)(p);
|
||||
p += (*mb_ptr2len_check)(p);
|
||||
}
|
||||
im_preedit_cursor = e->cursorPos();
|
||||
im_preedit_trailing = preedit_buf_len - im_preedit_cursor;
|
||||
|
||||
# ifdef FEAT_RIGHTLEFT
|
||||
if ((State & CMDLINE) == 0 && curwin != NULL && curwin->w_p_rl)
|
||||
backkey[2] = 'r';
|
||||
# endif
|
||||
for (int n = 0; n < im_preedit_trailing; n++)
|
||||
add_to_input_buf(backkey, (int)sizeof(backkey));
|
||||
|
||||
e->accept();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void VimMainWindow::lock()
|
||||
void
|
||||
VimMainWindow::lock()
|
||||
{
|
||||
locked = true;
|
||||
}
|
||||
|
||||
void VimMainWindow::unlock()
|
||||
void
|
||||
VimMainWindow::unlock()
|
||||
{
|
||||
locked = false;
|
||||
}
|
||||
|
||||
bool VimMainWindow::isLocked()
|
||||
bool
|
||||
VimMainWindow::isLocked()
|
||||
{
|
||||
return locked;
|
||||
}
|
||||
|
||||
// ->resize VimWidget if not locked
|
||||
//
|
||||
void VimMainWindow::resizeEvent ( QResizeEvent *e ) //{{{
|
||||
void
|
||||
VimMainWindow::resizeEvent(QResizeEvent *e) //{{{
|
||||
{
|
||||
if ( vmw->isLocked() ) return;
|
||||
if (vmw->isLocked())
|
||||
return;
|
||||
//remove toolbar and menubar height
|
||||
int height = e->size().height();
|
||||
int width = e->size().width();
|
||||
@ -825,21 +997,23 @@ void VimMainWindow::resizeEvent ( QResizeEvent *e ) //{{{
|
||||
)
|
||||
height -= vmw->menuBar()->height();
|
||||
#ifdef FEAT_TOOLBAR
|
||||
if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
|
||||
(vmw->toolBar()->barPos()==KToolBar::Top ||
|
||||
vmw->toolBar()->barPos()==KToolBar::Bottom))
|
||||
if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled()
|
||||
&& (vmw->toolBar()->barPos() == KToolBar::Top
|
||||
|| vmw->toolBar()->barPos() == KToolBar::Bottom))
|
||||
height -= vmw->toolBar()->height();
|
||||
|
||||
if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
|
||||
(vmw->toolBar()->barPos()==KToolBar::Left ||
|
||||
vmw->toolBar()->barPos()==KToolBar::Right))
|
||||
if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled()
|
||||
&& (vmw->toolBar()->barPos() == KToolBar::Left
|
||||
|| vmw->toolBar()->barPos() == KToolBar::Right))
|
||||
width -= vmw->toolBar()->width();
|
||||
#endif
|
||||
height = ( ((int)(height/gui.char_height))*gui.char_height );
|
||||
if (!vmw->isLocked()) gui_resize_shell(width,height);
|
||||
height = ((int)(height/gui.char_height))*gui.char_height;
|
||||
if (!vmw->isLocked())
|
||||
gui_resize_shell(width, height);
|
||||
}//}}}
|
||||
|
||||
void VimWidget::focusInEvent( QFocusEvent * fe ) // {{{
|
||||
void
|
||||
VimWidget::focusInEvent(QFocusEvent *fe) // {{{
|
||||
{
|
||||
gui_focus_change(true);
|
||||
|
||||
@ -847,7 +1021,8 @@ void VimWidget::focusInEvent( QFocusEvent * fe ) // {{{
|
||||
gui_mch_start_blink();
|
||||
} // }}}
|
||||
|
||||
void VimWidget::focusOutEvent( QFocusEvent * fe )//{{{
|
||||
void
|
||||
VimWidget::focusOutEvent(QFocusEvent *fe)//{{{
|
||||
{
|
||||
gui_focus_change(false);
|
||||
|
||||
@ -855,16 +1030,19 @@ void VimWidget::focusOutEvent( QFocusEvent * fe )//{{{
|
||||
gui_mch_stop_blink();
|
||||
}//}}}
|
||||
|
||||
void VimWidget::set_blink_time( long wait, long on, long off)//{{{
|
||||
void
|
||||
VimWidget::set_blink_time(long wait, long on, long off)//{{{
|
||||
{
|
||||
blink_wait_time = wait;
|
||||
blink_on_time = on;
|
||||
blink_off_time = off;
|
||||
}//}}}
|
||||
|
||||
void VimWidget::start_cursor_blinking()//{{{
|
||||
void
|
||||
VimWidget::start_cursor_blinking()//{{{
|
||||
{
|
||||
if (blink_timer.isActive()) blink_timer.stop();
|
||||
if (blink_timer.isActive())
|
||||
blink_timer.stop();
|
||||
|
||||
/* Only switch blinking on if none of the times is zero */
|
||||
if (blink_wait_time && blink_on_time && blink_off_time && gui.in_focus)
|
||||
@ -876,7 +1054,8 @@ void VimWidget::start_cursor_blinking()//{{{
|
||||
}
|
||||
}//}}}
|
||||
|
||||
void VimWidget::blink_cursor()//{{{
|
||||
void
|
||||
VimWidget::blink_cursor()//{{{
|
||||
{
|
||||
if (blink_state == BLINK_ON)
|
||||
{
|
||||
@ -894,9 +1073,11 @@ void VimWidget::blink_cursor()//{{{
|
||||
}
|
||||
}//}}}
|
||||
|
||||
void VimWidget::stop_cursor_blinking()//{{{
|
||||
void
|
||||
VimWidget::stop_cursor_blinking()//{{{
|
||||
{
|
||||
if (blink_timer.isActive()) blink_timer.stop();
|
||||
if (blink_timer.isActive())
|
||||
blink_timer.stop();
|
||||
|
||||
if (blink_state == BLINK_OFF)
|
||||
gui_update_cursor(TRUE, FALSE);
|
||||
@ -905,24 +1086,28 @@ void VimWidget::stop_cursor_blinking()//{{{
|
||||
}//}}}
|
||||
|
||||
#ifdef FEAT_MZSCHEME
|
||||
void VimWidget::timerEvent( QTimerEvent * evnt)//{{{
|
||||
void
|
||||
VimWidget::timerEvent(QTimerEvent * evnt)//{{{
|
||||
{
|
||||
if (evnt->timerId() == mzscheme_timer_id)
|
||||
timer_proc();
|
||||
}//}}}
|
||||
|
||||
void VimWidget::enable_mzscheme_threads()//{{{
|
||||
void
|
||||
VimWidget::enable_mzscheme_threads()//{{{
|
||||
{
|
||||
mzscheme_timer_id = startTimer(p_mzq);
|
||||
}//}}}
|
||||
|
||||
void VimWidget::disable_mzscheme_threads()//{{{
|
||||
void
|
||||
VimWidget::disable_mzscheme_threads()//{{{
|
||||
{
|
||||
killTimer(mzscheme_timer_id);
|
||||
}//}}}
|
||||
#endif
|
||||
|
||||
void VimWidget::flash()//{{{
|
||||
void
|
||||
VimWidget::flash()//{{{
|
||||
{
|
||||
QPainter p(this);
|
||||
|
||||
@ -963,7 +1148,8 @@ void VimWidget::flash()//{{{
|
||||
QObject::connect(finddlg, SIGNAL(search()), this, SLOT(slotSearch()));
|
||||
QObject::connect(repldlg, SIGNAL(find()), this, SLOT(slotFind()));
|
||||
QObject::connect(repldlg, SIGNAL(replace()), this, SLOT(slotReplace()));
|
||||
QObject::connect( repldlg, SIGNAL(replaceAll()), this, SLOT(slotReplaceAll()) );
|
||||
QObject::connect(repldlg, SIGNAL(replaceAll()), this,
|
||||
SLOT(slotReplaceAll()));
|
||||
|
||||
#ifdef FEAT_TOOLBAR
|
||||
connect(toolBar(), SIGNAL(clicked(int)), this, SLOT(menu_activated(int)));
|
||||
@ -972,9 +1158,11 @@ void VimWidget::flash()//{{{
|
||||
w->serverActivate(winId());
|
||||
|
||||
if (serverName != NULL)
|
||||
kapp->dcopClient()->registerAs(QCString((const char*)serverName),false);
|
||||
kapp->dcopClient()->registerAs(QCString((const char*)serverName),
|
||||
false);
|
||||
else if (serverDelayedStartName != NULL)
|
||||
kapp->dcopClient()->registerAs(QCString((const char*)serverDelayedStartName),false);
|
||||
kapp->dcopClient()->registerAs(
|
||||
QCString((const char*)serverDelayedStartName), false);
|
||||
else if (argServerName != NULL)
|
||||
kapp->dcopClient()->registerAs(argServerName->utf8(), false);
|
||||
#else
|
||||
@ -985,37 +1173,43 @@ void VimWidget::flash()//{{{
|
||||
|
||||
}//{{{
|
||||
|
||||
bool VimMainWindow::queryClose()//{{{
|
||||
bool
|
||||
VimMainWindow::queryClose()//{{{
|
||||
{
|
||||
gui_shell_closed();
|
||||
return true;
|
||||
}//}}}
|
||||
|
||||
bool VimMainWindow::queryExit()//{{{
|
||||
bool
|
||||
VimMainWindow::queryExit()//{{{
|
||||
{
|
||||
return true;
|
||||
}//}}}
|
||||
|
||||
void VimMainWindow::menu_activated(int dx)//{{{
|
||||
void
|
||||
VimMainWindow::menu_activated(int dx)//{{{
|
||||
{
|
||||
#ifdef FEAT_MENU
|
||||
if (!dx) { // tearoff
|
||||
if (!dx) // tearoff
|
||||
return;
|
||||
}
|
||||
gui_mch_set_foreground();
|
||||
gui_menu_cb((VimMenu *)dx);
|
||||
#endif
|
||||
}//}}}
|
||||
|
||||
|
||||
void VimMainWindow::clipboard_selection_update(){//{{{
|
||||
void
|
||||
VimMainWindow::clipboard_selection_update()//{{{
|
||||
{
|
||||
if (kapp->clipboard()->ownsSelection())
|
||||
clip_own_selection(&clip_star);
|
||||
else
|
||||
clip_lose_selection(&clip_star);
|
||||
}//}}}
|
||||
|
||||
void VimMainWindow::clipboard_data_update(){//{{{
|
||||
void
|
||||
VimMainWindow::clipboard_data_update()//{{{
|
||||
{
|
||||
#if QT_VERSION>=300
|
||||
if (kapp->clipboard()->ownsClipboard())
|
||||
clip_own_selection(&clip_plus);
|
||||
@ -1029,7 +1223,8 @@ void VimMainWindow::clipboard_data_update(){//{{{
|
||||
#endif
|
||||
}//}}}
|
||||
|
||||
void VimMainWindow::slotSearch()//{{{
|
||||
void
|
||||
VimMainWindow::slotSearch()//{{{
|
||||
{
|
||||
QString find_text;
|
||||
bool direction_down = TRUE;
|
||||
@ -1041,12 +1236,15 @@ void VimMainWindow::slotSearch()//{{{
|
||||
casesensitive = finddlg->case_sensitive();
|
||||
// if (casesensitive) find_text = "\\C" + find_text;
|
||||
// else find_text = "\\c" + find_text;
|
||||
if (casesensitive) flags|=FRD_MATCH_CASE;
|
||||
if (casesensitive)
|
||||
flags |= FRD_MATCH_CASE;
|
||||
QCString unistring = vmw->codec->fromUnicode(find_text);
|
||||
gui_do_findrepl(flags, (char_u *)(const char *)unistring, NULL,(int)direction_down);
|
||||
gui_do_findrepl(flags, (char_u *)(const char *)unistring, NULL,
|
||||
(int)direction_down);
|
||||
}//}}}
|
||||
|
||||
void VimMainWindow::slotFind()//{{{
|
||||
void
|
||||
VimMainWindow::slotFind()//{{{
|
||||
{
|
||||
QString find_text;
|
||||
bool direction_down = TRUE;
|
||||
@ -1061,10 +1259,12 @@ void VimMainWindow::slotFind()//{{{
|
||||
if (casesensitive) flags |= FRD_MATCH_CASE;
|
||||
|
||||
QCString unistring = vmw->codec->fromUnicode(find_text);
|
||||
gui_do_findrepl(flags, (char_u *)(const char *)unistring, NULL,(int)direction_down);
|
||||
gui_do_findrepl(flags, (char_u *)(const char *)unistring, NULL,
|
||||
(int)direction_down);
|
||||
}//}}}
|
||||
|
||||
void VimMainWindow::slotReplace()//{{{
|
||||
void
|
||||
VimMainWindow::slotReplace()//{{{
|
||||
{
|
||||
QString find_text;
|
||||
QString repl_text;
|
||||
@ -1081,10 +1281,12 @@ void VimMainWindow::slotReplace()//{{{
|
||||
|
||||
QCString unistring = vmw->codec->fromUnicode(find_text);
|
||||
QCString unistring2 = vmw->codec->fromUnicode(repl_text);
|
||||
gui_do_findrepl(flags, (char_u *)(const char *)unistring,(char_u *)(const char*)unistring2,(int)direction_down);
|
||||
gui_do_findrepl(flags, (char_u *)(const char *)unistring,
|
||||
(char_u *)(const char*)unistring2, (int)direction_down);
|
||||
}//}}}
|
||||
|
||||
void VimMainWindow::slotReplaceAll()//{{{
|
||||
void
|
||||
VimMainWindow::slotReplaceAll()//{{{
|
||||
{
|
||||
QString find_text;
|
||||
QString repl_text;
|
||||
@ -1098,19 +1300,23 @@ void VimMainWindow::slotReplaceAll()//{{{
|
||||
casesensitive = repldlg->case_sensitive();
|
||||
// if (casesensitive) find_text = "\\C" + find_text;
|
||||
// else find_text = "\\c" + find_text;
|
||||
if (casesensitive) flags|=FRD_MATCH_CASE;
|
||||
if (casesensitive)
|
||||
flags |= FRD_MATCH_CASE;
|
||||
QCString unistring = vmw->codec->fromUnicode(find_text);
|
||||
QCString unistring2 = vmw->codec->fromUnicode(repl_text);
|
||||
gui_do_findrepl(flags, (char_u *)(const char *)unistring,(char_u *)(const char*)unistring2,(int)direction_down);
|
||||
gui_do_findrepl(flags, (char_u *)(const char *)unistring,
|
||||
(char_u *)(const char*)unistring2, (int)direction_down);
|
||||
}//}}}
|
||||
|
||||
void VimMainWindow::showAboutKDE()
|
||||
void
|
||||
VimMainWindow::showAboutKDE()
|
||||
{
|
||||
KAboutKDE *kde = new KAboutKDE(this);
|
||||
kde->show();
|
||||
}
|
||||
|
||||
void VimMainWindow::showAboutApplication()//{{{
|
||||
void
|
||||
VimMainWindow::showAboutApplication()//{{{
|
||||
{
|
||||
KAboutData *aboutData = new KAboutData(
|
||||
"kvim"
|
||||
@ -1173,23 +1379,27 @@ Or read the file $VIMRUNTIME/doc/uganda.txt.");
|
||||
about->show();
|
||||
}//}}}
|
||||
|
||||
void VimMainWindow::showTipOfTheDay()
|
||||
void
|
||||
VimMainWindow::showTipOfTheDay()
|
||||
{
|
||||
#if QT_VERSION>=300
|
||||
KTipDialog::showTip(vmw, QString::null, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void VimMainWindow::buffersToolbar()
|
||||
void
|
||||
VimMainWindow::buffersToolbar()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void VimMainWindow::showBugReport()
|
||||
void
|
||||
VimMainWindow::showBugReport()
|
||||
{
|
||||
KBugReport *bug= new KBugReport(this, true);
|
||||
bug->show();
|
||||
}
|
||||
|
||||
/*
|
||||
* Vim Dialog
|
||||
*
|
||||
@ -1235,10 +1445,10 @@ VimDialog::VimDialog (int type, /* type of dialog *///{{{
|
||||
icon->setPixmap(QPixmap((const char **) icon_data));
|
||||
icon->setFixedSize(icon->sizeHint());
|
||||
|
||||
QLabel * text = new QLabel( (const char *)message, this );
|
||||
QLabel * text = new QLabel(QSTR(message), this);
|
||||
text->setAlignment(AlignHCenter | AlignVCenter | ExpandTabs);
|
||||
|
||||
QStringList buttonText = QStringList::split( DLG_BUTTON_SEP, (char *) buttons);
|
||||
QStringList buttonText = QStringList::split(DLG_BUTTON_SEP, QSTR(buttons));
|
||||
int butNb = buttonText.count();
|
||||
|
||||
/*
|
||||
@ -1252,8 +1462,8 @@ VimDialog::VimDialog (int type, /* type of dialog *///{{{
|
||||
QHBoxLayout * hly3 = new QHBoxLayout(vly , 5);
|
||||
if (textfield != NULL)
|
||||
{
|
||||
entry = new QLineEdit((const char *)textfield,this);
|
||||
entry->setText((const char *)textfield);
|
||||
entry = new QLineEdit(QSTR(textfield), this);
|
||||
entry->setText(QSTR(textfield));
|
||||
hly3->addWidget(entry);
|
||||
ret = textfield;
|
||||
}
|
||||
@ -1282,12 +1492,13 @@ VimDialog::VimDialog (int type, /* type of dialog *///{{{
|
||||
}
|
||||
connect(&mapper, SIGNAL(mapped(int)), this, SLOT(done(int)));
|
||||
|
||||
setCaption((const char *) title);
|
||||
setCaption(QSTR(title));
|
||||
|
||||
vly->activate();
|
||||
}//}}}
|
||||
|
||||
void VimDialog::done(int r)
|
||||
void
|
||||
VimDialog::done(int r)
|
||||
{
|
||||
if (entry != NULL)
|
||||
{
|
||||
@ -1312,7 +1523,8 @@ SBPool::SBPool(void)//{{{
|
||||
}//}}}
|
||||
|
||||
|
||||
void SBPool::create(GuiScrollbar * sb, int orient)//{{{
|
||||
void
|
||||
SBPool::create(GuiScrollbar * sb, int orient)//{{{
|
||||
{
|
||||
switch(orient)
|
||||
{
|
||||
@ -1332,23 +1544,27 @@ void SBPool::create(GuiScrollbar * sb, int orient)//{{{
|
||||
}//}}}
|
||||
|
||||
|
||||
void SBPool::sbUsed(int who)//{{{
|
||||
void
|
||||
SBPool::sbUsed(int who)//{{{
|
||||
{
|
||||
GuiScrollbar *sb = (GuiScrollbar*)who;
|
||||
gui_drag_scrollbar(sb, sb->w->value(), FALSE);
|
||||
}//}}}
|
||||
|
||||
|
||||
void SBPool::destroy(GuiScrollbar * sb)//{{{
|
||||
void
|
||||
SBPool::destroy(GuiScrollbar *sb)//{{{
|
||||
{
|
||||
if (!sb->w) return;
|
||||
if (!sb->w)
|
||||
return;
|
||||
|
||||
delete sb->w;
|
||||
sb->w = 0;
|
||||
}//}}}
|
||||
|
||||
#ifdef FEAT_CLIENTSERVER
|
||||
static int kvim_x11_event_filter( XEvent* e)//{{{
|
||||
static int
|
||||
kvim_x11_event_filter(XEvent* e)//{{{
|
||||
{
|
||||
if (e->xproperty.type == PropertyNotify
|
||||
&& e->xproperty.atom == commProperty
|
||||
@ -1356,14 +1572,16 @@ static int kvim_x11_event_filter( XEvent* e)//{{{
|
||||
&& e->xproperty.state == PropertyNewValue)
|
||||
serverEventProc(qt_xdisplay(), e);
|
||||
|
||||
if (oldFilter) return oldFilter( e );
|
||||
if (oldFilter)
|
||||
return oldFilter( e );
|
||||
return FALSE;
|
||||
}//}}}
|
||||
#endif
|
||||
|
||||
//add some QT 3 fonts usefull functions
|
||||
#if QT_VERSION<300
|
||||
QString KVimUtils::toString(QFont *f)
|
||||
QString
|
||||
KVimUtils::toString(QFont *f)
|
||||
{
|
||||
QStringList l;
|
||||
l.append(f->family());
|
||||
@ -1379,7 +1597,8 @@ QString KVimUtils::toString(QFont *f)
|
||||
return l.join(",");
|
||||
}
|
||||
|
||||
bool KVimUtils::fromString(QFont *f, QString descrip)
|
||||
bool
|
||||
KVimUtils::fromString(QFont *f, QString descrip)
|
||||
{
|
||||
QStringList l(QStringList::split(',', descrip));
|
||||
|
||||
@ -1414,9 +1633,12 @@ bool KVimUtils::fromString(QFont *f, QString descrip)
|
||||
}
|
||||
#endif
|
||||
|
||||
QString KVimUtils::convertEncodingName(QString name)
|
||||
QString
|
||||
KVimUtils::convertEncodingName(QString name)
|
||||
{
|
||||
if (name.startsWith("ucs") || name.startsWith("utf-16")) return QString("utf16");
|
||||
if (name=="cp950") return QString("Big5");
|
||||
if (name.startsWith("ucs") || name.startsWith("utf-16"))
|
||||
return QString("utf16");
|
||||
if (name == "cp950")
|
||||
return QString("Big5");
|
||||
return QString();
|
||||
}
|
||||
|
@ -68,7 +68,8 @@ class QLineEdit;
|
||||
class QSignalMapper;
|
||||
class QPaintEvent;
|
||||
|
||||
enum BlinkState {
|
||||
enum BlinkState
|
||||
{
|
||||
BLINK_NONE,
|
||||
BLINK_ON,
|
||||
BLINK_OFF
|
||||
@ -108,6 +109,10 @@ public:
|
||||
BlinkState blink_state;
|
||||
QPainter *painter;
|
||||
QPopupMenu *menu;
|
||||
virtual void setMicroFocusHint(int x, int y, int w, int h, bool text=TRUE, QFont *f = 0)
|
||||
{
|
||||
QWidget::setMicroFocusHint(x, y, w, h, text, f);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void keyPressEvent(QKeyEvent *);
|
||||
@ -229,7 +234,8 @@ private:
|
||||
QSignalMapper mapper;
|
||||
};
|
||||
|
||||
class KVimUtils {
|
||||
class KVimUtils
|
||||
{
|
||||
public:
|
||||
static QString convertEncodingName(QString);
|
||||
#if QT_VERSION<300
|
||||
@ -242,4 +248,11 @@ extern VimMainWindow *vmw;
|
||||
extern SBPool *sbpool;
|
||||
extern QString *argServerName;
|
||||
|
||||
#define QSTR(x) \
|
||||
(has_mbyte ? \
|
||||
(enc_utf8 ? \
|
||||
QString::fromUtf8((const char *)x) : \
|
||||
QString::fromLocal8Bit((const char *)x)) : \
|
||||
QString((const char *)x))
|
||||
|
||||
#endif // GUI_KDE_WIDGET
|
||||
|
@ -73,7 +73,8 @@ static int last_shape = 0;
|
||||
*/
|
||||
|
||||
#if QT_VERSION>=300
|
||||
static int tip=0; // 1 no dialog, 0 use it if enabled in conf, 2 force the tip
|
||||
static int tip = 0; // 1 no dialog, 0 use it if enabled in conf,
|
||||
// 2 force the tip
|
||||
#endif
|
||||
static int reverse = 0; // 0 bg : white, 1 : bg : black
|
||||
QString *startfont;
|
||||
@ -91,6 +92,7 @@ gui_mch_prepare(int *argc, char **argv)// {{{
|
||||
{
|
||||
// copy args for KDE/Qt
|
||||
gui_argc = 0;
|
||||
|
||||
// this one is not really good as all options are not for KDE/Qt ...
|
||||
gui_argv = (char **)lalloc((long_u)(*argc * sizeof(char *)), FALSE);
|
||||
if (gui_argv == NULL)
|
||||
@ -102,10 +104,12 @@ gui_mch_prepare(int *argc, char **argv)// {{{
|
||||
{
|
||||
if (found != 2)
|
||||
found = 0;
|
||||
else {
|
||||
else
|
||||
{
|
||||
found = 0;
|
||||
// remove from the list of argv
|
||||
if (--*argc>i) {
|
||||
if (--*argc > i)
|
||||
{
|
||||
mch_memmove(&argv[i], &argv[i + 1],
|
||||
(*argc - i) * sizeof(char *));
|
||||
}
|
||||
@ -113,52 +117,62 @@ gui_mch_prepare(int *argc, char **argv)// {{{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(argv[i],"--servername")==0) {
|
||||
if (strcmp(argv[i], "--servername") == 0)
|
||||
{
|
||||
argServerName = new QString(argv[i+1]); // to get the serverName now
|
||||
}
|
||||
#if QT_VERSION>+300
|
||||
if (strcmp(argv[i],"-tip")==0 ) {
|
||||
if (strcmp(argv[i], "-tip") == 0 )
|
||||
{
|
||||
tip = 2;
|
||||
found = 1;
|
||||
}
|
||||
if (strcmp(argv[i],"-notip")==0 ) {
|
||||
if (strcmp(argv[i], "-notip") == 0 )
|
||||
{
|
||||
tip = 1;
|
||||
found = 1;
|
||||
}
|
||||
#endif
|
||||
if (strcmp(argv[i],"-black")==0 ) {
|
||||
if (strcmp(argv[i], "-black") == 0 )
|
||||
{
|
||||
reverse = 1;
|
||||
found = 1;
|
||||
}
|
||||
/* replaced by -black */
|
||||
/* if (strcmp(argv[i],"-rv")==0 ) {
|
||||
/* if (strcmp(argv[i], "-rv") == 0 )
|
||||
* {
|
||||
reverse = 1;
|
||||
found = 1;
|
||||
}*/
|
||||
if (strcmp(argv[i],"-font")==0 || strcmp(argv[i], "-fn")==0 ) {
|
||||
if (strcmp(argv[i], "-font") == 0 || strcmp(argv[i], "-fn") == 0)
|
||||
{
|
||||
startfont = new QString(argv[i+1]);
|
||||
found = 2;
|
||||
}
|
||||
if (strcmp(argv[i],"-geometry")==0 || strcmp (argv[i],"-geom")==0 ) {
|
||||
if (strcmp(argv[i], "-geometry") == 0 || strcmp(argv[i], "-geom") == 0)
|
||||
{
|
||||
found = 2;
|
||||
QString text(argv[i + 1]);
|
||||
QStringList list = QStringList::split(QChar('x'), text);
|
||||
startsize = new QSize(list[0].toInt(), list[1].toInt());
|
||||
}
|
||||
if (strcmp (argv[i],"-display")==0 ) { //XXX: this does not work,
|
||||
if (strcmp(argv[i], "-display") == 0) //XXX: this does not work,
|
||||
// too many -display options in main.c !
|
||||
// ask Bram ...
|
||||
{
|
||||
gui_argv[gui_argc++] = strdup("--display");
|
||||
gui_argv[gui_argc++] = argv[i+1];
|
||||
found = 0;
|
||||
}
|
||||
if (strcmp (argv[i],"--display")==0 ) {
|
||||
if (strcmp(argv[i], "--display") == 0 )
|
||||
{
|
||||
gui_argv[gui_argc++] = argv[i];
|
||||
gui_argv[gui_argc++] = argv[i+1];
|
||||
found = 2;
|
||||
}
|
||||
//KDE/Qt options with no args
|
||||
if (strcmp(argv[i],"--help-kde")==0 || strcmp (argv[i],"--help-qt")==0
|
||||
if (strcmp(argv[i], "--help-kde") == 0
|
||||
|| strcmp(argv[i], "--help-qt") == 0
|
||||
|| strcmp(argv[i], "--help-all") == 0
|
||||
|| strcmp(argv[i], "--reverse") == 0
|
||||
|| strcmp(argv[i], "--author") == 0
|
||||
@ -172,14 +186,15 @@ gui_mch_prepare(int *argc, char **argv)// {{{
|
||||
|| strcmp(argv[i], "--noxim") == 0
|
||||
|| strcmp(argv[i], "--nocrashhandler") == 0
|
||||
|| strcmp(argv[i], "--waitforwm") == 0
|
||||
) {
|
||||
)
|
||||
{
|
||||
gui_argv[gui_argc++] = argv[i];
|
||||
found = 1;
|
||||
}
|
||||
//this outputs KDE and Vim versions :)
|
||||
if (strcmp(argv[i], "--version") == 0
|
||||
|| strcmp (argv[i],"-v")==0
|
||||
) {
|
||||
|| strcmp(argv[i], "-v") == 0)
|
||||
{
|
||||
gui_argv[gui_argc++] = argv[i];
|
||||
}
|
||||
|
||||
@ -206,20 +221,22 @@ gui_mch_prepare(int *argc, char **argv)// {{{
|
||||
|| strcmp(argv[i], "--smkey") == 0
|
||||
|| strcmp(argv[i], "-smkey") == 0
|
||||
|| strcmp(argv[i], "-session") == 0
|
||||
) {
|
||||
)
|
||||
{
|
||||
gui_argv[gui_argc++] = argv[i];
|
||||
gui_argv[gui_argc++] = argv[i + 1];
|
||||
found = 2;
|
||||
}
|
||||
|
||||
// remove from the list of argv
|
||||
if (found >= 1 && --*argc>i) {
|
||||
mch_memmove(&argv[i], &argv[i + 1],
|
||||
(*argc - i) * sizeof(char *));
|
||||
if (found >= 1 && --*argc > i)
|
||||
{
|
||||
mch_memmove(&argv[i], &argv[i + 1], (*argc - i) * sizeof(char *));
|
||||
i--;
|
||||
}
|
||||
}
|
||||
KCmdLineArgs::init( gui_argc,gui_argv,"kvim", I18N_NOOP("Vim inside KDE"),VIM_VERSION_SHORT);
|
||||
KCmdLineArgs::init(gui_argc, gui_argv, "kvim",
|
||||
I18N_NOOP("Vim inside KDE"), VIM_VERSION_SHORT);
|
||||
}// }}}
|
||||
|
||||
/****************************************************************************
|
||||
@ -286,7 +303,8 @@ gui_mch_init_check(void)//{{{
|
||||
gui_mch_init()//{{{
|
||||
{
|
||||
(void) new KApplication();
|
||||
KApplication::kApplication()->dcopClient()->registerAs(KApplication::kApplication()->name(),false);
|
||||
KApplication::kApplication()->dcopClient()->registerAs(
|
||||
KApplication::kApplication()->name(), false);
|
||||
// dbf("%s %s", KGlobal::locale()->language().latin1(), KLocale::defaultLanguage().latin1());
|
||||
|
||||
vmw = new VimMainWindow("KVim", 0);
|
||||
@ -297,15 +315,18 @@ gui_mch_init()//{{{
|
||||
sbpool = new SBPool;
|
||||
|
||||
#if QT_VERSION>=300
|
||||
vmw->connect(kapp->clipboard(),SIGNAL(selectionChanged()),vmw,SLOT(clipboard_selection_update()));
|
||||
vmw->connect(kapp->clipboard(), SIGNAL(selectionChanged()),
|
||||
vmw, SLOT(clipboard_selection_update()));
|
||||
#endif
|
||||
vmw->connect(kapp->clipboard(),SIGNAL(dataChanged()),vmw,SLOT(clipboard_data_update()));
|
||||
vmw->connect(kapp->clipboard(), SIGNAL(dataChanged()),
|
||||
vmw, SLOT(clipboard_data_update()));
|
||||
clip_lose_selection(&clip_plus);
|
||||
clip_lose_selection(&clip_star);
|
||||
|
||||
gui.in_focus = FALSE; // will be updated
|
||||
|
||||
if (reverse) {
|
||||
if (reverse)
|
||||
{
|
||||
gui.def_norm_pixel = gui_get_color((char_u *)"White");
|
||||
gui.def_back_pixel = gui_get_color((char_u *)"Black");
|
||||
#if QT_VERSION>=300
|
||||
@ -313,7 +334,9 @@ gui_mch_init()//{{{
|
||||
#else
|
||||
gui.w->setBackgroundColor(QColor(Qt::black));
|
||||
#endif
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
gui.def_norm_pixel = gui_get_color((char_u *)"Black");
|
||||
gui.def_back_pixel = gui_get_color((char_u *)"White");
|
||||
#if QT_VERSION>=300
|
||||
@ -373,14 +396,19 @@ gui_mch_open()//{{{
|
||||
vmw->w->menu = new QPopupMenu(vmw);
|
||||
|
||||
#if QT_VERSION>=300
|
||||
vmw->w->menu->insertItem(SmallIcon("ktip"), i18n("&Tip of the day..."), vmw, SLOT(showTipOfTheDay()));
|
||||
vmw->w->menu->insertItem(SmallIcon("ktip"), i18n("&Tip of the day..."),
|
||||
vmw, SLOT(showTipOfTheDay()));
|
||||
vmw->w->menu->insertSeparator();
|
||||
#endif
|
||||
if (vmw->have_tearoff) vmw->w->menu->insertTearOffHandle(0,0);
|
||||
vmw->w->menu->insertItem(i18n("&Report Bug ..."), vmw, SLOT(showBugReport()));
|
||||
if (vmw->have_tearoff)
|
||||
vmw->w->menu->insertTearOffHandle(0, 0);
|
||||
vmw->w->menu->insertItem(i18n("&Report Bug ..."),
|
||||
vmw, SLOT(showBugReport()));
|
||||
vmw->w->menu->insertSeparator();
|
||||
vmw->w->menu->insertItem(SmallIcon("kvim"), i18n("&About KVim..."), vmw, SLOT(showAboutApplication()));
|
||||
vmw->w->menu->insertItem(SmallIcon("about_kde"), i18n("About &KDE..."), vmw, SLOT(showAboutKDE()));
|
||||
vmw->w->menu->insertItem(SmallIcon("kvim"), i18n("&About KVim..."),
|
||||
vmw, SLOT(showAboutApplication()));
|
||||
vmw->w->menu->insertItem(SmallIcon("about_kde"), i18n("About &KDE..."),
|
||||
vmw, SLOT(showAboutKDE()));
|
||||
vmw->menuBar()->insertItem("&KVim", vmw->w->menu);
|
||||
#endif
|
||||
if (startfont != NULL)
|
||||
@ -397,8 +425,10 @@ gui_mch_open()//{{{
|
||||
|
||||
vmw->show();
|
||||
#if QT_VERSION>=300
|
||||
if (tip==2) KTipDialog::showTip (vmw,QString::null,true);
|
||||
else if (tip==0) KTipDialog::showTip (vmw);
|
||||
if (tip == 2)
|
||||
KTipDialog::showTip(vmw, QString::null, true);
|
||||
else if (tip == 0)
|
||||
KTipDialog::showTip(vmw);
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
@ -449,9 +479,12 @@ gui_mch_set_shellsize(int width, int height,//{{{
|
||||
vheight = height;
|
||||
vwidth = width;
|
||||
|
||||
if (gui.which_scrollbars[SBAR_LEFT]) vwidth+=gui.scrollbar_width;
|
||||
if (gui.which_scrollbars[SBAR_RIGHT]) vwidth+=gui.scrollbar_width;
|
||||
if (gui.which_scrollbars[SBAR_BOTTOM]) vheight+=gui.scrollbar_height;
|
||||
if (gui.which_scrollbars[SBAR_LEFT])
|
||||
vwidth += gui.scrollbar_width;
|
||||
if (gui.which_scrollbars[SBAR_RIGHT])
|
||||
vwidth += gui.scrollbar_width;
|
||||
if (gui.which_scrollbars[SBAR_BOTTOM])
|
||||
vheight += gui.scrollbar_height;
|
||||
|
||||
if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled()
|
||||
#if QT_VERSION>=300
|
||||
@ -460,21 +493,22 @@ gui_mch_set_shellsize(int width, int height,//{{{
|
||||
)
|
||||
vheight += vmw->menuBar()->height();
|
||||
#ifdef FEAT_TOOLBAR
|
||||
if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
|
||||
(vmw->toolBar()->barPos()==KToolBar::Top ||
|
||||
vmw->toolBar()->barPos()==KToolBar::Bottom))
|
||||
if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled()
|
||||
&& (vmw->toolBar()->barPos() == KToolBar::Top
|
||||
|| vmw->toolBar()->barPos() == KToolBar::Bottom))
|
||||
vheight += vmw->toolBar()->height();
|
||||
|
||||
if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
|
||||
(vmw->toolBar()->barPos()==KToolBar::Left ||
|
||||
vmw->toolBar()->barPos()==KToolBar::Right))
|
||||
if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled()
|
||||
&& (vmw->toolBar()->barPos() == KToolBar::Left
|
||||
|| vmw->toolBar()->barPos() == KToolBar::Right))
|
||||
vwidth += vmw->toolBar()->width();
|
||||
#endif
|
||||
vmw->lock();
|
||||
vmw->resize(vwidth, vheight);
|
||||
gui_mch_update();
|
||||
//size should be nearly perfect, update baseSize and sizeIncrement
|
||||
vmw->setBaseSize(base_width,vmw->menuBar()->height()+1+vmw->toolBar()->height()+gui.char_height*2);
|
||||
vmw->setBaseSize(base_width, vmw->menuBar()->height() + 1
|
||||
+ vmw->toolBar()->height() + gui.char_height * 2);
|
||||
vmw->setSizeIncrement((( int )(gui.char_width / 2) * 2), gui.char_height);
|
||||
vmw->unlock();
|
||||
}//}}}
|
||||
@ -523,16 +557,17 @@ gui_mch_show_toolbar(int showit)//{{{
|
||||
* Return NULL when cancelled.
|
||||
*/
|
||||
|
||||
char_u *gui_mch_font_dialog (char_u *oldval)//{{{
|
||||
char_u *
|
||||
gui_mch_font_dialog(char_u *oldval)//{{{
|
||||
{
|
||||
QFont myFont(vmw->w->font());
|
||||
if (gui.fontname) {
|
||||
if (gui.fontname)
|
||||
gui.fontname = NULL;
|
||||
}
|
||||
|
||||
int result = KFontDialog::getFont(myFont, true);
|
||||
if ( result != KFontDialog::Accepted ) {
|
||||
if (result != KFontDialog::Accepted)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// myFont.setFixedPitch(true);
|
||||
#if QT_VERSION>=300
|
||||
QString n = myFont.toString();
|
||||
@ -569,7 +604,8 @@ gui_mch_init_font(char_u * font_name, int fontset)//{{{
|
||||
KConfigBase *base = KGlobal::config();
|
||||
#endif
|
||||
base->setGroup("General");
|
||||
if (!base->hasKey("fixed")) {
|
||||
if (!base->hasKey("fixed"))
|
||||
{
|
||||
KMessageBox::error(KApplication::kApplication()->mainWidget(),"Cannot load default fixed font\n\nConfigure fonts in KDE Control Center.\n(Just click 'Choose...', 'OK' and then 'Apply')");
|
||||
return FAIL;
|
||||
}
|
||||
@ -629,11 +665,15 @@ gui_mch_init_font(char_u * font_name, int fontset)//{{{
|
||||
gui.char_ascent = f.ascent() + p_linespace;
|
||||
|
||||
//check values, just to make sure and avoid a crash
|
||||
if (gui.char_width<=0) gui.char_width=8;
|
||||
if (gui.char_height<=0) gui.char_height=1;
|
||||
if (gui.char_width <= 0)
|
||||
gui.char_width = 8;
|
||||
if (gui.char_height <= 0)
|
||||
gui.char_height = 1;
|
||||
|
||||
hl_set_font_name(font_name);
|
||||
|
||||
vmw->w->setFont(*font);
|
||||
|
||||
return OK;
|
||||
}//}}}
|
||||
|
||||
@ -655,7 +695,8 @@ gui_mch_get_font(char_u * name, int report_error)//{{{
|
||||
KVimUtils::fromString(myFont, fontname);
|
||||
#endif
|
||||
myFont->setFixedPitch(true);
|
||||
if (!myFont->fixedPitch()) dbf("Non fixed-width font");
|
||||
if (!myFont->fixedPitch())
|
||||
dbf("Non fixed-width font");
|
||||
return (GuiFont) myFont;
|
||||
}//}}}
|
||||
|
||||
@ -664,14 +705,12 @@ gui_mch_get_font(char_u * name, int report_error)//{{{
|
||||
* Don't know how to get the actual name, thus use the provided name.
|
||||
*/
|
||||
char_u *
|
||||
gui_mch_get_fontname(font, name)
|
||||
GuiFont font;
|
||||
char_u *name;
|
||||
gui_mch_get_fontname(GuiFont font, char_u *name)//{{{
|
||||
{
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
return vim_strsave(name);
|
||||
}
|
||||
}//}}}
|
||||
|
||||
/*
|
||||
* Set the current text font.
|
||||
@ -695,23 +734,27 @@ gui_mch_free_font(GuiFont font)//{{{
|
||||
delete font; // this is a QFont , we can delete it :)
|
||||
}//}}}
|
||||
|
||||
GuiFontset gui_mch_get_fontset (char_u *name, int report_error, int fixed_width)
|
||||
GuiFontset
|
||||
gui_mch_get_fontset(char_u *name, int report_error, int fixed_width)
|
||||
{
|
||||
return (GuiFontset)gui_mch_get_font(name, report_error);
|
||||
}
|
||||
|
||||
void gui_mch_set_fontset (GuiFontset fontset)
|
||||
void
|
||||
gui_mch_set_fontset(GuiFontset fontset)
|
||||
{
|
||||
gui_mch_set_font((GuiFont)fontset);
|
||||
}
|
||||
|
||||
void gui_mch_free_fontset (GuiFontset fontset)
|
||||
void
|
||||
gui_mch_free_fontset(GuiFontset fontset)
|
||||
{
|
||||
if (fontset)
|
||||
delete fontset;
|
||||
}
|
||||
|
||||
void gui_mch_settitle (char_u *title, char_u *icon)//{{{
|
||||
void
|
||||
gui_mch_settitle(char_u *title, char_u *icon)//{{{
|
||||
{
|
||||
if (!gui.in_use) /* can't do this when GUI not running */
|
||||
return;
|
||||
@ -749,18 +792,21 @@ gui_mch_get_color(char_u * name)//{{{
|
||||
|
||||
QColor _color((const char *)name);
|
||||
|
||||
|
||||
if (_color.isValid()) {
|
||||
//return (_color.red() << 16) + ((_color.green() << 8)) + (_color.blue());
|
||||
if (_color.isValid())
|
||||
{
|
||||
// return (_color.red() << 16) + ((_color.green() << 8))
|
||||
// + (_color.blue());
|
||||
return _color.rgb();
|
||||
// return (guicolor_T) _color.pixel();
|
||||
}
|
||||
|
||||
/* add a few builtin names */
|
||||
for (i = 0;; ++i) {
|
||||
for (i = 0;; ++i)
|
||||
{
|
||||
if (vimnames[i][0] == NULL)
|
||||
return (guicolor_T)(-1);
|
||||
if (STRICMP(name, vimnames[i][0]) == 0) {
|
||||
if (STRICMP(name, vimnames[i][0]) == 0)
|
||||
{
|
||||
name = (char_u *) vimnames[i][1];
|
||||
return gui_mch_get_color(name);
|
||||
}
|
||||
@ -799,7 +845,8 @@ gui_mch_set_bg_color(guicolor_T color)//{{{
|
||||
void
|
||||
gui_mch_mousehide(int hide)//{{{
|
||||
{
|
||||
if (hide == gui.pointer_hidden) return;
|
||||
if (hide == gui.pointer_hidden)
|
||||
return;
|
||||
//#ifdef FEAT_MOUSESHAPE
|
||||
// if (!hide) mch_set_mouse_shape(last_shape);
|
||||
//#else
|
||||
@ -816,10 +863,12 @@ gui_mch_mousehide(int hide)//{{{
|
||||
gui_mch_update_codec()
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
if (!gui.in_use) return;
|
||||
if (!gui.in_use)
|
||||
return;
|
||||
vmw->codec = QTextCodec::codecForName((const char *)p_enc);
|
||||
if (vmw->codec == NULL)
|
||||
vmw->codec = QTextCodec::codecForName(KVimUtils::convertEncodingName(QString((const char*)p_enc)));
|
||||
vmw->codec = QTextCodec::codecForName(
|
||||
KVimUtils::convertEncodingName(QString((const char*)p_enc)));
|
||||
if (vmw->codec == NULL)
|
||||
vmw->codec = QTextCodec::codecForLocale();
|
||||
#else
|
||||
@ -867,8 +916,7 @@ gui_mch_flash(int msec)//{{{
|
||||
void
|
||||
gui_mch_invert_rectangle(int r, int c, int nr, int nc)//{{{
|
||||
{
|
||||
bitBlt (
|
||||
gui.w,
|
||||
bitBlt(gui.w,
|
||||
FILL_X(c), FILL_Y(r),
|
||||
gui.w,
|
||||
FILL_X(c), FILL_Y(r),
|
||||
@ -896,8 +944,8 @@ gui_mch_draw_hollow_cursor(guicolor_T color)//{{{
|
||||
QPainter p(gui.w);
|
||||
p.setPen(color);
|
||||
|
||||
p.drawRect(FILL_X(gui.col), FILL_Y(gui.row), gui.char_width - 1, gui.char_height - 1 );
|
||||
|
||||
p.drawRect(FILL_X(gui.col), FILL_Y(gui.row), gui.char_width - 1,
|
||||
gui.char_height - 1);
|
||||
p.end();
|
||||
}//}}}
|
||||
|
||||
@ -914,9 +962,9 @@ gui_mch_draw_part_cursor(int w, int h, guicolor_T color)//{{{
|
||||
FILL_X(gui.col),
|
||||
FILL_Y(gui.row) + gui.char_height - h + 1,
|
||||
w, h - 2, QColor( color, color));
|
||||
p.drawRect(FILL_X(gui.col),FILL_Y(gui.row) + gui.char_height - h + (int)p_linespace / 2,
|
||||
p.drawRect(FILL_X(gui.col), FILL_Y(gui.row) + gui.char_height - h
|
||||
+ (int)p_linespace / 2,
|
||||
w, h - (int)p_linespace);
|
||||
|
||||
}//}}}
|
||||
|
||||
|
||||
@ -946,15 +994,16 @@ gui_mch_update()//{{{
|
||||
gui_mch_wait_for_chars(long wtime)//{{{
|
||||
{
|
||||
// malte@kde.org's gift to KVim ;), thanks to him :) for this hard to find bug
|
||||
if (wtime>0) {
|
||||
if (wtime > 0)
|
||||
{
|
||||
gui.w->wait(wtime);
|
||||
while (vim_is_input_buf_empty() && !gui.w->wait_done)
|
||||
kapp->processOneEvent();
|
||||
return vim_is_input_buf_empty() ? FAIL : OK;
|
||||
} else
|
||||
while (vim_is_input_buf_empty() ) {
|
||||
kapp->processOneEvent();
|
||||
}
|
||||
else
|
||||
while (vim_is_input_buf_empty())
|
||||
kapp->processOneEvent();
|
||||
|
||||
return OK;
|
||||
}//}}}
|
||||
@ -1001,31 +1050,36 @@ gui_mch_delete_lines(int row, int num_lines)//{{{
|
||||
if (num_lines <= 0)
|
||||
return;
|
||||
|
||||
if (row + num_lines > gui.scroll_region_bot) {
|
||||
if (row + num_lines > gui.scroll_region_bot)
|
||||
{
|
||||
/* Scrolled out of region, just blank the lines out */
|
||||
gui_clear_block(row, gui.scroll_region_left, gui.scroll_region_bot, gui.scroll_region_right);
|
||||
} else {
|
||||
bitBlt (
|
||||
gui.w,
|
||||
gui_clear_block(row, gui.scroll_region_left, gui.scroll_region_bot,
|
||||
gui.scroll_region_right);
|
||||
}
|
||||
else
|
||||
{
|
||||
bitBlt(gui.w,
|
||||
FILL_X(gui.scroll_region_left), FILL_Y(row),
|
||||
gui.w,
|
||||
FILL_X(gui.scroll_region_left), FILL_Y(row + num_lines),
|
||||
gui.char_width * (gui.scroll_region_right -gui.scroll_region_left + 1) + 1,
|
||||
gui.char_width * (gui.scroll_region_right
|
||||
- gui.scroll_region_left + 1) + 1,
|
||||
gui.char_height * (gui.scroll_region_bot - row - num_lines + 1),
|
||||
Qt::CopyROP, // raster Operation
|
||||
true); // ignoreMask
|
||||
|
||||
/* Update gui.cursor_row if the cursor scrolled or copied over */
|
||||
if (gui.cursor_row >= row) {
|
||||
if (gui.cursor_row >= row)
|
||||
{
|
||||
if (gui.cursor_row < row + num_lines)
|
||||
gui.cursor_is_valid = FALSE;
|
||||
else if (gui.cursor_row <= gui.scroll_region_bot)
|
||||
gui.cursor_row -= num_lines;
|
||||
}
|
||||
|
||||
gui_clear_block(gui.scroll_region_bot - num_lines + 1, gui.scroll_region_left,
|
||||
gui_clear_block(gui.scroll_region_bot - num_lines + 1,
|
||||
gui.scroll_region_left,
|
||||
gui.scroll_region_bot, gui.scroll_region_right);
|
||||
|
||||
}
|
||||
}//}}}
|
||||
|
||||
@ -1039,29 +1093,35 @@ gui_mch_insert_lines(int row, int num_lines)//{{{
|
||||
if (num_lines <= 0)
|
||||
return;
|
||||
|
||||
if (row + num_lines > gui.scroll_region_bot) {
|
||||
if (row + num_lines > gui.scroll_region_bot)
|
||||
{
|
||||
/* Scrolled out of region, just blank the lines out */
|
||||
gui_clear_block(row, gui.scroll_region_left, gui.scroll_region_bot, gui.scroll_region_right - 1);
|
||||
} else {
|
||||
bitBlt (
|
||||
gui.w,
|
||||
gui_clear_block(row, gui.scroll_region_left, gui.scroll_region_bot,
|
||||
gui.scroll_region_right - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
bitBlt(gui.w,
|
||||
FILL_X(gui.scroll_region_left), FILL_Y(row + num_lines),
|
||||
gui.w,
|
||||
FILL_X(gui.scroll_region_left), FILL_Y(row),
|
||||
gui.char_width * ( gui.scroll_region_right - gui.scroll_region_left + 1 ) + 1,
|
||||
gui.char_width * ( gui.scroll_region_right
|
||||
- gui.scroll_region_left + 1 ) + 1,
|
||||
gui.char_height * (gui.scroll_region_bot - row - num_lines + 1),
|
||||
Qt::CopyROP, // raster Operation
|
||||
true); // ignoreMask
|
||||
|
||||
/* Update gui.cursor_row if the cursor scrolled or copied over */
|
||||
if (gui.cursor_row >= gui.row) {
|
||||
if (gui.cursor_row >= gui.row)
|
||||
{
|
||||
if (gui.cursor_row <= gui.scroll_region_bot - num_lines)
|
||||
gui.cursor_row += num_lines;
|
||||
else if (gui.cursor_row <= gui.scroll_region_bot)
|
||||
gui.cursor_is_valid = FALSE;
|
||||
}
|
||||
|
||||
gui_clear_block(row, gui.scroll_region_left, row + num_lines - 1, gui.scroll_region_right);
|
||||
gui_clear_block(row, gui.scroll_region_left, row + num_lines - 1,
|
||||
gui.scroll_region_right);
|
||||
}
|
||||
}//}}}
|
||||
|
||||
@ -1072,14 +1132,17 @@ gui_mch_insert_lines(int row, int num_lines)//{{{
|
||||
clip_mch_request_selection(VimClipboard *cbd)//{{{
|
||||
{
|
||||
#if QT_VERSION>=300
|
||||
if (cbd==&clip_star) kapp->clipboard()->setSelectionMode(true);
|
||||
if (cbd == &clip_star)
|
||||
kapp->clipboard()->setSelectionMode(true);
|
||||
#endif
|
||||
QString selection = kapp->clipboard()->text();
|
||||
|
||||
QCString unistring = vmw->codec->fromUnicode(selection);
|
||||
clip_yank_selection(MCHAR,(char_u *)(const char*)unistring,(long) unistring.length(),cbd);
|
||||
clip_yank_selection(MCHAR, (char_u *)(const char*)unistring,
|
||||
(long)unistring.length(), cbd);
|
||||
#if QT_VERSION>=300
|
||||
if (cbd==&clip_star) kapp->clipboard()->setSelectionMode(false);
|
||||
if (cbd == &clip_star)
|
||||
kapp->clipboard()->setSelectionMode(false);
|
||||
#endif
|
||||
}//}}}
|
||||
|
||||
@ -1098,7 +1161,8 @@ clip_mch_own_selection(VimClipboard *cbd)//{{{
|
||||
{
|
||||
if (kapp->clipboard()->ownsSelection())
|
||||
return OK;
|
||||
else {
|
||||
else
|
||||
{
|
||||
#if QT_VERSION>=300
|
||||
kapp->clipboard()->setSelectionMode(true);
|
||||
#endif
|
||||
@ -1110,12 +1174,14 @@ clip_mch_own_selection(VimClipboard *cbd)//{{{
|
||||
* Send the current selection to the clipboard.
|
||||
*/
|
||||
void
|
||||
clip_mch_set_selection(VimClipboard *cbd){//{{{
|
||||
clip_mch_set_selection(VimClipboard *cbd)//{{{
|
||||
{
|
||||
char_u *data;
|
||||
long_u length;
|
||||
|
||||
clip_get_selection(cbd);
|
||||
if (clip_convert_selection(&data,&length,cbd)<0) return;
|
||||
if (clip_convert_selection(&data, &length, cbd) < 0)
|
||||
return;
|
||||
|
||||
QString selection((const char *)data);
|
||||
// We must turncate the string because it is not
|
||||
@ -1123,7 +1189,8 @@ clip_mch_set_selection(VimClipboard *cbd){//{{{
|
||||
selection.truncate((uint) length);
|
||||
|
||||
#if QT_VERSION>=300
|
||||
if (cbd==&clip_star) kapp->clipboard()->setSelectionMode(true);
|
||||
if (cbd == &clip_star)
|
||||
kapp->clipboard()->setSelectionMode(true);
|
||||
#endif
|
||||
kapp->clipboard()->setText(selection);
|
||||
#if QT_VERSION>=300
|
||||
@ -1139,7 +1206,8 @@ clip_mch_set_selection(VimClipboard *cbd){//{{{
|
||||
void
|
||||
gui_mch_menu_grey(vimmenu_T * menu, int grey)//{{{
|
||||
{
|
||||
if ( !menu || !menu->parent || !menu->parent->widget ) return;
|
||||
if (!menu || !menu->parent || !menu->parent->widget)
|
||||
return;
|
||||
menu->parent->widget->setItemEnabled((int)menu, !grey);
|
||||
gui_mch_update();
|
||||
}//}}}
|
||||
@ -1151,7 +1219,8 @@ gui_mch_menu_grey(vimmenu_T * menu, int grey)//{{{
|
||||
gui_mch_menu_hidden(vimmenu_T * menu, int hidden)//{{{
|
||||
{
|
||||
// FIXME: cannot be fixed AFAIK
|
||||
gui_mch_menu_grey(menu,hidden); // it's hard to remove an item in a QPopupMenu
|
||||
// it's hard to remove an item in a QPopupMenu
|
||||
gui_mch_menu_grey(menu, hidden);
|
||||
}//}}}
|
||||
|
||||
/*
|
||||
@ -1170,15 +1239,19 @@ gui_mch_draw_menubar()//{{{
|
||||
void
|
||||
gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)//{{{
|
||||
{
|
||||
if (!sb->w) return;
|
||||
if (!sb->w)
|
||||
return;
|
||||
int width = gui.w->width();
|
||||
int height = gui.w->height();
|
||||
int neww = vmw->width();
|
||||
int newh = vmw->height();
|
||||
|
||||
if (gui.which_scrollbars[SBAR_LEFT]) width += gui.scrollbar_width;
|
||||
if (gui.which_scrollbars[SBAR_RIGHT]) width += gui.scrollbar_width;
|
||||
if (gui.which_scrollbars[SBAR_BOTTOM]) height += gui.scrollbar_height;
|
||||
if (gui.which_scrollbars[SBAR_LEFT])
|
||||
width += gui.scrollbar_width;
|
||||
if (gui.which_scrollbars[SBAR_RIGHT])
|
||||
width += gui.scrollbar_width;
|
||||
if (gui.which_scrollbars[SBAR_BOTTOM])
|
||||
height += gui.scrollbar_height;
|
||||
|
||||
if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled()
|
||||
#if QT_VERSION>=300
|
||||
@ -1187,17 +1260,18 @@ gui_mch_enable_scrollbar(scrollbar_T * sb, int flag)//{{{
|
||||
)
|
||||
height += vmw->menuBar()->height();
|
||||
#ifdef FEAT_TOOLBAR
|
||||
if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
|
||||
(vmw->toolBar()->barPos()==KToolBar::Top ||
|
||||
vmw->toolBar()->barPos()==KToolBar::Bottom))
|
||||
if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled()
|
||||
&& (vmw->toolBar()->barPos() == KToolBar::Top
|
||||
|| vmw->toolBar()->barPos() == KToolBar::Bottom))
|
||||
height += vmw->toolBar()->height();
|
||||
|
||||
if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
|
||||
(vmw->toolBar()->barPos()==KToolBar::Left ||
|
||||
vmw->toolBar()->barPos()==KToolBar::Right))
|
||||
if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled()
|
||||
&& (vmw->toolBar()->barPos() == KToolBar::Left
|
||||
|| vmw->toolBar()->barPos() == KToolBar::Right))
|
||||
width += vmw->toolBar()->width();
|
||||
#endif
|
||||
if ( abs(vmw->width() - width)>5 && (sb->type==SBAR_LEFT || sb->type==SBAR_RIGHT) )
|
||||
if (abs(vmw->width() - width) > 5
|
||||
&& (sb->type == SBAR_LEFT || sb->type == SBAR_RIGHT))
|
||||
neww = width;
|
||||
if (abs(vmw->height() - height) > 5 && (sb->type == SBAR_BOTTOM))
|
||||
newh = height;
|
||||
@ -1221,7 +1295,9 @@ gui_mch_get_rgb(guicolor_T pixel)//{{{
|
||||
{
|
||||
// QColor c(pixel, pixel);
|
||||
// return (c.red() << 16) + ((c.green() << 8)) + (c.blue());
|
||||
return pixel; // funny no ? it looks like with Qt we can always use directly the rgb value (i hope i don't break colors again ;p)
|
||||
return pixel;
|
||||
// funny no ? it looks like with Qt we can always use directly the rgb
|
||||
// value (i hope i don't break colors again ;p)
|
||||
}//}}}
|
||||
|
||||
/*
|
||||
@ -1338,6 +1414,3 @@ gui_mch_set_foreground ()//{{{
|
||||
{
|
||||
KWin::setActiveWindow(vmw->winId());
|
||||
}//}}}
|
||||
|
||||
|
||||
|
||||
|
10
src/mbyte.c
10
src/mbyte.c
@ -4341,6 +4341,7 @@ xim_set_focus(focus)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef FEAT_GUI_KDE
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
im_set_position(row, col)
|
||||
@ -4349,6 +4350,7 @@ im_set_position(row, col)
|
||||
{
|
||||
xim_set_preedit();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set the XIM to the current cursor position.
|
||||
@ -4642,7 +4644,7 @@ xim_set_status_area()
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK)
|
||||
#if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE)
|
||||
static char e_xim[] = N_("E285: Failed to create input context");
|
||||
#endif
|
||||
|
||||
@ -5414,7 +5416,7 @@ xim_get_status_area_height()
|
||||
if (xim_input_style & (int)GDK_IM_STATUS_AREA)
|
||||
return gui.char_height;
|
||||
#elif defined FEAT_GUI_KDE
|
||||
#warning FIXME
|
||||
/* always return zero? */
|
||||
#else
|
||||
if (status_area_enabled)
|
||||
return gui.char_height;
|
||||
@ -5434,6 +5436,10 @@ im_get_status()
|
||||
# ifdef FEAT_GUI_GTK
|
||||
if (xim_input_style & (int)GDK_IM_PREEDIT_CALLBACKS)
|
||||
return xim_can_preediting;
|
||||
# endif
|
||||
# ifdef FEAT_GUI_KDE
|
||||
if (preedit_start_col != MAXCOL)
|
||||
return TRUE;
|
||||
# endif
|
||||
return xim_has_focus;
|
||||
}
|
||||
|
@ -1320,14 +1320,13 @@ x_error_handler(dpy, error_event)
|
||||
Display *dpy;
|
||||
XErrorEvent *error_event;
|
||||
{
|
||||
/* KDE sometimes produces X error that we want to ignore */
|
||||
#if defined(FEAT_GUI_KDE)
|
||||
XGetErrorText(dpy, error_event->error_code, (char *)IObuff, IOSIZE);
|
||||
STRCAT(IObuff, "\nVim: Got X error but we continue...\n");
|
||||
fprintf(stderr, IObuff);
|
||||
#if defined(FEAT_GUI_KDE)
|
||||
/* KDE sometimes produces X error that we want to ignore */
|
||||
STRCAT(IObuff, _("\nVim: Got X error but we continue...\n"));
|
||||
mch_errmsg((char *)IObuff);
|
||||
return 0;
|
||||
#else
|
||||
XGetErrorText(dpy, error_event->error_code, (char *)IObuff, IOSIZE);
|
||||
STRCAT(IObuff, _("\nVim: Got X error\n"));
|
||||
|
||||
/* We cannot print a message and continue, because no X calls are allowed
|
||||
|
@ -14,6 +14,7 @@ buf_T *buflist_new __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum, int fl
|
||||
void free_buf_options __ARGS((buf_T *buf, int free_p_ff));
|
||||
int buflist_getfile __ARGS((int n, linenr_T lnum, int options, int forceit));
|
||||
void buflist_getfpos __ARGS((void));
|
||||
buf_T *buflist_findname_exp __ARGS((char_u *fname));
|
||||
buf_T *buflist_findname __ARGS((char_u *ffname));
|
||||
int buflist_findpat __ARGS((char_u *pattern, char_u *pattern_end, int unlisted, int diffmode));
|
||||
int ExpandBufnames __ARGS((char_u *pat, int *num_file, char_u ***file, int options));
|
||||
@ -24,7 +25,7 @@ pos_T *buflist_findfpos __ARGS((buf_T *buf));
|
||||
linenr_T buflist_findlnum __ARGS((buf_T *buf));
|
||||
void buflist_list __ARGS((exarg_T *eap));
|
||||
int buflist_name_nr __ARGS((int fnum, char_u **fname, linenr_T *lnum));
|
||||
int setfname __ARGS((buf_T *buf, char_u *ffname, char_u *sfname, int message));
|
||||
int setfname __ARGS((buf_T *buf, char_u *ffname, char_u *sfname, int exist_msg));
|
||||
void buf_set_name __ARGS((int fnum, char_u *name));
|
||||
void buf_name_changed __ARGS((buf_T *buf));
|
||||
buf_T *setaltfname __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum));
|
||||
|
@ -18,6 +18,7 @@ int gui_mch_adjust_charsize __ARGS((void));
|
||||
GuiFontset gui_mch_get_fontset __ARGS((char_u *name, int report_error, int fixed_width));
|
||||
int gui_mch_init_font __ARGS((char_u *font_name, int fontset));
|
||||
GuiFont gui_mch_get_font __ARGS((char_u *name, int report_error));
|
||||
char_u *gui_mch_get_fontname __ARGS((GuiFont font, char_u *name));
|
||||
void gui_mch_set_font __ARGS((GuiFont font));
|
||||
void gui_mch_set_fontset __ARGS((GuiFontset fontset));
|
||||
void gui_mch_free_font __ARGS((GuiFont font));
|
||||
|
205
src/quickfix.c
205
src/quickfix.c
@ -105,6 +105,9 @@ static void qf_update_buffer __ARGS((void));
|
||||
static void qf_fill_buffer __ARGS((void));
|
||||
#endif
|
||||
static char_u *get_mef_name __ARGS((void));
|
||||
static buf_T *load_dummy_buffer __ARGS((char_u *fname));
|
||||
static void wipe_dummy_buffer __ARGS((buf_T *buf));
|
||||
static void unload_dummy_buffer __ARGS((buf_T *buf));
|
||||
|
||||
/*
|
||||
* Read the errorfile "efile" into memory, line by line, building the error
|
||||
@ -2063,10 +2066,10 @@ buf_hide(buf)
|
||||
* Return TRUE when using ":vimgrep" for ":grep".
|
||||
*/
|
||||
int
|
||||
grep_internal(eap)
|
||||
exarg_T *eap;
|
||||
grep_internal(cmdidx)
|
||||
cmdidx_T cmdidx;
|
||||
{
|
||||
return ((eap->cmdidx == CMD_grep || eap->cmdidx == CMD_grepadd)
|
||||
return ((cmdidx == CMD_grep || cmdidx == CMD_grepadd)
|
||||
&& STRCMP("internal",
|
||||
*curbuf->b_p_gp == NUL ? p_gp : curbuf->b_p_gp) == 0);
|
||||
}
|
||||
@ -2083,7 +2086,7 @@ ex_make(eap)
|
||||
unsigned len;
|
||||
|
||||
/* Redirect ":grep" to ":vimgrep" if 'grepprg' is "internal". */
|
||||
if (grep_internal(eap))
|
||||
if (grep_internal(eap->cmdidx))
|
||||
{
|
||||
ex_vimgrep(eap);
|
||||
return;
|
||||
@ -2249,35 +2252,50 @@ ex_cfile(eap)
|
||||
ex_vimgrep(eap)
|
||||
exarg_T *eap;
|
||||
{
|
||||
regmatch_T regmatch;
|
||||
regmmatch_T regmatch;
|
||||
char_u *save_cpo;
|
||||
int fcount;
|
||||
char_u **fnames;
|
||||
char_u *s;
|
||||
char_u *p;
|
||||
int i;
|
||||
FILE *fd;
|
||||
int fi;
|
||||
struct qf_line *prevp = NULL;
|
||||
long lnum;
|
||||
garray_T ga;
|
||||
buf_T *buf;
|
||||
int duplicate_name = FALSE;
|
||||
int using_dummy;
|
||||
int found_match;
|
||||
int first_match = TRUE;
|
||||
|
||||
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */
|
||||
save_cpo = p_cpo;
|
||||
p_cpo = empty_option;
|
||||
|
||||
/* Get the search pattern */
|
||||
/* Get the search pattern: either white-separated or enclosed in // */
|
||||
regmatch.regprog = NULL;
|
||||
p = skip_regexp(eap->arg + 1, *eap->arg, TRUE, NULL);
|
||||
if (vim_isIDc(*eap->arg))
|
||||
{
|
||||
s = eap->arg;
|
||||
p = skiptowhite(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
s = eap->arg + 1;
|
||||
p = skip_regexp(s, *eap->arg, TRUE, NULL);
|
||||
if (*p != *eap->arg)
|
||||
{
|
||||
EMSG(_("E682: Invalid search pattern or delimiter"));
|
||||
goto theend;
|
||||
}
|
||||
}
|
||||
if (*p != NUL)
|
||||
*p++ = NUL;
|
||||
regmatch.regprog = vim_regcomp(eap->arg + 1, RE_MAGIC);
|
||||
regmatch.regprog = vim_regcomp(s, RE_MAGIC);
|
||||
if (regmatch.regprog == NULL)
|
||||
goto theend;
|
||||
regmatch.rm_ic = FALSE;
|
||||
regmatch.rmm_ic = FALSE;
|
||||
|
||||
p = skipwhite(p);
|
||||
if (*p == NUL)
|
||||
@ -2312,28 +2330,37 @@ ex_vimgrep(eap)
|
||||
|
||||
for (fi = 0; fi < fcount && !got_int; ++fi)
|
||||
{
|
||||
fd = fopen((char *)fnames[fi], "r");
|
||||
if (fd == NULL)
|
||||
buf = buflist_findname_exp(fnames[fi]);
|
||||
if (buf == NULL || buf->b_ml.ml_mfp == NULL)
|
||||
{
|
||||
/* Remember that a buffer with this name already exists. */
|
||||
duplicate_name = (buf != NULL);
|
||||
|
||||
/* Load file into a buffer, so that 'fileencoding' is detected,
|
||||
* autocommands applied, etc. */
|
||||
buf = load_dummy_buffer(fnames[fi]);
|
||||
using_dummy = TRUE;
|
||||
}
|
||||
else
|
||||
/* Use existing, loaded buffer. */
|
||||
using_dummy = FALSE;
|
||||
if (buf == NULL)
|
||||
smsg((char_u *)_("Cannot open file \"%s\""), fnames[fi]);
|
||||
else
|
||||
{
|
||||
lnum = 1;
|
||||
while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int)
|
||||
found_match = FALSE;
|
||||
for (lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum)
|
||||
{
|
||||
if (vim_regexec(®match, IObuff, (colnr_T)0))
|
||||
if (vim_regexec_multi(®match, curwin, buf, lnum,
|
||||
(colnr_T)0) > 0)
|
||||
{
|
||||
int l = STRLEN(IObuff);
|
||||
|
||||
/* remove trailing CR, LF, spaces, etc. */
|
||||
while (l > 0 && IObuff[l - 1] <= ' ')
|
||||
IObuff[--l] = NUL;
|
||||
|
||||
if (qf_add_entry(&prevp,
|
||||
NULL, /* dir */
|
||||
fnames[fi],
|
||||
IObuff,
|
||||
lnum,
|
||||
(int)(regmatch.startp[0] - IObuff) + 1,/* col */
|
||||
ml_get_buf(buf,
|
||||
regmatch.startpos[0].lnum + lnum, FALSE),
|
||||
regmatch.startpos[0].lnum + lnum,
|
||||
regmatch.startpos[0].col + 1,
|
||||
FALSE, /* virt_col */
|
||||
0, /* nr */
|
||||
0, /* type */
|
||||
@ -2343,11 +2370,34 @@ ex_vimgrep(eap)
|
||||
got_int = TRUE;
|
||||
break;
|
||||
}
|
||||
else
|
||||
found_match = TRUE;
|
||||
}
|
||||
++lnum;
|
||||
line_breakcheck();
|
||||
if (got_int)
|
||||
break;
|
||||
}
|
||||
fclose(fd);
|
||||
|
||||
if (using_dummy)
|
||||
{
|
||||
if (duplicate_name)
|
||||
/* Never keep a dummy buffer if there is another buffer
|
||||
* with the same name. */
|
||||
wipe_dummy_buffer(buf);
|
||||
else if (!buf_hide(buf))
|
||||
{
|
||||
/* When not hiding the buffer and no match was found we
|
||||
* don't need to remember the buffer, wipe it out. If
|
||||
* there was a match and it wasn't the first one: only
|
||||
* unload the buffer. */
|
||||
if (!found_match)
|
||||
wipe_dummy_buffer(buf);
|
||||
else if (!first_match)
|
||||
unload_dummy_buffer(buf);
|
||||
}
|
||||
}
|
||||
if (found_match)
|
||||
first_match = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2364,6 +2414,8 @@ ex_vimgrep(eap)
|
||||
/* Jump to first match. */
|
||||
if (qf_lists[qf_curlist].qf_count > 0)
|
||||
qf_jump(0, 0, FALSE);
|
||||
else
|
||||
EMSG2(_(e_nomatch2), s);
|
||||
|
||||
theend:
|
||||
vim_free(regmatch.regprog);
|
||||
@ -2375,6 +2427,104 @@ theend:
|
||||
free_string_option(save_cpo);
|
||||
}
|
||||
|
||||
/*
|
||||
* Load file "fname" into a dummy buffer and return the buffer pointer.
|
||||
* Returns NULL if it fails.
|
||||
* Must call unload_dummy_buffer() or wipe_dummy_buffer() later!
|
||||
*/
|
||||
static buf_T *
|
||||
load_dummy_buffer(fname)
|
||||
char_u *fname;
|
||||
{
|
||||
buf_T *newbuf;
|
||||
int failed = TRUE;
|
||||
#ifdef FEAT_AUTOCMD
|
||||
aco_save_T aco;
|
||||
#else
|
||||
buf_T *old_curbuf = curbuf;
|
||||
#endif
|
||||
|
||||
/* Allocate a buffer without putting it in the buffer list. */
|
||||
newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY);
|
||||
if (newbuf == NULL)
|
||||
return NULL;
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
/* set curwin/curbuf to buf and save a few things */
|
||||
aucmd_prepbuf(&aco, newbuf);
|
||||
#else
|
||||
curbuf = newbuf;
|
||||
curwin->w_buffer = newbuf;
|
||||
#endif
|
||||
|
||||
/* Need to set the filename for autocommands. */
|
||||
(void)setfname(curbuf, fname, NULL, FALSE);
|
||||
|
||||
if (ml_open() == OK)
|
||||
{
|
||||
/* Create swap file now to avoid the ATTENTION message. */
|
||||
check_need_swap(TRUE);
|
||||
|
||||
/* Remove the "dummy" flag, otherwise autocommands may not
|
||||
* work. */
|
||||
curbuf->b_flags &= ~BF_DUMMY;
|
||||
|
||||
if (readfile(fname, NULL,
|
||||
(linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM,
|
||||
NULL, READ_NEW | READ_DUMMY) == OK
|
||||
&& !(curbuf->b_flags & BF_NEW))
|
||||
{
|
||||
failed = FALSE;
|
||||
if (curbuf != newbuf)
|
||||
{
|
||||
/* Bloody autocommands changed the buffer! */
|
||||
if (buf_valid(newbuf))
|
||||
wipe_buffer(newbuf, FALSE);
|
||||
newbuf = curbuf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
/* restore curwin/curbuf and a few other things */
|
||||
aucmd_restbuf(&aco);
|
||||
#else
|
||||
curbuf = old_curbuf;
|
||||
curwin->w_buffer = old_curbuf;
|
||||
#endif
|
||||
|
||||
if (!buf_valid(newbuf))
|
||||
return NULL;
|
||||
if (failed)
|
||||
{
|
||||
wipe_dummy_buffer(newbuf);
|
||||
return NULL;
|
||||
}
|
||||
return newbuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wipe out the dummy buffer that load_dummy_buffer() created.
|
||||
*/
|
||||
static void
|
||||
wipe_dummy_buffer(buf)
|
||||
buf_T *buf;
|
||||
{
|
||||
if (curbuf != buf) /* safety check */
|
||||
wipe_buffer(buf, FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unload the dummy buffer that load_dummy_buffer() created.
|
||||
*/
|
||||
static void
|
||||
unload_dummy_buffer(buf)
|
||||
buf_T *buf;
|
||||
{
|
||||
if (curbuf != buf) /* safety check */
|
||||
close_buffer(NULL, buf, DOBUF_UNLOAD);
|
||||
}
|
||||
|
||||
/*
|
||||
* ":[range]cbuffer [bufnr]" command.
|
||||
*/
|
||||
@ -2487,7 +2637,8 @@ ex_helpgrep(eap)
|
||||
fnames[fi],
|
||||
IObuff,
|
||||
lnum,
|
||||
0, /* col */
|
||||
(int)(regmatch.startp[0] - IObuff)
|
||||
+ 1, /* col */
|
||||
FALSE, /* virt_col */
|
||||
0, /* nr */
|
||||
1, /* type */
|
||||
|
@ -3780,7 +3780,7 @@ win_line(wp, lnum, startrow, endrow)
|
||||
&& (search_attr == 0 || char_attr != search_attr))
|
||||
char_attr = extra_attr;
|
||||
|
||||
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_KDE))
|
||||
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
|
||||
/* XIM don't send preedit_start and preedit_end, but they send
|
||||
* preedit_changed and commit. Thus Vim can't set "im_is_active", use
|
||||
* im_is_preediting() here. */
|
||||
@ -4771,7 +4771,7 @@ status_match_len(xp, s)
|
||||
#endif
|
||||
)
|
||||
++s;
|
||||
len += ptr2cells(s++);
|
||||
len += ptr2cells(s);
|
||||
mb_ptr_adv(s);
|
||||
}
|
||||
|
||||
|
@ -36,5 +36,5 @@
|
||||
#define VIM_VERSION_NODOT "vim70aa"
|
||||
#define VIM_VERSION_SHORT "7.0aa"
|
||||
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
|
||||
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2004 Dec 24)"
|
||||
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2004 Dec 24, compiled "
|
||||
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2004 Dec 29)"
|
||||
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2004 Dec 29, compiled "
|
||||
|
@ -604,6 +604,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
|
||||
#define BF_NEW 0x10 /* file didn't exist when editing started */
|
||||
#define BF_NEW_W 0x20 /* Warned for BF_NEW and file created */
|
||||
#define BF_READERR 0x40 /* got errors while reading the file */
|
||||
#define BF_DUMMY 0x80 /* dummy buffer, only used internally */
|
||||
|
||||
/* Mask to check for flags that prevent normal writing */
|
||||
#define BF_WRITE_MASK (BF_NOTEDITED + BF_NEW + BF_READERR)
|
||||
|
Reference in New Issue
Block a user