home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume44
/
vim
/
part16
< prev
next >
Wrap
Internet Message Format
|
1994-08-18
|
70KB
From: mool@oce.nl (Bram Moolenaar)
Newsgroups: comp.sources.misc
Subject: v44i035: vim - Vi IMproved editor, v3.0, Part16/26
Date: 18 Aug 1994 14:02:52 -0500
Organization: Sterling Software
Sender: kent@sparky.sterling.com
Approved: kent@sparky.sterling.com
Message-ID: <330b8s$e5k@sparky.sterling.com>
X-Md4-Signature: 414a2bdbd016e3a0c2653cbed1d0440a
Submitted-by: mool@oce.nl (Bram Moolenaar)
Posting-number: Volume 44, Issue 35
Archive-name: vim/part16
Environment: UNIX, AMIGA, MS-DOS, Windows NT
Supersedes: vim: Volume 41, Issue 50-75
#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# Contents: vim/readme3.0 vim/src/winnt.c
# Wrapped by kent@sparky on Mon Aug 15 21:44:09 1994
PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive 16 (of 26)."'
if test -f 'vim/readme3.0' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'vim/readme3.0'\"
else
echo shar: Extracting \"'vim/readme3.0'\" \(34259 characters\)
sed "s/^X//" >'vim/readme3.0' <<'END_OF_FILE'
XThis file contains an overview of changes from Vim version 2.0 to 3.0
X
XThe changes new in version 2.x are marked with (2.x).
XSome changes from Robert Webb are marked with (Webb 2.5).
X
XBig improvements
X================
X
XAdded multiple windows and multiple buffers! See doc/windows.doc for an
Xoverview of the new and changed commands.
X
XAdded hidden buffers. 'hidden' option can be set to create a hidden buffer
Xinstead of abandoning a buffer. Added ":bnext", ":bprev", ":bNext" and
X"brewind" commands to go to other buffer. Added ":buffers" command to show all
Xbuffers. Added ":bmod" command: go to next modified buffer. Added ":bdelete"
Xcommand: delete buffer from list. (2.4)
X
XAdded a lot of commands to manipulate buffers:
X- Added commands to open a window for all arguments, all active buffers, all
X buffers: ":all", ":sall", ":unhide", ":sunhide", ":ball", ":sball". (2.5)
X- Added ":bunload" command: Unload buffer from memory. The ":bdelete" command
X does the same plus deletes the buffer from the buffer list. (2.5)
X- Arguments from command line are always put in buffer list. (2.5)
X- Added ":sbuffer", ":sbnext", ":sbNext", ":sbprevious", ":sbmodified",
X ":sbrewind", ":sblast": split window and go to specified buffer. (2.5)
X- Added ":wNext" and ":wprevious": write file and go back in argument list.
X (2.5)
X- Added ":wqall" and ":xall", write all change buffers and exit. (2.5)
X
X
XWhen all changes have been undone the buffer is not considered to be changed.
XVim can then be exit with ":q" instead of ":q!".
X
XAdded simple "more" facility to listings. Can be switched on/off with the
X'more' option.
X
XAdded Webb's code for command line completion, with "#ifdef WEBB_COMPLETE".
X(Webb 2.5)
X
X
XChanges incompatible with previous versions
X===========================================
X
XCommand lines starting with '#' are no longer considered to be comments. '#'
Xis a synonym for :number.
X
XEmbedded newline characters in command lines are considered to be the end of a
Xcommand line. To use newline characters in a command, precede it with CTRL-V
X(you have to type CTRL-V two times to get one).
X
XThe ":files" command is now the same as the ":buffers" command. The file list
Xand the buffer list have been integrated into one list. The buffer number and
Xthe file number are equal and will not change during an editing session. (2.5)
X
X":buffer" does not accept a file name but a buffer number. Use ":set hid" and
X":e file". (2.5)
X
XMade 'laststatus' a numeric option. It says when to use a status line for last
Xwindow: 0 is never, 1 if more than one window, 2 is always. (2.5)
X
XReplaced CTRL-P in insert mode by CTRL-B (for Backwards). CTRL-P can now be
Xused for keyword completion. (2.5)
X
XThe search pattern for the :tag command does not replace the search pattern
Xthat is remembered for the next search command. (Webb 2.5)
X
XUse CTRL-X instead of CTRL-S (subtract). Do not switch off xon/xoff in unix.c.
XFixes problems with CTRL-S on some terminals. (2.4)
X
XUsing >> will not shift lines that start with '#' when 'si' is set. (Webb 2.5)
X
X"\?" in expressions (match exactly one time) replaced by "\=", makes "?\?\?"
Xwork.
X
XThe commands "*" and "#" only search for whole words, using "\<ident\>". (Webb
X2.5)
X
XWhen doing a ":ta" command after CTRL-T, the tag stack is truncated, rather
Xthan keeping old tags at the top. Now repeating CTRL-T will get you back to
Xthe first ":ta" and stop there. (Webb 2.5)
X
XMade argument list global, not local to each window. ":quit" works when there
Xare more files to edit, except when there is only one window. (2.4)
X
XThe ".vim" file is not used for recovery with the "-r" argument. Use
X"Vim -s file.vim file" instead.
X
XFirst page of swap file has changed, cannot recover files from older versions.
XThe swap file can now be recognized by its start: "b0VIM 3.0", where 3.0 is
Xthe version number. (3.0)
X
X
XNew commands and functionality
X==============================
X
XAdded insert-mode keyword completion commands CTRL-P and CTRL-N inside #ifdef
XWEBB_KEYWORD_COMPL. (Webb 2.5)
X
XUpdated error messages for keyword completion in insert mode. (2.7)
X
XAdded "]f" command: Edit file whose name is under the cursor. Added CTRL-W
XCTRL-F and CTRL-W f: split window and edit file whose name is
Xunder the cursor. (Webb 2.5)
X
XChanged "]f" into "gf". Mnemonic: goto file. (2.7)
X
XPut "]f" and "[f" back in, they do the same as "gf". For people that have the
X'g' key remapped. (2.9)
X
XAdded CTRL-W CTRL-R, CTRL-W r, CTRL-W R: rotate windows upwards/downwards
X(2.5)
X
XAdded CTRL-W CTRL-X and CTRL-W x: exchange current window with next one. (Webb
X2.5)
X
XAdded window title for xterm.
X
XAdded termcap options 't_so' (standout) and 't_se' (standout end). Use 't_so'
Xand 't_se' if inversion is not possible and for highlighting directories.
XAt some places standout mode is used instead of inversion. (Webb 2.5)
X
XDo wait_return() message and the message used when asked for 'y' or 'n' is now
Xin standout mode. (Webb 2.5)
X
XAdded termcap option 't_ms' (save to move cursor in reverse mode). Makes
Xinversion work on some terminals.
X
XAdded ":mode" command. Under Amiga and Unix this only re-sets the screen
Xsize. With MSDOS it is possible to switch screen mode.
X
XNow also "%<", "#31<", alternate file name without extension.
X
XAdded ':' register. Contains last command line. "@:" repeats last command
Xline.
X
XAdded ":exit" as synonym for ":xit". More logical, isn't it?
X
XAdded ":swapname". Show swap file name for current buffer.
X
X":args" can have arguments for redefining the argument list, just like
X":next". (2.5)
X
XWhen the command for the tag is a search and it fails, try searching for the
Xtag itself with pattern "^tag(" and "^[#a-zA-Z_].*tag(". (Webb 2.5)
X
X"%" will now go to matching comment delimiters (/ *, * /) and find matches for
Xthe preprocessing lines #ifdef, #else, #elif and #endif. (Webb 2.5)
X
XUsing '%' on #if/#else/#endif makes the movement linewise. (2.7)
X
X"[p", "[P", "]p" and "]P" work like "p" and "P" but adjust the indent of the
Xputted lines to match the context. (Webb 2.5)
X
XChanged put indented: "[p" and "]p" is "]p" (put forward), "[P" and "]P" is
X"[p" (put backward). (2.7)
X
X"[(" and "[{" may be used to go to the (count'th) last unclosed ( or {.
X"])" and "]}" may be used to jump to the (count'th) next unopen) or }. Can be
Xused to jump to the start/end of the innermost c-code block (Webb 2.5)
X
XAdded count to ":", "count:" translates into ":.,.+(count - 1)". (Webb 2.5)
X
XAdded ":sleep" command. (2.4)
X
X"g" is to be used for a new series of commands. First one: "gs" sleeps for a
Xmoment (Mnemonic: Go to Sleep). Give count for that many seconds. Can be
Xinterrupted with CTRL-C. (2.5)
X
XAdded ":last" and ":slast", go to last argument. (2.5)
XAdded ":argument [N]" and ":sargument [N]", go to Nth argument. (2.5)
XAdded ":blast" and ":sblast", go to last buffer. (2.5)
X
XAdded "-o[N]" command line argument: Open N windows on startup. (2.5)
X
XAdded ":only", CTRL-W CTRL-O, CTRL-O o: Close all but current window. (2.5)
X
XAdded default digraph: <space> <char> is meta-char. (2.4)
X
XDigraphs with CTRL-H do not make meta characters. Use CTRL-K <space>
X<char>. Fixes problem with abbreviations when 'digraph' set. (2.5)
X
XDon't allow digraphs with ESC. Hitting ESC in digraph exits insert mode. (2.5)
X
XAdded ":snext", ":sNext", ":sprev" and ":srewind" commands, split window and
Xgo to next/previous file in argument list. (2.4)
X
XAdded CTRL-W CTRL-P and CTRL-W p, jump to previous window. (2.4)
X
XAdded "zz", "zt" and "zb", same as "z.", "zCR" and "z-" but without moving the
Xcursor to the start of the line. (2.4)
X
X":bdelete" and ":bunload" accept a range of buffers and a list of buffer
Xnumbers. (2.7)
X
X
XImprovements
X============
X
XCursor up/down in insert mode keep the same column. Also for "CTRL-O j" and
Xthe like.
X
XAdded column number to :file.
X
XImproved listing of ":set" command. The columns are now sorted top to bottom.
XLong string options are listed at the end (idea comes from nvi).
X
XRenamed directory "macros" to "tools". Moved doc/vim132 to tools/vim132.
X
X"ref" program added for "K" command (in the tools directory. Does simple
Xspelling check.
X
XVim arguments "-c command" and "+command" are now options that can be given
Xanywhere on the command line before the file names. Makes it possible to do
X"Vim "+set ic" -t FuncTion".
X
XImproved Usage message.
X
XAdded check for negative line numbers in colon commands.
X
XRemoved 'n' offset to search patterns. Avoiding pcmark set is now down with
Xtag_busy flag.
X
XImproved error messages for file access.
X
X":args" does not call wait_return() when message is short.
X
XWhen doing :paste twice the option values are saved only once.
X
XAccept '\n' to separate Ex commands, just like '|'.
X
XWith search also accept 'b' for begin, like 's' for start.
XWhen 'e' used the operator is inclusive.
X
XVisual shift accepts a count for number of indents.
X
XNo "hit return to continue" while filtering and only once when reading/writing
Xfiles.
X
XFor Amiga and MSDOS lines longer than 32000 characters are split when reading.
XUsed to give problems (out of memory errors).
X
XWhen ':' entered after "hit return to continue" don't redraw the screen.
X
XIn regexp: made '$' in front of '\|' also end-of-line.
X
XAdded "+command" argument to ":next", ":prev", ":rewind" and ":Next".
X
XGive better error message when "/" did not found pattern and 'wrapscan' off.
X
XAdded message "search hit BOTTOM, continuing at TOP" when search wraps. Don't
Xdisplay this message when 'terse' option is on.
X
XMade ":&" work like ":s//~/".
X
XConsider mapped characters for terminal codes, makes "map <key-code1>
X<key-code2>" work.
X
XRemember two search patterns: One for substitute and one for the rest. This is
Xhow vi works. ":global" command sets both patterns.
X
XError messages during global command are listed below each other. (2.4)
X
XDon't redisplay the "INSERT" message when getting out of insert mode.
X
XWith escape in insert mode and auto-indent the cursor is put in the correct
Xcolumn right away instead of after one second.
X
XAdded "Permission denied" message to readfile().
X
XAdded preserve command. Writes all text into the swap file.
X
XNamed marks are saved for undo, restored for redo.
X
XReduced terminal I/O by using screen_char() instead of outchar() for messages.
X
XAdded count to quickfix commands :cn and :cp. :cl and :cf can be interrupted
Xby CTRL-C.
X
XFor MSDOS ignore CTRL-Z at end of file in textmode.
X
XNo mapping for CR when waiting for "hit return to continue".
X
XUse 'ignorecase' option when searching for tag in tag file.
X
XWhen count given for undo or redo, redraw screen only once.
X
XClear message on command line when scrolling, otherwise it will stay there
Xuntil the screen is cleared. (2.5)
X
XMarks are remembered for buffers that are unloaded. (2.5)
X
XImplemented scroll regions, using "CS" termcap entry. Also works for pc
Xconsole. Does not work for Amiga. (2.5)
X
XMade searches starting with "\<" quite a bit faster, by using regmust in
Xregexp.c. (2.5)
X
XDon't output an extra line when reading a file and screen has been scrolled up
X(e.g. after CTRL-D). (2.5)
X
XAfter "dG" "''" still works (when previous context mark is deleted, use
Xprevious one). (2.5)
X
XA count can be given after an ex command for all commands that do not use a
Xline number or range, e.g. ":sleep 2" is the same as :2sleep". Do not accept a
Xcount where a file name is expected, because file names can be numbers. For
Xexample ":next 4". (2.5)
X
X"~/" is expanded to $HOME, wherever an environment variable is allowed. (2.5)
X
XWhen the start of a filename matches $HOME, it is replaced with "~/" for the
Xwindow title, status line, message from ":read", ":write", CTRL-G, ":file",
X":marks" and ":jumps". Also for string options shown with ":set" that can be a
Xfile name. (2.5)
X
XPrevious context mark for each window instead of for each buffer. (Webb 2.5)
X
XSet previous context mark only if line number changed. (Webb 2.5)
X
XMade tagstack local to each window. (Webb 2.5)
X
XIn the status line of a modified buffer "[+]" is shown. (Webb 2.5)
X
XRemember cursor position in tag stack for :tag command without argument. (Webb
X2.5)
X
XWhen backwards range given for ":" command, ask for confirmation to swap it
Xand continue. (Webb 2.5)
X
XAfter CTRL-T set curswant, so we stay in that column when moving up/down.
X(Webb 2.5)
X
XWith :s/../../c show ruler when waiting for reply. (Webb 2.5)
X
XGive file name message for commands ":bnext", ":bmod" and the like. (2.5)
X
XMade index in argument list local to each window. (2.5)
X
XShow visual selection only in current window. (2.5)
X
XWhen a window is split, redraw both windows with cursor in middle. (2.4)
X
XIncluded code to save the xterm title. Need to define USE_X11, because
Xspecific include file and library are needed. (2.4)
X
XMade "search hit BOT.." messages redisplay after screen redraw. (2.4)
X
XDon't do textwidth formatting when in replace mode and replacing an existing
Xcharacter. (2.4)
X
XPrint message about the file when starting to edit an existing buffer. Fixes
Xnot giving a message when doing ":n" to file being edited in other window.
X(2.4)
X
XWhen lines are deleted/inserted, adjust topline and cursor position of other
Xwindows on same buffer to stay in the same place (if possible). (2.4)
X
XIf CTRL-W CTRL-] is done on a tag that does not exist, the window is not
Xsplit. (2.4)
X
XMoved column number in CTRL-G to the end and adjusted the number. (2.4)
X
XAdded "-- more --" message to listing of mappings. (2.4)
X
XAccept 'q' with "-- more --" message. Interrupts current listing. (2.4)
X
XWhen end of Visual area is on an empty line, minlc is FALSE, makes
X"d}P" and "v}dP" do the same. (2.4)
X
XWhen the commands '*' and '#' do not find an identifier after the cursor, a
Xsearch is done for a non-identifier string. (2.5)
X
XMade the ":buffers" listing nicer by putting the "line" string in column 40.
X(2.7)
X
XUpdated error messages for keyword completion. (2.8)
X
XIf 'winheight' set spread extra lines over other windows. (2.8)
X
XWhen 'updatecount' changed from zero to non-zero, create swap file for all
Xloaded buffers. (2.8)
X
XWhen command line completion found more than one match, beep. (3.0)
X
XChanged "still more files to edit" into "6 more files to edit". (2.9)
X
XWhen :bdel is used with a range and errors occur, still delete the other
Xbuffers. (3.0)
X
XAdded version string to .swp file. (3.0)
X
XIn MSDOS version: After calling a shell, check screen size. Now it is possible
Xto set the screen size with a command like ":!setmode xxx". (3.0)
X
XDon't try to open an X11 display if WINDOWID is not set, makes startup a bit
Xquicker sometimes. (3.0)
X
X
XNew and changed options
X=======================
X
XDefault 'updatetime' is 10000, 10sec. Default 'updatecount' is 1000. This
Xfeels more comfortable. But if you keep on typing, more will be lost when
Xcrashing.
X
XChanged default for 'updatecount' to 200 (1000 was too much). Default for
X'updatetime' is now four seconds (more than three seconds means that your
Xattention is drawn away). (2.7)
X
XAdded 'cmdheight' option ('ch'), number of lines for command line. Set it to 2
Xor 3 if you are annoyed by "hit return to continue" questions for long
Xmessages.
X
XAdded 'winheight' option ('wh'), number of lines for active window. Set it to
X999 to make the current window always fill the screen.
X
XMade 'winheight' option a "minimal window height" option, only set height if
Xcurrent height is smaller. (2.4)
X
XAdded 'laststatus' option ('ls'). When set to 2 last window always has a
Xstatus line. When set to 1 (which is the default) the last window only has a
Xstatus line if there are two or more windows. When set to 0 there is never a
Xstatus line. The screen looks nicer with a status line if you have several
Xwindows, but takes another screen line.
X
XAdded optional '>' to 'directory' and 'backupdir' option, e.g. ">/tmp". When
Xused, 'directory' option is always used for swap file. When not used
X'directory' is only used when swap file cannot be created in current
Xdirectory. The default is that the swap file will be in the current directory
Xwhen possible, in 'directory' otherwise. 'directory' defaults to "/tmp" for
Xunix, "t:" for Amiga and "c:\tmp" for MSDOS. The 'backupdir' option works in
Xthe same way, but is currently only available for Unix.
X
XAdded 'nobuf' option ('nb'). When set one character is send to the terminal
Xat a time (does not work for MSDOS). For debugging purposes.
X
XAdded 'shellpipe' option ('sp'). String to use for the make command to store
Xthe error messages. For Amiga and MSDOS it defaults to ">". For Unix it
Xdefaults to "| tee". For "csh", "tcsh" and "zsh" it is changed into "|& tee".
XFor "sh", "ksh" and "bash" it is changed into "2>&1| tee". Fixes problem with
X:make when not using csh.
X
XAdded 'maxmem' option ('mm'), maximal Kbyte to use for one buffer.
X
XAdded 'smarttab' option ('sta'). When set a TAB in front of a line inserts
X'shiftwidth' positions, 'tabstop' in other places. When not set a TAB always
Xinserts 'tabstop' positions, 'shiftwidth' is only used for ">>" and the like.
X
XAdded 'maxmemtot' option ('mmt'), maximal Kbyte to use for all buffers.
X
XAdded 'ttyfast' option ('tf'). When set the terminal is assumed to be fast,
Xscrolling windows is done by redrawing. When not set windows are scrolled with
Xinsert/delete line commands, causing the windows below it to jump up and down
Xif threre is no support for a scrolling region.
X
XAdded 'equalalways' option: When windows split or closed, always do CTRL-W =.
X(2.5)
X
XAdded 'splitbelow': When set new window from split is below current one. (2.5)
X
XAdded 'tagrelative' option (default ON!). When using tag file in other
Xdirectory, file names are relative to the directory where the tag file is.
X(Webb 2.5)
X
XWhen setting 'winheight' adjust current window straight away. Check for
Xnegative value. (Webb 2.5)
X
XAdded 'gdefault' option: make /g default for :s command (default off). (2.4)
X
XAdded 'title' option (default on). When off, window title is not set. (2.4)
X
XAdded NOTITLE compile time option for Vera: When defined the title option is
Xdefault off. (2.7)
X
XAdded 'icon' option (default off): when set xterm icon is set to file name.
X(2.4)
X
XAdded 'invertweird' option, for terminals that have a weird inversion method.
XMakes the start/end invert code outputted before every character. (2.4)
X
XChanged 'invertweird' to 'weirdinvert', because an option starting with 'inv'
Xis illegal. ":set invertweird" gives an error message. (2.7)
X
XAdded 'endofline' 'eol' option. If not set and in binary mode, last line will
Xnot get an end of line when writing. (2.4)
X
XAdded 'bswrap' option: Backspace (CTRL-H) and space wrap to previous/next line
Xin command mode. Default is ON! Should have been added long ago! (2.4)
X
XWhen 'bswrap' option set, left/right cursor keys in insert mode also wrap to
Xprevious/next line. (2.7)
X
XChanged toggle 'bswrap' option to number 'whichwrap' option: Add numbers to
Xallow specific keys to wrap to next/previous line: 1 for backspace, 2 for
Xspace, 4 for 'h' and 'l', 8 for cursor left/right, 16 for cursor left/right in
Xinsert mode. (2.7)
X
XAdded 'patchmode' option. Oldest version of a file is kept. (2.4)
X
XAdded 't_csc' termcap option: when set (to anything) the cursor positioning is
Xdone relative to the start of the scrolling region. Otherwise it is relative
Xto the start of the screen. Unfortunately there is no termcap entry for this.
XWe are just guessing its value. Currently only MSDOS pcterm is know to need
Xthis set. This fixes doing 'o' not getting the new line in the right place for
XMSDOS. (2.7)
X
XAdded 'highlight' ('hl') option: Can set highlighting mode for various
Xoccasions. 'i' for invert, 'b' for bold, 's' for standout; 'v' = visual mode,
X'd' = directories in CTRL-D listing, 'e' = error messages, 's' = status lines,
X'h' = help file headers, 'r' = return to continue message. They have to be
Xgiven in pairs, separated with a comma. For example:
X":set hl=ds,vb,ei,si,hb,ri". Invert is used for occasions that are not
Xincluded. Default is "ds,es,hs,rs,vi,si". (2.6)
X
XChanged the default highlight mode for directories to bold. (2.7)
X
XAdded 'n' to 'highlight' option: no highlighting. (2.7)
X
XAdded 'bold' termcap option as t_tb. (2.6)
X
X
XVi compatibility fixes
X======================
X
X":>", ":<" and ":yank" leave cursor on the last line.
X
XAbbreviations recognized like vi, fixes abbreviation of "#i" to "#include".
X
X"d]]" also stops at '{'.
X
X']' and '[' are not linewise.
X
X"z." and "z-" move cursor to start of line. "zz" does the same as "z.".
X
X":>>" shifts two indents, ":>>>" three, etc.
X
XWhen no file name yet and giving a ":read fname" command, use that file name.
X(2.4) When no file name yet and giving a ":write fname" command, use that file
Xname. (2.5)
X
X":3,3join" does nothing, fixes "g/^$/.,/./-j" to delete only multiple empty
Xlines. (2.5)
X
X":wnext" does not go to next file in argument list if write fails. (2.5)
X
XCTRL-W CURSOR-UP and CTRL-W CURSOR-DOWN do the same as CTRL-W k and CTRL-W j.
X(2.5)
X
X'smartindent' is improved: When '}' is typed as the first char on a line,
Xit is moved to line up with the line containing the matching '{' (rather than
Xjust moving back one shift-width no matter what). If '#' is the first
Xcharacter typed on a line, then the line is moved all the way to the left.
X(Webb 2.5)
X
XWhen 'smartindent' set, '#' removes all indent. Now the existing indent is
Xremembered for the next line (like with ^ CTRL-D). (2.7)
X
XWhen ESC is used to cancel a command, don't beep. (Webb 2.5)
X
XWhen 'autoindent' set and inserting a CR, delete white space after the cursor.
X(Webb 2.5)
X
XDon't set curswant when 'h' or 'l' fails. (Webb 2.5)
X
XWith "70|" command set curswant to 70, also when line is shorter. (Webb 2.5)
X
XFixed "cc" to delete the text linewise, but keep the indent when 'ai' is set.
X(2.5)
X
X"dTx" and "dFx" do not include cursor position.
X
X":r" without a file name specified reads current file.
X
X"ce" when on the end of a word changes until the end of the next word
X(but "cw" not).
X
XAfter "dd" put cursor on first non-blank in line.
X
XAbbreviations are never recursive, makes ":ab f f-o" work.
X
X'#' is not the start of an ex comment but an abbreviation for ":number".
X
XPut redo for "p" and "P" back in. It is not completely compatible, because vi
Xdoesn't always redo putting less then a line (but that is considered to be a
Xbug in vi). (2.5)
X
XAdjusted comp_col() for when 'laststatus' is set. Reduces need for "hit return
Xto continue". (2.5)
X
XWith ":global" command, don't display "n more lines" messages until the end.
X(2.5)
X
XDon't reset yank buffer with "." command. Makes dwu"a. work. (2.4)
X
XDon't check for abbreviation when a (non-id) character is entered with CTRL-V.
X(2.4)
X
XWith change command put deleted text in "1, even with text within one line.
X(2.4)
X
XWhen deleting and a register is specified, also yank into buffer "1. (2.4)
X
X":3|" prints line 3 instead of jumping to it. (2.4)
X
XSeparated 'wrapmargin' and 'textwidth'. Both can be used, if textwidth is set
Xit overrides 'wrapmargin'. (2.8)
X
X
XBug fixes
X=========
X
XFixed problem in memmove for __sgi.
X
XFixed ":cd" not working for unix.
X
XMade incrementing hex numbers with CTRL-A work on systems that don't accept 0x
Xin scanf for "%x".
X
XReset p_ro in readfile() when starting to edit a new file.
X
Xinchar() also calls flushbuf when waiting for a second, fixes screen not
Xupdated while waiting for a mapping to be completed.
X
XFixed ":/pat/s/x/X/"; 's' was seen as option to search command.
X
XFixed search patterns where delimiter is inside of a range, e.g. "/[/]".
X
XFixed ignoring 'ignorecase' option for "/[a-z]". Fixed mixing upper/lower case
Xwhen 'ignorecase' option not set (just slowed down the searching).
X
XUse iswhite() instead of isspace() for "^" and set_indent().
X
XAllow pipe in ":r !cmd" and ":w !cmd".
XAdjusted check for '|' in ":e +cmd".
X
XFixed insertchar() lookahead for digraph not working when using mapped
Xcharacters.
X
XFixed :unab and :unmap for rhs with spaces.
X
XFixed not accepting ambiguous abbreviations.
X
XAdded check for valid abbreviations.
X
XFixed crash for AmigaDOS 1.3 when giving more than one file on the command
Xline.
X
XUpdated isidchar for meta chars.
X
XAdded setting of Changed flag to :move and :copy.
X
XNumber after search pattern (e.g. "/pattern/3") is line offset.
X
X"cc<ESC>" when 'ai' is set, deletes the indent.
X
XFixed ":s/1/1^M/gc" on "111" and ":s/O/oO/gc" looping.
X
XFixed trailing "\" in substitute string (produced garbage).
X
XFixed yanking control characters (like "^B") with block visual mode.
X
XFixed cursor left of line with "i<ESC>" when 'number' set.
X
XMSDOS: isdir() adjusted for trailing backslash, fixes CTRL-D listing.
X
XMSDOS: Fixed call to lalloc() in addfile() in msdos.c, could only do 32 files.
X
XMSDOS: Fixed setting archive bit in setperm() in msdos.c.
X
XMSDOS: Do not eat backslashes in ":next" command.
X
XFixed bug in makescriptname: alloc 1 byte extra.
X
XFixed bug in doaddsub(): Line truncated 30 chars after number.
X
XFixed CTRL-O in insert mode moving cursor when it is after end of line.
X
XVertical movement in insert mode can put cursor one char after the line.
X
XFixed not inverting 0xa0 in visual mode when scrolling. This caused gaps in
Xthe inverted region.
X
XFixed hangup for "?$" command.
X
XFixed keyword macros: ^B must be ^R.
X
X":set all" and ":set termcap" do not look for other arguments.
X
X{count}% puts cursor on first non-blank.
X
XWhen ":ta" to tag in same file, start search in line 1. Fixes problem when
X'wrapscan' is not set.
X
XFixed setting of pcmark for "(" and ")".
X
XFixed setting pcmark with :e command.
X
XFixed a crash on Unix when terminal type unknown. (2.5)
X
XFixed 'showmatch', the cursor was off. (2.5)
X
XSolved crash when 'lines' was set in .exrc. (2.5)
X
XFixed memory leak for mf_xfname. (2.5)
X
XFixed a problem in the Unix part for making backup files. Strange that this
Xdid not cause the compiler to complain. (2.5)
X
XFilename expansion is now done into NameBuff instead of IObuff. Fixes bugs
Xwhere file name was scrambled or Vim crashed some time after ":next file".
X(2.5)
X
XFixed deleting the file message when 't_tp' was set in .vimrc. (2.5)
X
XFixed cursor positioning problem when :s/../../gc made line go past end of
Xscreen. (Webb 2.5)
X
XDon't nag about swap file not existing when preserving, except for
X":preserve". (2.5)
X
XFixed loosing changes without warning when 'hidden' option set and re-editing
Xthe same file with a command like ":rewind". (2.5)
X
XClear commandline with ":buffers" command. (2.5)
X
XFixed ":1buf" to go to first buffer instead of second one. (2.5)
X
XFixed default for ":sleep" to be 1 instead of current line number. (2.5)
X
XWhen the 'hidden' option is set don't give error message for changed file on
Xseveral commands (:ta). (2.5)
X
XUpdate timestamp in swap file when the file has been written. (2.5)
X
XFixed a problem not updating the time stamp in the swap file when writing
Xanother but the current buffer. (2.7)
X
XFixed bug: not-edited file could be written with ":w". (2.5)
X
XFixed invering Visual part when 'nowrap' set and start is left of window.
X(2.4)
X
XFixed problem with join: Deleted leading spaces in the 2nd line when it
Xshouldn't. (2.4)
X
XMSDOS: Trailing CTRL-V in sourced ex file now handled correctly. (2.4)
X
XImproved check for readonly files, now "466" is not readonly for others. (2.4)
X
XFixed not inverting one char with "1v" when cursor cannot be made invisible.
X(2.4)
X
XStop Visual mode before exiting a window. (2.4)
X
XChanged "short_u" to "unsigned" in data block. Fixes problem with lines longer
Xthan 64K characters on Unix. Disadvantage: Need 2 bytes extra for each line.
X(2.4)
X
XFixed plines_win() and chartabsize() for lines that are almost 32768
Xcharacters. (2.4)
X
XReplace MAX_INT by INT_MAX, fixes problem with "$" not getting very far. (2.4)
X
XStatus lines also redrawn after ":set". Needed when 'ruler' option was
Xchanged. (2.4)
X
XFixed fname freed twice in mf_open(). Fixes crash/hang when editing a file in
Xa readonly directory. (2.4)
X
XUpdate mf_neg_count in mf_free, fixes "line count wrong in block 1" errors.
X(2.4)
X
XFixed bug when in replace mode and beyond the end of the line. (2.4)
X
XFixed a problem for 'r' with a count. Could corrupt the text in the buffer!
X(2.4)
X
XScroll options adjusted after CTRL-W =. (2.4)
X
XIf a tag is found, but the associated file does not exist, do not start
Xediting an empty file. (2.4)
X
Xsc_col and ru_col cannot become negative anymore, fixes crash with ":win 1".
X(2.4)
X
XCheck_winsize makes Rows at least 2. (2.4)
X
X'o' and 'O' commands did not update marks for the line just below the new
Xline. (2.4)
X
XFixed truncated displaying of string options. (2.4)
X
XFixed chmod for help file in makefile.unix. (2.4)
X
XHighlighting of directories for CTRL-D on command line no longer highlights
Xsome spaces. (2.4)
X
XMoved #endif in param.c from below to above p_wh, fixes problem when
XCOMPATIBLE is defined. (2.4)
X
XDon't reset msg_scrolled in UpdateScreen() when redrawing is disabled. (2.4)
X
XFixed cursor positioning error when cursor is on first char of non-empty
Xcmdline. (2.4)
X
XFixed problem with redraw when filename completion fails under unix. (2.4)
X
XNo "hit return to continue" while editing a command line
X(e.g. when filename completion fails). (2.4)
X
XFixed bug: Errors while reading file caused big problems. (2.4)
X
XDon't try to preserve if there is no swap file. (2.4)
X
XDont' complain about .swp file existing without a file name. (2.4)
X
XFixed endless loop for CTRL-R a in insert mode while register a contained
XCTRL-R a. Can now be interrupted with CTRL-C. (2.6)
X
XFixed ":n *" in MSDOS not finding file names with dot. (2.7)
X
XFixed cursor not moved to the right column when scrolling with CTRL-E and
XCTRL-Y. (2.7)
X
XFixed bug when using CTRL-A to increment a decimal number after incrementing
Xan upper case hexadecimal number. (2.7)
X
XOnly reset the 'notedited' flag when writing to the current file name, not
Xwhen writing to another file. (2.7)
X
XFixed screen redraw when window resized, was sometimes done only after
Xcharacter typed. (2.7)
X
XCorrected the order of the options to be alfabetical. (2.7)
X
XFixed using CTRL-D on the command line when there are no matches at all. (2.7)
X
XFixed beeping always when doing CTRL-A on command line. (2.7)
X
XFixed the line number for the alternate file being used for the next command.
Xe.g. ":w #", ":e file" when # is file. (2.7)
X
XMoved the fileinfo() in doecmd() to after the place where the cursor is set.
XFixes reporting the wrong cursor position when entering a hidden buffer. (2.7)
X
XFixed compilation problem in unix.c when compiling without WEBB_COMPLETE.
X(2.7)
X
XWhen going to previous line with backspace, set curswant. (2.7)
X
XFixed status line showing "[No File] [+] [+]": two plusses. (2.7)
X
XThe 'changed' flag was not reset for other buffers with :wall. (2.7)
X
XSolved bug in 'r': The change was not written to the swap file, which made the
Xchange to be lost sometimes. (2.6)
X
XDon't ask for swapping the command line range when in global command. (2.6)
X
XFixed :bdelete, it did't work. :bdelete and :bunload cannot remove a buffer
Xwith an open window, unless it is only the current window. (2.6)
X
XFixed .swp files not deleted when starting to edit a file when the current
Xbuffer is empty and has no name. This also fixes the problem which happens
Xwhen starting vim without a file name and the starting to edit a file that
Xdoes not exist. (2.6)
X
XWhen error encountered while loading files for "-o" option or ":all", continue
Xloading the other files. (2.8)
X
XIf cursor is in column 0, always reset horizontal scrolling. Makes tabs
Xcompletely visible. (2.8)
X
XFixed problem in mf_release_all, empty used list not detected properly. (2.8)
X
XFixed crash with command ":@:", repeat last command line. (2.8)
X
XFixed cursor in wrong column when matched string from search was just one line
Xbelow the window. (2.8)
X
X":m+1" on the last line in the file silently deleted that line. (3.0)
X
XFixed command line completion of ":s<TAB>". (3.0)
X
XThe ":srewind" command did not work. (3.0)
X
XThe ":k" command did not work. (3.0)
X
XWhen making windows for ":all" or "-o" argument, ignore 'splitbelow' option.
X(3.0)
X
XFixed a problem when recovering with a swap file that has a page size
Xdifferent from the default page size. (3.0)
X
XThe ":bdelete" command did not delete the last buffer. (3.0)
X
XWhen using a range with ":bdelete" that included the current buffer, all the
Xbuffers after it would get loaded before being deleted (3.0)
X
XFixed <SPACE>, wrapping to first char of next line, not setting the wanted
Xcolumn, causing the next 'k' to go to the wrong column. Same for <BACKSPACE>
Xon the first column, sticking in the last column. (3.0)
X
X
XInternals
X=========
X
XRenamed u_char to char_u, u_short to short_u. Avoids problems with systems
Xwhere these are already defined.
X
XReplaced almost all char by char_u, solves some problems with characters above
X127.
X
XRemoved ptr2nr(). This means that line numbers are adjusted when
Xinserting/deleting lines. Marks remember line number instead of pointer; undo
Xuses line count to compute ue_bot.
X
XMoved all objects files into "obj" directory.
X
XAdded "window.c" for multiple window code.
X
XAdded "memfile.c" and "memline.c" for swap file code.
X
XMoved what was remaining of "storage.c" to "undo.c", deleted "storage.c".
X
XDeleted autoscript file stuff.
X
XRenamed "buffers.c" to "getchar.c".
X
XCreated "buffer.c". Deleted "script.c".
X
XMoved a few functions from "cmdline.c" to "cmdcmds.c" to reduce the size of
X"cmdline.c".
X
XIntegrated file list into buffer list. ":buffers" and ":files" do the same.
XMoved functions from "filelist.c" to "buffer.c", deleted "filelist.c". (2.5)
X
XRemove mch_start_listing() and mch_stop_listing(), replaced by "--more--".
X(2.5)
X
X
XPortability
X===========
X
XA few patches, the file "winnt.c" and "makefile.nt" for windows NT. (2.4)
X
XAdded support for Archimedes. It probably doesn't work, because "archie.h" was
Xmissing, and the patches are for Vim version 2.0. Included them anyway, so
Xpeople can make patches to make it working. (2.9)
X
XAdded a few changes for USL in unix.c.
X
XMade makefile for unix more easy to change for a specific system.
X
XIncluded small patches for gcc on HPUX 9. (2.4)
X
XSet the SIGWINCH signal, when receiving that signal, for all systems. (Webb
X2.5)
X
XChanged Visual into VIsual, because it is also used by X11. (2.4)
X
XAdded some changes for USL and picky gcc. (2.4)
X
XIncluded patches for SCO 3.2. (2.4)
X
XRemoved the use of the 'obj' directory from makefile.unix. Some versions of
Xmake and cc were having problems with it. (2.7)
END_OF_FILE
if test 34259 -ne `wc -c <'vim/readme3.0'`; then
echo shar: \"'vim/readme3.0'\" unpacked with wrong size!
fi
# end of 'vim/readme3.0'
fi
if test -f 'vim/src/winnt.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'vim/src/winnt.c'\"
else
echo shar: Extracting \"'vim/src/winnt.c'\" \(31469 characters\)
sed "s/^X//" >'vim/src/winnt.c' <<'END_OF_FILE'
X/* vi:ts=4:sw=4
X *
X * VIM - Vi IMproved
X *
X */
X
X/*
X * winnt.c
X *
X * Windows NT system-dependent routines.
X * A reasonable approximation of the amiga dependent code.
X * Portions lifted from SDK samples, from the MSDOS dependent code,
X * and from NetHack 3.1.3.
X *
X * rogerk@wonderware.com
X */
X
X#include <io.h>
X#include "vim.h"
X#include "globals.h"
X#include "param.h"
X#include "proto.h"
X#include <fcntl.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X#include <errno.h>
X#include <stdlib.h>
X#include <windows.h>
X#include <wincon.h>
X
Xstatic int WaitForChar __ARGS((int));
Xstatic int cbrk_handler __ARGS(());
X
X/* Win32 Console handles for input and output */
XHANDLE hConIn;
XHANDLE hConOut;
X
X/* Win32 Screen buffer,coordinate,console I/O information */
XCONSOLE_SCREEN_BUFFER_INFO csbi;
XCOORD ntcoord;
XINPUT_RECORD ir;
X
X/* The attribute of the screen when the editor was started */
XWORD DefaultAttribute;
X
Xtypedef struct filelist {
X char **file;
X int nfiles;
X int maxfiles;
X} FileList;
X
Xstatic void addfile __ARGS((FileList *, char *, int));
Xstatic int pstrcmp(); /* __ARGS((char **, char **)); BCC does not
X * like this */
Xstatic void strlowcpy __ARGS((char *, char *));
Xstatic int expandpath __ARGS((FileList *, char *, int, int, int));
X
Xstatic int cbrk_pressed = FALSE; /* set by ctrl-break interrupt */
Xstatic int ctrlc_pressed = FALSE; /* set when ctrl-C or ctrl-break
X * detected */
X
Xvoid vim_delay()
X{
X delay(500);
X}
X
X/*
X * this version of remove is not scared by a readonly (backup) file
X */
Xint vim_remove(name)
X char *name;
X{
X setperm(name, _S_IWRITE); /* default permissions */
X return unlink(name);
X}
X
X/*
X * mch_write(): write the output buffer to the screen
X */
Xvoid mch_write(s, len)
X char *s;
X int len;
X{
X char *p;
X int row,
X col;
X
X s[len] = '\0';
X if (term_console) /* translate ESC | sequences into bios calls */
X while (len--) {
X
X /* optimization: use one single WriteConsole for runs of text,
X rather than calling putch() multiple times. It ain't curses,
X but it helps. */
X
X DWORD prefix = strcspn(s, "\n\r\a\033");
X
X if (prefix) {
X DWORD nwritten;
X
X if (WriteConsole(hConOut, s, prefix, &nwritten, 0)) {
X
X len -= (nwritten - 1);
X s += nwritten;
X }
X continue;
X }
X
X if (s[0] == '\n') {
X if (ntcoord.Y == (Rows - 1)) {
X gotoxy(1, ntcoord.Y + 1);
X scroll();
X } else {
X gotoxy(1, ntcoord.Y + 2);
X }
X s++;
X continue;
X } else if (s[0] == '\r') {
X gotoxy(1, ntcoord.Y + 1);
X s++;
X continue;
X } else if (s[0] == '\a') {
X vbell();
X s++;
X continue;
X } else if (s[0] == ESC && len > 1 && s[1] == '|') {
X switch (s[2]) {
X
X case 'v':
X cursor_visible(0);
X goto got3;
X
X case 'V':
X cursor_visible(1);
X goto got3;
X
X case 'J':
X clrscr();
X goto got3;
X
X case 'K':
X clreol();
X goto got3;
X
X case 'L':
X insline(1);
X goto got3;
X
X case 'M':
X delline(1);
X got3: s += 3;
X len -= 2;
X continue;
X
X case '0':
X case '1':
X case '2':
X case '3':
X case '4':
X case '5':
X case '6':
X case '7':
X case '8':
X case '9':
X p = s + 2;
X row = getdigits(&p); /* no check for length! */
X if (p > s + len)
X break;
X if (*p == ';') {
X ++p;
X col = getdigits(&p); /* no check for length! */
X if (p > s + len)
X break;
X if (*p == 'H') {
X gotoxy(col, row);
X len -= p - s;
X s = p + 1;
X continue;
X }
X } else if (*p == 'm') {
X if (row == 0)
X normvideo();
X else
X textattr(row);
X len -= p - s;
X s = p + 1;
X continue;
X } else if (*p == 'L') {
X insline(row);
X len -= p - s;
X s = p + 1;
X continue;
X } else if (*p == 'M') {
X delline(row);
X len -= p - s;
X s = p + 1;
X continue;
X }
X }
X }
X putch(*s++);
X }
X else
X write(1, s, (unsigned) len);
X}
X/*
X * Keyboard translation tables.
X * (Adopted from the MSDOS port)
X */
X
X#define KEYPADLO 0x47
X#define KEYPADHI 0x53
X
X#define PADKEYS (KEYPADHI - KEYPADLO + 1)
X#define iskeypad(x) (KEYPADLO <= (x) && (x) <= KEYPADHI)
X
X/*
X * Wait until console input is available
X */
X
Xstatic int WaitForChar(msec)
X int msec;
X{
X int count;
X int ch;
X int scan;
X int shiftstate;
X int altseq;
X int retval = 0;
X
X if (WaitForSingleObject(hConIn, msec) == WAIT_OBJECT_0) {
X count = 0;
X PeekConsoleInput(hConIn, &ir, 1, &count);
X if (count > 0) {
X ch = ir.Event.KeyEvent.uChar.AsciiChar;
X scan = ir.Event.KeyEvent.wVirtualScanCode;
X shiftstate = ir.Event.KeyEvent.dwControlKeyState;
X if (((ir.EventType == KEY_EVENT) && ir.Event.KeyEvent.bKeyDown) &&
X (ch || (iskeypad(scan)))) {
X retval = 1; /* Found what we sought */
X }
X } else { /* There are no events in console event queue */
X retval = 0;
X }
X }
X return retval;
X}
X
Xstatic int pending = 0;
X
Xint tgetch()
X{
X int valid = 0;
X int metaflags = 0;
X int count;
X unsigned short int scan;
X unsigned char ch;
X unsigned long shiftstate;
X const struct pad *kpad;
X char keymess[100];
X
X if (pending)
X {
X ch = pending;
X pending = 0;
X }
X else
X {
X
X valid = 0;
X while (!valid) {
X ReadConsoleInput(hConIn, &ir, 1, &count);
X if (ir.EventType == WINDOW_BUFFER_SIZE_EVENT) {
X set_winsize(Rows, Columns, FALSE);
X }
X else
X {
X if ((ir.EventType == KEY_EVENT) && ir.Event.KeyEvent.bKeyDown)
X {
X ch = ir.Event.KeyEvent.uChar.AsciiChar;
X scan = ir.Event.KeyEvent.wVirtualScanCode;
X if (ch || (iskeypad(scan)))
X valid = 1;
X }
X }
X }
X if (!ch)
X {
X pending = scan;
X ch = 0;
X }
X }
X return ch;
X}
X
X
Xint kbhit()
X{
X int done = 0; /* true = "stop searching" */
X int retval; /* true = "we had a match" */
X int count;
X unsigned short int scan;
X unsigned char ch;
X unsigned long shiftstate;
X
X if (pending)
X return 1;
X
X done = 0;
X retval = 0;
X while (!done) {
X count = 0;
X PeekConsoleInput(hConIn, &ir, 1, &count);
X if (count > 0) {
X ch = ir.Event.KeyEvent.uChar.AsciiChar;
X scan = ir.Event.KeyEvent.wVirtualScanCode;
X shiftstate = ir.Event.KeyEvent.dwControlKeyState;
X if (((ir.EventType == KEY_EVENT) && ir.Event.KeyEvent.bKeyDown) &&
X (ch || (iskeypad(scan)) )) {
X done = 1; /* Stop looking */
X retval = 1; /* Found what we sought */
X } else /* Discard it, its an insignificant event */
X ReadConsoleInput(hConIn, &ir, 1, &count);
X } else { /* There are no events in console event queue */
X done = 1; /* Stop looking */
X retval = 0;
X }
X }
X return retval;
X}
X
X
X/*
X * GetChars(): low level input funcion.
X * Get a characters from the keyboard.
X * If time == 0 do not wait for characters.
X * If time == n wait a short time for characters.
X * If time == -1 wait forever for characters.
X */
Xint GetChars(buf, maxlen, time)
X char *buf;
X int maxlen;
X int time;
X{
X int len = 0;
X int c;
X
X if (time >= 0) {
X if (time == 0) /* don't know if time == 0 is allowed */
X time = 1;
X if (WaitForChar(time) == 0) /* no character available */
X return 0;
X } else { /* time == -1 */
X /* If there is no character available within 2 seconds (default)
X * write the autoscript file to disk */
X if (WaitForChar((int) p_ut) == 0)
X updatescript(0);
X }
X
X/*
X * Try to read as many characters as there are.
X * Works for the controlling tty only.
X */
X --maxlen; /* may get two chars at once */
X /* we will get at least one key. Get more if they are available After a
X * ctrl-break we have to read a 0 (!) from the buffer. bioskey(1) will
X * return 0 if no key is available and when a ctrl-break was typed. When
X * ctrl-break is hit, this does not always implies a key hit. */
X cbrk_pressed = FALSE;
X while ((len == 0 || kbhit()) && len < maxlen) {
X switch (c = tgetch()) {
X case 0:
X *buf++ = K_NUL;
X break;
X case 3:
X cbrk_pressed = TRUE;
X /* FALLTHROUGH */
X default:
X *buf++ = c;
X }
X len++;
X }
X return len;
X}
X
X/*
X * We have no job control, fake it by starting a new shell.
X */
Xvoid mch_suspend()
X{
X outstr("new shell started\n");
X call_shell(NULL, 0, TRUE);
X}
X
Xextern int _fmode;
Xchar OrigTitle[256];
X/*
X */
Xvoid mch_windinit()
X{
X CONSOLE_SCREEN_BUFFER_INFO csbi;
X
X _fmode = O_BINARY; /* we do our own CR-LF translation */
X flushbuf();
X
X /* Obtain handles for the standard Console I/O devices */
X hConIn = CreateFile("CONIN$",
X GENERIC_READ | GENERIC_WRITE,
X FILE_SHARE_READ | FILE_SHARE_WRITE,
X NULL, OPEN_EXISTING, 0, NULL);
X
X hConOut = CreateFile("CONOUT$",
X GENERIC_READ | GENERIC_WRITE,
X FILE_SHARE_READ | FILE_SHARE_WRITE,
X NULL, OPEN_EXISTING, 0, NULL);
X
X GetConsoleTitle(OrigTitle, sizeof(OrigTitle));
X
X /* get current attributes and fill out CHAR_INFO structure for fill char */
X GetConsoleScreenBufferInfo(hConOut, &csbi);
X DefaultAttribute = csbi.wAttributes;
X
X mch_get_winsize();
X}
X
Xvoid check_win(argc, argv)
X int argc;
X char **argv;
X{
X if (!isatty(0) || !isatty(1)) {
X fprintf(stderr, "VIM: no controlling terminal\n");
X exit(2);
X }
X /* In some cases with DOS 6.0 on a NEC notebook there is a 12 seconds
X * delay when starting up that can be avoided by the next two lines.
X * Don't ask me why! This could be fixed by removing setver.sys from
X * config.sys. Forget it. gotoxy(1,1); cputs(" "); */
X}
X
X/*
X * fname_case(): Set the case of the filename, if it already exists.
X * msdos filesystem is far to primitive for that. do nothing.
X */
Xvoid fname_case(name)
X char *name;
X{
X}
X
X
X/*
X * mch_settitle(): set titlebar of our window
X * Can the icon also be set?
X */
Xvoid mch_settitle(title, icon)
X char *title;
X char *icon;
X{
X if (title != NULL)
X SetConsoleTitle(title);
X}
X
X/*
X * Restore the window/icon title.
X * which is one of:
X * 1 Just restore title
X * 2 Just restore icon (which we don't have)
X * 3 Restore title and icon (which we don't have)
X */
X void
Xmch_restore_title(which)
X int which;
X{
X mch_settitle((which & 1) ? OrigTitle : NULL, NULL);
X}
X
X/*
X * Get name of current directory into buffer 'buf' of length 'len' bytes.
X * Return non-zero for success.
X */
Xint vim_dirname(buf, len)
X char *buf;
X int len;
X{
X return (_getcwd(buf, len) != NULL);
X}
X
X/*
X * get absolute filename into buffer 'buf' of length 'len' bytes
X */
Xint FullName(fname, buf, len)
X char *fname,
X *buf;
X int len;
X{
X if (fname == NULL) /* always fail */
X return FAIL;
X
X if (_fullpath(buf, fname, len) == NULL) {
X strncpy(buf, fname, len); /* failed, use the relative path name */
X return FAIL;
X }
X return OK;
X}
X
X/*
X * return TRUE is fname is an absolute path name
X */
X int
XisFullName(fname)
X char_u *fname;
X{
X return (STRCHR(fname, ':') != NULL);
X}
X
X/*
X * get file permissions for 'name'
X * -1 : error
X * else FA_attributes defined in dos.h
X */
Xlong getperm(name)
X char *name;
X{
X int r;
X struct stat sb;
X
X r = _stat(name, &sb); /* get file mode */
X
X if (r)
X return r;
X else
X return sb.st_mode;
X}
X
X/*
X * set file permission for 'name' to 'perm'
X */
Xint setperm(name, perm)
X char *name;
X long perm;
X{
X return _chmod(name, (int) perm);
X}
X
X/*
X * check if "name" is a directory
X */
Xint isdir(name)
X char *name;
X{
X int f;
X
X f = getperm(name);
X if (f == -1)
X return -1; /* file does not exist at all */
X if ((f & _S_IFDIR) == 0)
X return FAIL; /* not a directory */
X return OK;
X}
X
X/*
X * Careful: mch_windexit() may be called before mch_windinit()!
X */
Xvoid mch_windexit(r)
X int r;
X{
X settmode(0);
X stoptermcap();
X flushbuf();
X ml_close_all(); /* remove all memfiles */
X mch_restore_title(3);
X exit(r);
X}
X
X/*
X * function for ctrl-break interrupt
X */
XBOOL WINAPI handler_routine(DWORD dwCtrlType)
X{
X cbrk_pressed = TRUE;
X ctrlc_pressed = TRUE;
X}
X
X/*
X * set the tty in (raw) ? "raw" : "cooked" mode
X *
X */
X
Xvoid mch_settmode(raw)
X int raw;
X{
X long cmodein;
X long cmodeout;
X long mask;
X
X GetConsoleMode(hConIn, &cmodein);
X GetConsoleMode(hConOut, &cmodeout);
X
X if (raw) {
X if (term_console)
X outstr(T_TP); /* set colors */
X
X cmodein &= ~(ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT |
X ENABLE_ECHO_INPUT);
X cmodein |= ENABLE_WINDOW_INPUT;
X
X SetConsoleMode(hConIn, cmodein);
X
X cmodeout &= ~(ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
X SetConsoleMode(hConOut, cmodeout);
X SetConsoleCtrlHandler(handler_routine, TRUE);
X } else {
X
X if (term_console)
X normvideo(); /* restore screen colors */
X
X cmodein |= (ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT |
X ENABLE_ECHO_INPUT);
X cmodein &= ~(ENABLE_WINDOW_INPUT);
X
X SetConsoleMode(hConIn, cmodein);
X
X cmodeout |= (ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
X
X SetConsoleMode(hConOut, cmodeout);
X
X SetConsoleCtrlHandler(handler_routine, FALSE);
X }
X}
X
Xint mch_get_winsize()
X{
X int i;
X/*
X * Use the console mode API
X */
X if (GetConsoleScreenBufferInfo(hConOut, &csbi)) {
X Rows = csbi.dwSize.Y;
X Columns = csbi.dwSize.X;
X DefaultAttribute = csbi.wAttributes;
X } else {
X Rows = 25;
X Columns = 80;
X }
X
X if (Columns < 5 || Columns > MAX_COLUMNS ||
X Rows < 2 || Rows > MAX_COLUMNS) {
X /* these values are overwritten by termcap size or default */
X Columns = 80;
X Rows = 25;
X return OK;
X }
X /* Rows_max = Rows; /* remember physical max height */
X
X check_winsize();
X /*script_winsize();*/
X
X return OK;
X}
X
X/*********************************************************************
X* FUNCTION: perr(PCHAR szFileName, int line, PCHAR szApiName, *
X* DWORD dwError) *
X* *
X* PURPOSE: report API errors. Allocate a new console buffer, display *
X* error number and error text, restore previous console *
X* buffer *
X* *
X* INPUT: current source file name, current line number, name of the *
X* API that failed, and the error number *
X* *
X* RETURNS: none *
X*********************************************************************/
X
X/* maximum size of the buffer to be returned from FormatMessage */
X#define MAX_MSG_BUF_SIZE 512
X
Xvoid perr(PCHAR szFileName, int line, PCHAR szApiName, DWORD dwError)
X{
X CHAR szTemp[1024];
X DWORD cMsgLen;
X CHAR *msgBuf; /* buffer for message text from system */
X int iButtonPressed; /* receives button pressed in the
X * error box */
X
X /* format our error message */
X sprintf(szTemp, "%s: Error %d from %s on line %d:\n", szFileName,
X dwError, szApiName, line);
X /* get the text description for that error number from the system */
X cMsgLen = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
X FORMAT_MESSAGE_ALLOCATE_BUFFER | 40, NULL, dwError,
X MAKELANGID(0, SUBLANG_ENGLISH_US), (LPTSTR) & msgBuf, MAX_MSG_BUF_SIZE,
X NULL);
X if (!cMsgLen)
X sprintf(szTemp + strlen(szTemp), "Unable to obtain error message text! \n"
X "%s: Error %d from %s on line %d", __FILE__,
X GetLastError(), "FormatMessage", __LINE__);
X else
X strcat(szTemp, msgBuf);
X strcat(szTemp, "\n\nContinue execution?");
X MessageBeep(MB_ICONEXCLAMATION);
X iButtonPressed = MessageBox(NULL, szTemp, "Console API Error",
X MB_ICONEXCLAMATION | MB_YESNO | MB_SETFOREGROUND);
X /* free the message buffer returned to us by the system */
X if (cMsgLen)
X LocalFree((HLOCAL) msgBuf);
X if (iButtonPressed == IDNO)
X exit(1);
X return;
X}
X#define PERR(bSuccess, api) {if (!(bSuccess)) perr(__FILE__, __LINE__, \
X api, GetLastError());}
X
X
Xvoid resizeConBufAndWindow(HANDLE hConsole, SHORT xSize, SHORT ySize)
X{
X CONSOLE_SCREEN_BUFFER_INFO csbi; /* hold current console buffer info */
X BOOL bSuccess;
X SMALL_RECT srWindowRect; /* hold the new console size */
X COORD coordScreen;
X
X bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi);
X PERR(bSuccess, "GetConsoleScreenBufferInfo");
X /* get the largest size we can size the console window to */
X coordScreen = GetLargestConsoleWindowSize(hConsole);
X PERR(coordScreen.X | coordScreen.Y, "GetLargestConsoleWindowSize");
X /* define the new console window size and scroll position */
X srWindowRect.Right = (SHORT) (min(xSize, coordScreen.X) - 1);
X srWindowRect.Bottom = (SHORT) (min(ySize, coordScreen.Y) - 1);
X srWindowRect.Left = srWindowRect.Top = (SHORT) 0;
X /* define the new console buffer size */
X coordScreen.X = xSize;
X coordScreen.Y = ySize;
X /* if the current buffer is larger than what we want, resize the */
X /* console window first, then the buffer */
X if ((DWORD) csbi.dwSize.X * csbi.dwSize.Y > (DWORD) xSize * ySize) {
X bSuccess = SetConsoleWindowInfo(hConsole, TRUE, &srWindowRect);
X PERR(bSuccess, "SetConsoleWindowInfo");
X bSuccess = SetConsoleScreenBufferSize(hConsole, coordScreen);
X PERR(bSuccess, "SetConsoleScreenBufferSize");
X }
X /* if the current buffer is smaller than what we want, resize the */
X /* buffer first, then the console window */
X if ((DWORD) csbi.dwSize.X * csbi.dwSize.Y < (DWORD) xSize * ySize) {
X bSuccess = SetConsoleScreenBufferSize(hConsole, coordScreen);
X PERR(bSuccess, "SetConsoleScreenBufferSize");
X bSuccess = SetConsoleWindowInfo(hConsole, TRUE, &srWindowRect);
X PERR(bSuccess, "SetConsoleWindowInfo");
X }
X /* if the current buffer *is* the size we want, don't do anything! */
X return;
X}
X
Xvoid mch_set_winsize()
X{
X resizeConBufAndWindow(hConOut, Columns, Rows);
X}
X
Xint call_shell(cmd, filter, cooked)
X char *cmd;
X int filter; /* if != 0: called by dofilter() */
X int cooked;
X{
X int x;
X char newcmd[200];
X
X flushbuf();
X
X if (cooked)
X settmode(0); /* set to cooked mode */
X
X if (cmd == NULL)
X x = system(p_sh);
X else { /* we use "command" to start the shell, slow
X * but easy */
X sprintf(newcmd, "%s /c %s", p_sh, cmd);
X x = system(newcmd);
X }
X outchar('\n');
X if (cooked)
X settmode(1); /* set to raw mode */
X
X#ifdef WEBB_COMPLETE
X if (x && !expand_interactively)
X#else
X if (x)
X#endif
X {
X smsg("%d returned", x);
X outchar('\n');
X }
X resettitle();
X return x;
X}
X
X#define FL_CHUNK 32
X
Xstatic void addfile(fl, f, isdir)
X FileList *fl;
X char *f;
X int isdir;
X{
X char *p;
X
X if (!fl->file) {
X fl->file = (char **) alloc(sizeof(char *) * FL_CHUNK);
X if (!fl->file)
X return;
X fl->nfiles = 0;
X fl->maxfiles = FL_CHUNK;
X }
X if (fl->nfiles >= fl->maxfiles) {
X char **t;
X int i;
X
X t = (char **) lalloc(sizeof(char *) * (fl->maxfiles + FL_CHUNK), TRUE);
X if (!t)
X return;
X for (i = fl->nfiles - 1; i >= 0; i--)
X t[i] = fl->file[i];
X free(fl->file);
X fl->file = t;
X fl->maxfiles += FL_CHUNK;
X }
X p = alloc((unsigned) (strlen(f) + 1 + isdir));
X if (p) {
X strcpy(p, f);
X if (isdir)
X strcat(p, "/");
X }
X fl->file[fl->nfiles++] = p;
X}
X
Xstatic int pstrcmp(a, b)
X char **a,
X **b;
X{
X return (strcmp(*a, *b));
X}
X
Xint has_wildcard(s)
X char *s;
X{
X if (s)
X for (; *s; ++s)
X if (*s == '?' || *s == '*')
X return 1;
X return 0;
X}
X
Xstatic void strlowcpy(d, s)
X char *d,
X *s;
X{
X while (*s)
X *d++ = tolower(*s++);
X *d = '\0';
X}
X
Xstatic int expandpath(fl, path, fonly, donly, notf)
X FileList *fl;
X char *path;
X int fonly,
X donly,
X notf;
X{
X char buf[MAX_PATH];
X char *p,
X *s,
X *e;
X int lastn,
X c = 1,
X r;
X WIN32_FIND_DATA fb;
X HANDLE hFind;
X
X lastn = fl->nfiles;
X
X/*
X * Find the first part in the path name that contains a wildcard.
X * Copy it into buf, including the preceding characters.
X */
X p = buf;
X s = NULL;
X e = NULL;
X while (*path) {
X if (*path == '\\' || *path == ':' || *path == '/') {
X if (e)
X break;
X else
X s = p;
X }
X if (*path == '*' || *path == '?')
X e = p;
X *p++ = *path++;
X }
X e = p;
X if (s)
X s++;
X else
X s = buf;
X
X /* now we have one wildcard component between s and e */
X *e = '\0';
X r = 0;
X /* If we are expanding wildcards we try both files and directories */
X if ((hFind = FindFirstFile(buf, &fb)) == INVALID_HANDLE_VALUE) {
X /* not found */
X strcpy(e, path);
X if (notf)
X addfile(fl, buf, FALSE);
X return 1; /* unexpanded or empty */
X }
X while (c) {
X strlowcpy(s, fb.cFileName);
X if (*s != '.' || (s[1] != '\0' && (s[1] != '.' || s[2] != '\0'))) {
X strcat(buf, path);
X if (!has_wildcard(path))
X addfile(fl, buf, (isdir(buf) > 0));
X else
X r |= expandpath(fl, buf, fonly, donly, notf);
X }
X c = FindNextFile(hFind, &fb);
X }
X qsort(fl->file + lastn, fl->nfiles - lastn, sizeof(char *), pstrcmp);
X FindClose(hFind);
X return r;
X}
X
X/*
X * MSDOS rebuilt of Scott Ballantynes ExpandWildCard for amiga/arp.
X * jw
X */
X
Xint ExpandWildCards(num_pat, pat, num_file, file, files_only, list_notfound)
X int num_pat;
X char **pat;
X int *num_file;
X char ***file;
X int files_only,
X list_notfound;
X{
X int i,
X r = 0;
X FileList f;
X
X f.file = NULL;
X f.nfiles = 0;
X for (i = 0; i < num_pat; i++) {
X if (!has_wildcard(pat[i]))
X addfile(&f, pat[i], files_only ? FALSE : (isdir(pat[i]) > 0));
X else
X r |= expandpath(&f, pat[i], files_only, 0, list_notfound);
X }
X if (r == 0) {
X *num_file = f.nfiles;
X *file = f.file;
X } else {
X *num_file = 0;
X *file = NULL;
X }
X return (r ? FAIL : OK);
X}
X
Xvoid FreeWild(num, file)
X int num;
X char **file;
X{
X if (file == NULL || num <= 0)
X return;
X while (num--)
X free(file[num]);
X free(file);
X}
X
X/*
X * The normal chdir() does not change the default drive.
X * This one does.
X */
X#undef chdir
Xint vim_chdir(path)
X char *path;
X{
X if (path[0] == NUL) /* just checking... */
X return FAIL;
X if (path[1] == ':') { /* has a drive name */
X if (_chdrive(toupper(path[0]) - 'A' + 1))
X return -1; /* invalid drive name */
X path += 2;
X }
X if (*path == NUL) /* drive name only */
X return OK;
X return _chdir(path); /* let the normal chdir() do the rest */
X}
X
Xclrscr()
X{
X int count;
X
X ntcoord.X = 0;
X ntcoord.Y = 0;
X FillConsoleOutputCharacter(hConOut, ' ', Columns * Rows,
X ntcoord, &count);
X FillConsoleOutputAttribute(hConOut, DefaultAttribute, Rows * Columns,
X ntcoord, &count);
X}
X
Xclreol()
X{
X int count;
X FillConsoleOutputCharacter(hConOut, ' ',
X Columns - ntcoord.X,
X ntcoord, &count);
X FillConsoleOutputAttribute(hConOut, DefaultAttribute,
X Columns - ntcoord.X,
X ntcoord, &count);
X}
X
Xinsline(int count)
X{
X SMALL_RECT source,
X clip;
X COORD dest;
X CHAR_INFO fill;
X
X dest.X = 0;
X dest.Y = ntcoord.Y + count;
X
X source.Left = 0;
X source.Top = ntcoord.Y;
X source.Right = Columns;
X source.Bottom = Rows - 1;
X
X fill.Char.AsciiChar = ' ';
X fill.Attributes = DefaultAttribute;
X
X ScrollConsoleScreenBuffer(hConOut, &source, (PSMALL_RECT) 0, dest,
X &fill);
X}
X
Xdelline(int count)
X{
X SMALL_RECT source,
X clip;
X COORD dest;
X CHAR_INFO fill;
X
X dest.X = 0;
X dest.Y = ntcoord.Y;
X
X source.Left = 0;
X source.Top = ntcoord.Y + count;
X source.Right = Columns;
X source.Bottom = Rows - 1;
X
X /* get current attributes and fill out CHAR_INFO structure for fill char */
X fill.Char.AsciiChar = ' ';
X fill.Attributes = DefaultAttribute;
X
X ScrollConsoleScreenBuffer(hConOut, &source, (PSMALL_RECT) 0, dest,
X &fill);
X}
X
X
Xscroll()
X{
X SMALL_RECT source,
X clip;
X COORD dest;
X CHAR_INFO fill;
X
X dest.X = 0;
X dest.Y = 0;
X
X source.Left = 0;
X source.Top = 1;
X source.Right = Columns;
X source.Bottom = Rows - 1;
X
X /* get current attributes and fill out CHAR_INFO structure for fill char */
X fill.Char.AsciiChar = ' ';
X fill.Attributes = DefaultAttribute;
X
X ScrollConsoleScreenBuffer(hConOut, &source, (PSMALL_RECT) 0, dest,
X &fill);
X}
X
Xgotoxy(x, y)
X register int x,
X y;
X{
X ntcoord.X = x - 1;
X ntcoord.Y = y - 1;
X SetConsoleCursorPosition(hConOut, ntcoord);
X}
X
Xnormvideo()
X{
X int count;
X WORD attr = DefaultAttribute;
X
X SetConsoleTextAttribute(hConOut, attr);
X}
X
Xtextattr(int attr)
X{
X int count;
X WORD attrw = attr;
X
X SetConsoleTextAttribute(hConOut, attr);
X}
X
Xputch(char c)
X{
X int count;
X
X WriteConsole(hConOut, &c, 1, &count, 0);
X ntcoord.X += count;
X}
X
Xdelay(x)
X{
X Sleep(x);
X}
X
Xsleep(x)
X{
X Sleep(x * 1000);
X}
X
Xvbell()
X{
X COORD origin = {0, 0};
X WORD flash = ~DefaultAttribute & 0xff;
X WORD off = DefaultAttribute;
X
X int count;
X LPWORD oldattrs = alloc(Rows * Columns * sizeof(WORD));
X
X ReadConsoleOutputAttribute(hConOut, oldattrs, Rows * Columns, origin,
X &count);
X FillConsoleOutputAttribute(hConOut, flash, Rows * Columns, origin,
X &count);
X WriteConsoleOutputAttribute(hConOut, oldattrs, Rows * Columns, origin,
X &count);
X free(oldattrs);
X}
X
Xcursor_visible(int visible)
X{
X CONSOLE_CURSOR_INFO cci;
X
X cci.bVisible = visible ? TRUE : FALSE;
X cci.dwSize = 100; /* 100 percent cursor */
X SetConsoleCursorInfo(hConOut, &cci);
X}
X
Xvoid set_window(void)
X{
X}
X
X/*
X * check for an "interrupt signal": CTRL-break or CTRL-C
X */
Xvoid breakcheck()
X{
X if (ctrlc_pressed) {
X ctrlc_pressed = FALSE;
X got_int = TRUE;
X }
X}
X
X long
Xmch_avail_mem(special)
X int special;
X{
X return 0x7fffffff; /* virual memory eh */
X}
X
X/*
X * return non-zero if a character is available
X */
X int
Xmch_char_avail()
X{
X return WaitForChar(0);
X}
X
X/*
X * set screen mode, always fails.
X */
X int
Xmch_screenmode(arg)
X char_u *arg;
X{
X EMSG("Screen mode setting not supported");
X return FAIL;
X}
END_OF_FILE
if test 31469 -ne `wc -c <'vim/src/winnt.c'`; then
echo shar: \"'vim/src/winnt.c'\" unpacked with wrong size!
fi
# end of 'vim/src/winnt.c'
fi
echo shar: End of archive 16 \(of 26\).
cp /dev/null ark16isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 26 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still must unpack the following archives:
echo " " ${MISSING}
fi
exit 0
exit 0 # Just in case...