home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume44 / vim / part20 < prev    next >
Encoding:
Internet Message Format  |  1994-08-18  |  68.8 KB

  1. From: mool@oce.nl (Bram Moolenaar)
  2. Newsgroups: comp.sources.misc
  3. Subject: v44i039:  vim - Vi IMproved editor, v3.0, Part20/26
  4. Date: 18 Aug 1994 14:03:22 -0500
  5. Organization: Sterling Software
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <330b9q$e7e@sparky.sterling.com>
  9. X-Md4-Signature: c7249aeedf0ac6889a8dac0c39ac24f0
  10.  
  11. Submitted-by: mool@oce.nl (Bram Moolenaar)
  12. Posting-number: Volume 44, Issue 39
  13. Archive-name: vim/part20
  14. Environment: UNIX, AMIGA, MS-DOS, Windows NT
  15. Supersedes: vim: Volume 41, Issue 50-75
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  vim/doc/windows.doc vim/doc/winnt.doc vim/src/globals.h
  22. #   vim/src/msdos.c vim/todo
  23. # Wrapped by kent@sparky on Mon Aug 15 21:44:11 1994
  24. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  25. echo If this archive is complete, you will see the following message:
  26. echo '          "shar: End of archive 20 (of 26)."'
  27. if test -f 'vim/doc/windows.doc' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'vim/doc/windows.doc'\"
  29. else
  30.   echo shar: Extracting \"'vim/doc/windows.doc'\" \(15407 characters\)
  31.   sed "s/^X//" >'vim/doc/windows.doc' <<'END_OF_FILE'
  32. XEditing with multiple windows and buffers.
  33. X
  34. XExplained here are commands have been added to use multiple windows and
  35. Xbuffers. Additionally there are explanations for commands that work different
  36. Xwhen used in combination with more than one window.
  37. X
  38. X
  39. XA window is a viewport onto a buffer. You can use multiple windows on one
  40. Xbuffer. Or several windows on different buffers.
  41. X
  42. XA buffer is a file loaded into memory for editing. The original file remains
  43. Xunchanged until you write the buffer to the file.
  44. X
  45. XA buffer can be in one of three states:
  46. X
  47. Xactive:   The buffer is displayed in a window. If there is a file for this
  48. X      buffer it has been read into the buffer. The buffer may have been
  49. X      modified.
  50. Xhidden:   The buffer is not displayed. If there is a file for this buffer it
  51. X          has been read into the buffer. The buffer may have been modified.
  52. Xinactive: The buffer is not displayed and does not contain anything. Options
  53. X          for the buffer are remembered if the file was once loaded.
  54. X
  55. XIn a table:
  56. X
  57. Xstate        displayed    loaded        :buffers
  58. X        in window             shows
  59. Xactive          yes         yes          ' '
  60. Xhidden          no         yes          'h'
  61. Xinactive      no         no          '-'
  62. X
  63. X
  64. XStarting Vim
  65. X-----------
  66. X
  67. XBy default Vim starts with one window, just like vi.
  68. X
  69. XThe "-o" command line argument can be used to open a window for each file in
  70. Xthe argument list: "Vim -o file1 file2 file3" will open three windows.
  71. X
  72. X"-oN", where N is a decimal number, opens N windows. If there are more file
  73. Xnames than windows, only N windows are opened, some files do not get a window.
  74. XIf there are more windows than file names, the last few windows will be
  75. Xediting empty buffers.
  76. X
  77. XIf there are many file names the windows will become very small. You might
  78. Xwant to set the 'winheight' option to create a workable situation.
  79. X
  80. X
  81. XOpening a new window
  82. X--------------------
  83. X
  84. XCTRL-W s
  85. XCTRL-W S
  86. XCTRL-W CTRL-S
  87. X:[N]split
  88. X        Split current window in two. The result is two viewports on
  89. X        the same file. Make new window N high (default is to use half
  90. X        the height of the current window). Reduces the current window
  91. X        height to create room (and others, if the 'equalalways' option
  92. X        is set).
  93. X
  94. XCTRL-W n
  95. XCTRL-W CTRL_N
  96. X:[N]new
  97. X        Create a new window and start editing an empty file in it.
  98. X        Make new window N high (default is to use half the existing
  99. X        height). Reduces the current window height to create room (and
  100. X        others, if the 'equalalways' option is set). 
  101. X
  102. X:[N]new [+command] fname
  103. X:[N]split [+command] fname
  104. X        Create a new window and start editing file fname in it. If
  105. X        [+command] is given, execute the command when the file has
  106. X        been loaded. Make new window N high (default is to use half
  107. X        the existing height). Reduces the current window height to
  108. X        create room (and others, if the 'equalalways' option is set).
  109. X
  110. X
  111. XClosing a window
  112. X----------------
  113. X
  114. XCTRL-W q
  115. XCTRL-W CTRL-Q
  116. X:quit        Quit current window, unless the buffer was changed and there
  117. X        are no other windows for this buffer. When quitting the last
  118. X        window, exit Vim.
  119. X
  120. X:quit!        Quit current window. If this was the last window for a buffer,
  121. X        any changes to that buffer are lost. When quitting the last
  122. X        window, exit Vim. 
  123. X
  124. XCTRL-W c
  125. X:close        Quit current window, unless it is the last window on the
  126. X        screen. The buffer becomes hidden (unless there is another
  127. X        window editing it). (Note: CTRL-W CTRL-C does not work).
  128. X
  129. XCTRL-W o
  130. XCTRL-W CTRL-O
  131. X:only        Make the current window the only one on the screen. All other
  132. X        windows are closed. All buffers in the other windows become
  133. X        hidden.
  134. X
  135. X
  136. XMoving the cursor to other windows
  137. X----------------------------------
  138. X
  139. XCTRL-W <CURSOR_DOWN>
  140. XCTRL-W CTRL-J
  141. XCTRL-W j    move cursor to Nth window below current one.
  142. X
  143. XCTRL-W <CURSOR_UP>
  144. XCTRL-W CTRL-K
  145. XCTRL-W k    move cursor to Nth window above current one.
  146. X
  147. XCTRL-W w
  148. XCTRL-W CTRL-W    Without count: move cursor to window below current one. If
  149. X        there is no window below, go to upper window.
  150. X        With count: go to Nth window.
  151. X
  152. XCTRL-W p
  153. XCTRL-W CTRL-P    go to previous (last accessed) window.
  154. X
  155. X
  156. XMoving windows around
  157. X---------------------
  158. X
  159. XCTRL-W r
  160. XCTRL-W CTRL-R    Rotate windows downwards. The first window becomes the second
  161. X        one, the second one the third one, etc. The last window
  162. X        becomes the first window. The cursor remains in the same
  163. X        window.
  164. X
  165. XCTRL-W R    Rotate windows upwards. The second window becomes the first
  166. X        one, the third one the second one, etc. The first window
  167. X        becomes the last window. The cursor remains in the same
  168. X        window.
  169. X
  170. XCTRL-W x
  171. XCTRL-W CTRL-X    Without count: Exchange current window with next one. If there
  172. X        is no next window, exchange with previous window. With count:
  173. X        Exchange current window with Nth window (first window is 1).
  174. X        The cursor is put in the other window.
  175. X
  176. X
  177. XWindow resizing
  178. X---------------
  179. X
  180. XCTRL-W =    make all windows (almost) equal high.
  181. X
  182. X:resize -N
  183. XCTRL-W -    decrease current window height by N
  184. X
  185. X:resize +N
  186. XCTRL-W +    increase current window height by N
  187. X
  188. X:resize [N]
  189. XCTRL-W CTRL-_
  190. XCTRL-W _    set current window height to N (default: highest possible)
  191. X
  192. Xz<nr><CR>    set current window height to nr
  193. X
  194. XThe option 'winheight' ('wh') is used to set the minimal window height of the
  195. Xcurrent window. This option is used each time another window becomes the
  196. Xcurrent window. If the option is '0' it is disabled. Set 'winheight' to a very
  197. Xlarge value, e.g. '9999', to make the current window always fill all available
  198. Xspace. Set it to a reasonable value, e.g. '10', to make editing in the current
  199. Xwindow comfortable.
  200. X
  201. XWhen the option 'equalalways' ('ea') is set all the windows are automatically
  202. Xmade the same size after splitting or closing a window. If you don't set this
  203. Xoption, splitting a window will reduce the size of the current window and
  204. Xleave the other windows the same. When closing a window the extra lines are
  205. Xgiven the the window above it.
  206. X
  207. XThe option 'commandheight' ('ch') is used to set the height of the command
  208. Xline. If you are annoyed by the "hit return to continue" questions for long
  209. Xmessages, set this option to 2 or 3.
  210. X
  211. XIf there is only one window, resizing that window will also change the command
  212. Xline height. If there are several windows, resizing the current window will
  213. Xalso change the height of the window below it (and sometimes the window above
  214. Xit).
  215. X
  216. X
  217. XExiting Vim with multiple windows or buffers
  218. X--------------------------------------------
  219. X
  220. X:qall        Exit Vim, unless there are some buffers which have been
  221. X        changed. (Use :bmod to go to the next modified buffer).
  222. X
  223. X:qall!        Exit Vim. Any changes to buffers are lost.
  224. X
  225. X:wqall
  226. X:xall        Write all changed buffers and exit Vim. If there are buffers
  227. X        without a file name, which are readonly or cannot be written
  228. X        for another reason, Vim is not quit. 
  229. X
  230. X:wqall!
  231. X:xall!        Write all changed buffers, also the ones that are readonly,
  232. X        and exit Vim. If there are buffers without a file name or
  233. X        cannot be written for another reason, Vim is not quit. 
  234. X
  235. X
  236. XWriting with multiple buffers
  237. X-----------------------------
  238. X
  239. X:wall        Write all changed buffers. Buffers without a file name or
  240. X        which are readonly are not written.
  241. X
  242. X:wall!        Write all changed buffers, also the ones that are readonly.
  243. X        Buffers without a file name are not written.
  244. X
  245. X
  246. XOverview of argument and buffer list commands
  247. X---------------------------------------------
  248. X
  249. X   args list            buffer list        meaning
  250. X1. :[N]argument [N]    11. :[N]buffer [N]    to arg/buf N
  251. X2. :[N]next [file ..]    12. :[N]bnext [N]    to Nth next arg/buf
  252. X3. :[N]Next [N]        13. :[N]bNext [N]    to Nth previous arg/buf
  253. X4. :[N]previous    [N]    14. :[N]bprevious [N]    to Nth previous arg/buf
  254. X5. :rewind        15. :brewind        to first arg/buf
  255. X6. :last        16. :blast        to last arg/buf
  256. X7. :all            17. :ball        edit all args/buffers
  257. X            18. :unhide        edit all loaded buffers
  258. X            19. :[N]bmod [N]    to Nth modified buf
  259. X
  260. X split & args list      split & buffer list     meaning                   
  261. X21. :[N]sargument [N]   31. :[N]sbuffer [N]    split + to arg/buf N           
  262. X22. :[N]snext [file ..] 32. :[N]sbnext [N]      split + to Nth next arg/buf    
  263. X23. :[N]sNext [N]       33. :[N]sbNext [N]      split + to Nth previous arg/buf
  264. X24. :[N]sprevious [N]   34. :[N]sbprevious [N]  split + to Nth previous arg/buf
  265. X25. :srewind            35. :sbrewind           split + to first arg/buf       
  266. X26. :slast              36. :sblast             split + to last arg/buf        
  267. X27. :sall        37: :sball        edit all args/buffers
  268. X            38. :sunhide        edit all loaded buffers
  269. X                        39. :[N]sbmod [N]       split + to Nth modified buf    
  270. X
  271. X40.    :args            list of arguments
  272. X41.    :buffers        list of buffers
  273. X
  274. XThe meaning of [N] depends on the command:
  275. X[N] is number of buffers to go forward/backward on ?2, ?3, ?4
  276. X[N] is an argument number, defaulting to current argument, for 1, 21
  277. X[N] is a buffer number, defaulting to current buffer, for 11, 31
  278. X[N] is a count for 17, 39
  279. X
  280. XNote: ":next" is an exception, because it must accept a list of file names
  281. Xfor compatibility with vi.
  282. X
  283. X
  284. XThe argument list and multiple windows
  285. X--------------------------------------
  286. X
  287. XThe current position in the argument list can be different for each window.
  288. XRemember that when doing ":e file" the position in the argument list stays
  289. Xthe same, but you are not editing the file at that position. Thus the
  290. Xmessage (file N of M) may be misleading (this is inherited from vi).
  291. X
  292. XAll the entries in the argument list are added to the buffer list. Thus you
  293. Xcan also get to them with the buffer list commands, like ":bnext".
  294. X
  295. X:all
  296. X:sall        Rearrange the screen to open one window for each argument.
  297. X        All other windows are closed (buffers become hidden).
  298. X
  299. X:[N]sargument[!] [N]
  300. X        Short for ":split | argument [N]": split window and go to
  301. X        Nth argument. But when there is no such argument, of the
  302. X        current file cannot be abandoned, the window is not split.
  303. X
  304. X:[N]snext[!] [file ..]
  305. X        Short for ":split | [N]next": split window and go to Nth
  306. X        next argument. But when there is no next file, or the
  307. X        current file cannot be abandoned, the window is not split.
  308. X
  309. X:[N]sprevious[!] [N]
  310. X:[N]sNext[!] [N]
  311. X        Short for ":split | Next": split window and go to Nth
  312. X        previous argument. But when there is no previous file, or
  313. X        the current file cannot be abandoned, the window is not
  314. X        split.
  315. X
  316. X:srewind[!]    Short for ":split | rewind": split window and go to first
  317. X        argument. But when the current file cannot be abandoned the
  318. X        window is not split.
  319. X
  320. X:slast[!]    Short for ":split | last": split window and go to last
  321. X        argument. But when the current file cannot be abandoned the
  322. X        window is not split.
  323. X
  324. X
  325. XTag or file name under the cursor
  326. X---------------------------------
  327. X
  328. XCTRL-W ]
  329. XCTRL-W CTRL-]    split current window in two. Use identifier under cursor as a
  330. X        tag and jump to it in the new upper window. Make new window N
  331. X        high.
  332. X
  333. XCTRL-W f
  334. XCTRL-W CTRL-F    split current window in two. Edit file name under cursor. Like
  335. X        ":split ]f", but window isn't split if the file does not exist.
  336. X
  337. X
  338. XUsing hidden buffers
  339. X--------------------
  340. X
  341. XA hidden buffer is not displayed in a window, but is still loaded into memory.
  342. XThis makes it possible to jump from file to file, without the need to read or
  343. Xwrite the file every time, and having to keep the file in a window.
  344. X
  345. XIf the option 'hidden' ('hid') is set, abandoned buffers are kept for all
  346. Xcommands that start editing another file: ":edit", ":next", ":tag", etc. The
  347. Xcommands that move through the buffer list make the current buffer hidden
  348. Xalthough the 'hidden' option is not set (see below).
  349. X
  350. XYou can make a hidden buffer not hidden, by starting to edit it with any
  351. Xcommand. Or by deleting it with the ":bdelete" command.
  352. X
  353. X:files
  354. X:buffers    Show all buffers. Example:
  355. X
  356. X            1 #h  "/test/text" line 1
  357. X            2  -  "asdf" line 0
  358. X            3 % + "version.c" line 1
  359. X
  360. X        Each buffer has a unique number. That number will not change,
  361. X        so you can always go to a specific buffer with ":buffer N" or
  362. X        "N CTRL-^", where N is the buffer number.
  363. X
  364. X         '-' indicates a buffer that is not loaded. 'h' indicates a
  365. X        hidden buffer: It is loaded, but currently not displayed in a
  366. X        window. '%' indicates the buffer in the current window. '#'
  367. X        indicates the alternate buffer for ":e #" or CTRL-^. '+'
  368. X        indicates a modified buffer.
  369. X
  370. X:[N]bdelete
  371. X:bdelete [N]
  372. X        Unload buffer [N] (default: current buffer) and delete it from
  373. X        the buffer list. If the buffer was changed this fails. The
  374. X        file remains unaffected. If buffer [N] is the current buffer,
  375. X        the next buffer becomes the current buffer.
  376. X
  377. X:[N]bdelete!
  378. X:bdelete! [N]
  379. X        Unload buffer [N] (default: current buffer) and delete it from
  380. X        the buffer list. If the buffer was changed the changes are
  381. X        lost. The file remains unaffected. If buffer [N] is the
  382. X        current buffer, the next buffer becomes the current buffer.
  383. X
  384. X:N,Mbdelete[!]    do :bdelete[!] for all buffers in the range N to M (inclusive).
  385. X
  386. X:bdelete[!] N1 N2 ..
  387. X        do :bdelete[!] for buffer N1, N2, etc.
  388. X
  389. X:[N]bunload
  390. X:bunload [N]
  391. X        Unload buffer [N] (default: current buffer). The memory
  392. X        allocated for this buffer will be freed. The buffer remains in
  393. X        the buffer list. If the buffer was changed this fails. If
  394. X        buffer [N] is the current buffer, the next buffer becomes the
  395. X        current buffer.
  396. X
  397. X:[N]bunload!
  398. X:bunload! [N]
  399. X        Unload buffer [N] (default: current buffer). The memory
  400. X        allocated for this buffer will be freed. The buffer remains in
  401. X        the buffer list. If the buffer was changed the changes are
  402. X        lost. If buffer [N] is the current buffer, the next buffer
  403. X        becomes the current buffer.
  404. X
  405. X:N,Mbunload[!]    do :bunload[!] for all buffers in the range N to M (inclusive).
  406. X
  407. X:bunload[!] N1 N2 ..
  408. X        do :bunload[!] for buffer N1, N2, etc.
  409. X
  410. X:[N]buffer [N]
  411. X        Edit buffer [N] from the buffer list. If [N] is not given, the
  412. X        current buffer remains being edited.
  413. X
  414. X:[N]bnext [N]    Go to [N]th next buffer in buffer list. [N] defaults to one.
  415. X
  416. X:[N]bNext [N]
  417. X:[N]bprev [N]    Go to [N]th previous buffer in buffer list. [N] defaults to
  418. X        one.
  419. X
  420. X:brewind    Go to first buffer in buffer list
  421. X
  422. X:blast        Go to last buffer in buffer list
  423. X
  424. X:[N]bmodified [N]
  425. X        Go to [N]th next modified buffer in buffer list
  426. X
  427. X:[N]sbuffer [N]
  428. X        split window and Edit buffer [N] from the buffer list. If [N]
  429. X        is not given, the current buffer is edited.
  430. X
  431. X:[N]sbnext [N]    split window and go to [N]th next buffer in buffer list
  432. X
  433. X:[N]sbNext [N]
  434. X:[N]sbprev [N]    split window and go to [N]th previous buffer in buffer list
  435. X
  436. X:sbrewind    split window and go to first buffer in buffer list
  437. X
  438. X:sblast        split window and go to last buffer in buffer list
  439. X
  440. X:[N]sbmodified [N]
  441. X        split window and go to [N]th next modified buffer in buffer list
  442. X
  443. X:unhide
  444. X:sunhide    Rearrange the screen to open one window for each loaded
  445. X        buffer in the buffer list.
  446. X
  447. X:ball
  448. X:sball        Rearrange the screen to open one window for each buffer in
  449. X        the buffer list.
  450. X
  451. X
  452. XMemory usage limits
  453. X-------------------
  454. X
  455. XThe option 'maxmem' ('mm') is used to set the maximal memory used for one
  456. Xbuffer (in Kbyte). 'maxmemtot' is used to set the maximal memory used for all
  457. Xbuffers (in Kbyte). The defaults depend on the system used. For the Amiga and
  458. XMSDOS 'maxmemtot' is set depending on the amount of memory available. If you
  459. Xdon't like Vim to swap to a file, set 'maxmem' and 'maxmemtot' to a very large
  460. Xvalue. The swap file will then only be used for recovery. If you don't want a
  461. Xswap file at all, set 'updatecount' to 0, or use the "-n" argument when
  462. Xstarting Vim. Note that the 'maxmem' option is only used when a buffer is
  463. Xcreated. Changing this option does not affect buffers that have already been
  464. Xloaded. Thus you can set it to different values for different files.
  465. X'maxmemtot' works always.
  466. END_OF_FILE
  467.   if test 15407 -ne `wc -c <'vim/doc/windows.doc'`; then
  468.     echo shar: \"'vim/doc/windows.doc'\" unpacked with wrong size!
  469.   fi
  470.   # end of 'vim/doc/windows.doc'
  471. fi
  472. if test -f 'vim/doc/winnt.doc' -a "${1}" != "-c" ; then 
  473.   echo shar: Will not clobber existing file \"'vim/doc/winnt.doc'\"
  474. else
  475.   echo shar: Extracting \"'vim/doc/winnt.doc'\" \(419 characters\)
  476.   sed "s/^X//" >'vim/doc/winnt.doc' <<'END_OF_FILE'
  477. XThe Windows NT port of Vim has not been tested very much. Be prepared to run
  478. Xinto some problems in the NT specific parts.
  479. X
  480. XKnown problems:
  481. X
  482. XDisplay is not always correct. Type CTRL-L to fix this.
  483. X
  484. XCTRL-C in a child shell (created with ":sh" or CTRL-Z) kills Vim. Hopefully
  485. Xthe recovery mechanism will get your file back, but don't rely on this.
  486. X
  487. XThe Windows NT port was done by Roger Knobbe <RogerK@po.wonderware.com>.
  488. END_OF_FILE
  489.   if test 419 -ne `wc -c <'vim/doc/winnt.doc'`; then
  490.     echo shar: \"'vim/doc/winnt.doc'\" unpacked with wrong size!
  491.   fi
  492.   # end of 'vim/doc/winnt.doc'
  493. fi
  494. if test -f 'vim/src/globals.h' -a "${1}" != "-c" ; then 
  495.   echo shar: Will not clobber existing file \"'vim/src/globals.h'\"
  496. else
  497.   echo shar: Extracting \"'vim/src/globals.h'\" \(10417 characters\)
  498.   sed "s/^X//" >'vim/src/globals.h' <<'END_OF_FILE'
  499. X/* vi:ts=4:sw=4
  500. X *
  501. X * VIM - Vi IMproved        by Bram Moolenaar
  502. X *
  503. X * Read the file "credits.txt" for a list of people who contributed.
  504. X * Read the file "uganda.txt" for copying and usage conditions.
  505. X */
  506. X
  507. X/*
  508. X * definition of global variables
  509. X *
  510. X * EXTERN is only defined in main.c (and in param.h)
  511. X */
  512. X
  513. X#ifndef EXTERN
  514. X# define EXTERN extern
  515. X# define INIT(x)
  516. X#else
  517. X# ifndef INIT
  518. X#  define INIT(x) x
  519. X# endif
  520. X#endif
  521. X
  522. X/*
  523. X * Number of Rows and Columns in the screen.
  524. X * Must be long to be able to use them as options in param.c.
  525. X */
  526. XEXTERN long        Rows;
  527. XEXTERN long        Columns;
  528. X
  529. X/*
  530. X * Cmdline_row is the row where the command line starts, just below the
  531. X * last window.
  532. X * When the cmdline gets longer than the available space the screen gets
  533. X * scrolled up. After a CTRL-D (show matches), after hitting ':' after
  534. X * "hit return", and for the :global command, the command line is
  535. X * temporaraly moved. The old position is restored with the next call to
  536. X * updateScreen().
  537. X */
  538. XEXTERN int        cmdline_row;
  539. X
  540. XEXTERN int        redraw_cmdline INIT(= FALSE);    /* cmdline must be redrawn */
  541. XEXTERN int        clear_cmdline INIT(= FALSE);    /* cmdline must be cleared */
  542. X
  543. X#ifdef WEBB_COMPLETE
  544. X/*
  545. X * used for completion on the command line
  546. X */
  547. XEXTERN int        expand_context INIT(= CONTEXT_UNKNOWN);
  548. XEXTERN char_u    *expand_pattern INIT(= NULL);
  549. XEXTERN int        expand_interactively INIT(= FALSE);
  550. X#endif /* WEBB_COMPLETE */
  551. X
  552. X/*
  553. X * Functions for putting characters in the command line,
  554. X * while keeping NextScreen updated.
  555. X */
  556. XEXTERN int        msg_col;
  557. XEXTERN int        msg_row;
  558. XEXTERN int        msg_scrolled; 
  559. XEXTERN char_u    *keep_msg;                    /* message to be shown after redraw */
  560. XEXTERN int        msg_highlight INIT(= FALSE);/* message should be highlighted */
  561. XEXTERN char_u    *highlight INIT(= NULL);    /* string for start of highlighting */
  562. XEXTERN char_u    *unhighlight INIT(= NULL);    /* string for end of highlighting */
  563. XEXTERN int        scroll_region INIT(= FALSE);/* terminal supports scroll region */
  564. X
  565. X/*
  566. X * All windows are linked in a list. firstwin points to the first entry, lastwin
  567. X * to the last entry (can be the same as firstwin) and curwin to the currently
  568. X * active window.
  569. X */
  570. XEXTERN WIN        *firstwin;        /* first window */
  571. XEXTERN WIN        *lastwin;        /* last window */
  572. XEXTERN WIN        *curwin;        /* currently active window */
  573. X
  574. X/*
  575. X * All buffers are linked in a list. 'firstbuf' points to the first entry,
  576. X * 'lastbuf' to the last entry and 'curbuf' to the currently active buffer.
  577. X */
  578. XEXTERN BUF        *firstbuf INIT(= NULL);    /* first buffer */
  579. XEXTERN BUF        *lastbuf INIT(= NULL);    /* last buffer */
  580. XEXTERN BUF        *curbuf INIT(= NULL);    /* currently active buffer */
  581. X
  582. X/*
  583. X * list of files being edited (argument list)
  584. X */
  585. XEXTERN char_u    **arg_files;    /* list of files */
  586. XEXTERN int        arg_count;         /* number of files */
  587. XEXTERN int        arg_exp;        /* when TRUE arg_files must be freed */
  588. X
  589. XEXTERN int        ru_col;            /* column for ruler */
  590. XEXTERN int        sc_col;            /* column for shown command */
  591. X
  592. X/*
  593. X * When starting or exiting some things are done differently (e.g. screen
  594. X * updating).
  595. X */
  596. XEXTERN int        starting INIT(= TRUE);
  597. X                                /* set to FALSE when starting up finished */
  598. XEXTERN int        exiting INIT(= FALSE);
  599. X                                /* set to TRUE when abandoning Vim */
  600. X
  601. XEXTERN int        secure INIT(= FALSE);
  602. X                                /* set to TRUE when only "safe" commands are 
  603. X                                 * allowed, e.g. when sourcing .exrc or .vimrc
  604. X                                 * in current directory */
  605. X
  606. XEXTERN FPOS     VIsual;         /* start position of Visual
  607. X                                 * (VIsual.lnum == 0 when not active) */
  608. XEXTERN int        Visual_block INIT(= FALSE);
  609. X                                /* Visual is blockwise */
  610. X
  611. XEXTERN FPOS     Insstart;        /* This is where the latest insert/append
  612. X                                 * mode started. */
  613. X
  614. X/*
  615. X * This flag is used to make auto-indent work right on lines where only a
  616. X * <RETURN> or <ESC> is typed. It is set when an auto-indent is done, and
  617. X * reset when any other editting is done on the line. If an <ESC> or <RETURN>
  618. X * is received, and did_ai is TRUE, the line is truncated.
  619. X */
  620. XEXTERN int               did_ai INIT(= FALSE);
  621. X
  622. X/*
  623. X * This flag is set when a smart indent has been performed. When the next typed
  624. X * character is a '{' the inserted tab will be deleted again.
  625. X */
  626. XEXTERN int                did_si INIT(= FALSE);
  627. X
  628. X/*
  629. X * This flag is set after an auto indent. If the next typed character is a '}'
  630. X * one indent character will be removed.
  631. X */
  632. XEXTERN int                can_si INIT(= FALSE);
  633. X
  634. XEXTERN int                old_indent INIT(= 0); /* for ^^D command in insert mode */
  635. X
  636. X/*
  637. X * This flag is set after doing a reverse replace in column 0.
  638. X * An extra space has been inserted in column 0.
  639. X */
  640. XEXTERN int                extraspace INIT(= FALSE);
  641. X
  642. XEXTERN int        State INIT(= NORMAL);    /* This is the current state of the command
  643. X                                         * interpreter. */
  644. X
  645. XEXTERN int        Recording INIT(= FALSE);/* TRUE when recording into a register */
  646. XEXTERN int        Exec_reg INIT(= FALSE);    /* TRUE when executing a register */
  647. X
  648. XEXTERN int        did_cd INIT(= FALSE);    /* TRUE when :cd dir used */
  649. XEXTERN int        no_abbr INIT(= TRUE);    /* TRUE when no abbreviations loaded */
  650. X
  651. X
  652. XEXTERN char_u     *IObuff;                /* sprintf's are done in this buffer */
  653. XEXTERN char_u    *NameBuff;                /* file names are expanded in this buffer */
  654. X
  655. XEXTERN int        RedrawingDisabled INIT(= FALSE);
  656. X                                        /* Set to TRUE if doing :g */
  657. X
  658. XEXTERN int        readonlymode INIT(= FALSE); /* Set to TRUE for "view" */
  659. XEXTERN int        recoverymode INIT(= FALSE); /* Set to TRUE for "-r" option */
  660. X
  661. XEXTERN int        KeyTyped;                    /* TRUE if user typed the character */
  662. XEXTERN int        must_redraw INIT(= 0);        /* type of redraw necessary */
  663. XEXTERN int        skip_redraw INIT(= FALSE);    /* skip redraw once */
  664. X
  665. X#define NSCRIPT 15
  666. XEXTERN FILE     *scriptin[NSCRIPT];            /* streams to read script from */
  667. XEXTERN int        curscript INIT(= 0);        /* index in scriptin[] */
  668. XEXTERN FILE     *scriptout    INIT(= NULL);     /* stream to write script to */
  669. X
  670. XEXTERN int        got_int INIT(= FALSE);        /* set to TRUE when interrupt
  671. X                                                   signal occurred */
  672. XEXTERN int        term_console INIT(= FALSE);    /* set to TRUE when Amiga window used */
  673. XEXTERN int        termcap_active INIT(= FALSE);    /* set to TRUE by starttermcap() */
  674. XEXTERN int        bangredo INIT(= FALSE);        /* set to TRUE whith ! command */
  675. XEXTERN int        searchcmdlen;                /* length of previous search command */
  676. XEXTERN int         reg_ic INIT(= 0);             /* p_ic passed to to regexec() */
  677. X
  678. XEXTERN int        did_outofmem_msg INIT(= FALSE);    /* set after out of memory msg */
  679. XEXTERN int        tag_busy INIT(= FALSE);        /* doing a search for tag command */
  680. XEXTERN int        global_busy INIT(= 0);        /* set when :global is executing */
  681. XEXTERN int        dont_sleep INIT(= FALSE);    /* set when sleep() in emsg() not wanted */
  682. XEXTERN int        did_msg;                    /* set in msg_start, used for :global */
  683. XEXTERN int        no_wait_return INIT(= 0);    /* don't wait for return now */
  684. XEXTERN int        need_wait_return INIT(= 0);    /* need to wait for return later */
  685. XEXTERN char_u    *last_cmdline INIT(= NULL);    /* last command line (for ':' register) */
  686. XEXTERN char_u    *new_last_cmdline INIT(= NULL);    /* new value for last_cmdline */
  687. X
  688. XEXTERN int        postponed_split INIT(= FALSE);    /* for CTRL-W CTRL-] command */
  689. XEXTERN int        keep_old_search_pattern INIT(= FALSE);    /* for myregcomp() */
  690. X
  691. X#ifdef DEBUG
  692. XEXTERN FILE *debugfp INIT(=NULL);
  693. X#endif
  694. X
  695. Xextern char_u *Version;            /* this is in version.c */
  696. Xextern char_u *longVersion;        /* this is in version.c */
  697. X
  698. X/*
  699. X * The error messages that can be shared are included here.
  700. X * Excluded are very specific errors and debugging messages.
  701. X */
  702. XEXTERN char_u e_abbr[]        INIT(="No such abbreviation");
  703. XEXTERN char_u e_abort[]        INIT(="Command aborted");
  704. XEXTERN char_u e_ambmap[]    INIT(="Ambiguous mapping");
  705. XEXTERN char_u e_argreq[]    INIT(="Argument required");
  706. XEXTERN char_u e_backslash[]    INIT(="\\ should be followed by /, ? or &");
  707. XEXTERN char_u e_curdir[]    INIT(="Command not allowed from from .exrc/.vimrc in current dir");
  708. XEXTERN char_u e_errorf[]    INIT(="No errorfile name");
  709. XEXTERN char_u e_exists[]    INIT(="File exists (use ! to override)");
  710. XEXTERN char_u e_failed[]     INIT(="Command failed");
  711. XEXTERN char_u e_internal[]    INIT(="Internal error");
  712. XEXTERN char_u e_interr[]    INIT(="Interrupted");
  713. XEXTERN char_u e_invaddr[]    INIT(="Invalid address");
  714. XEXTERN char_u e_invarg[]    INIT(="Invalid argument");
  715. XEXTERN char_u e_invrange[]    INIT(="Invalid range");
  716. XEXTERN char_u e_invcmd[]    INIT(="Invalid command");
  717. XEXTERN char_u e_invstring[]    INIT(="Invalid search string");
  718. XEXTERN char_u e_nesting[]    INIT(="Scripts nested too deep");
  719. XEXTERN char_u e_noalt[]        INIT(="No alternate file");
  720. XEXTERN char_u e_nolastcmd[]    INIT(="No previous command line");
  721. XEXTERN char_u e_nomap[]        INIT(="No such mapping");
  722. XEXTERN char_u e_nomatch[]    INIT(="No match");
  723. XEXTERN char_u e_nomore[]    INIT(="No more files to edit");
  724. XEXTERN char_u e_noname[]    INIT(="No file name");
  725. XEXTERN char_u e_nopresub[]    INIT(="No previous substitute");
  726. XEXTERN char_u e_noprev[]    INIT(="No previous command");
  727. XEXTERN char_u e_noprevre[]    INIT(="No previous regexp");
  728. XEXTERN char_u e_norange[]     INIT(="No range allowed");
  729. XEXTERN char_u e_noroom[]     INIT(="Not enough room");
  730. XEXTERN char_u e_notcreate[]    INIT(="Can't create file %s");
  731. XEXTERN char_u e_notmp[]        INIT(="Can't get temp file name");
  732. XEXTERN char_u e_notopen[]    INIT(="Can't open file %s");
  733. XEXTERN char_u e_notread[]    INIT(="Can't read file %s");
  734. XEXTERN char_u e_nowrtmsg[]    INIT(="No write since last change (use ! to override)");
  735. XEXTERN char_u e_null[]        INIT(="Null argument");
  736. XEXTERN char_u e_number[]    INIT(="Number expected");
  737. XEXTERN char_u e_openerrf[]    INIT(="Can't open errorfile %s");
  738. XEXTERN char_u e_outofmem[]    INIT(="Out of memory!");
  739. XEXTERN char_u e_patnotf[]    INIT(="Pattern not found");
  740. XEXTERN char_u e_positive[]    INIT(="Argument must be positive");
  741. XEXTERN char_u e_quickfix[]    INIT(="No errorfile; use :cf");
  742. XEXTERN char_u e_re_damg[]    INIT(="Damaged match string");
  743. XEXTERN char_u e_re_corr[]    INIT(="Corrupted regexp program");
  744. XEXTERN char_u e_readonly[]    INIT(="File is readonly");
  745. XEXTERN char_u e_readerrf[]    INIT(="Error while reading errorfile");
  746. XEXTERN char_u e_scroll[]    INIT(="Invalid scroll size");
  747. XEXTERN char_u e_toocompl[]    INIT(="Command too complex");
  748. XEXTERN char_u e_toombra[]    INIT(="Too many (");
  749. XEXTERN char_u e_toomket[]    INIT(="Too many )");
  750. XEXTERN char_u e_toomsbra[]    INIT(="Too many [");
  751. XEXTERN char_u e_toolong[]    INIT(="Command too long");
  752. XEXTERN char_u e_toomany[]    INIT(="Too many file names");
  753. XEXTERN char_u e_trailing[]    INIT(="Trailing characters");
  754. XEXTERN char_u e_umark[]        INIT(="Unknown mark");
  755. XEXTERN char_u e_unknown[]    INIT(="Unknown");
  756. XEXTERN char_u e_write[]        INIT(="Error while writing");
  757. XEXTERN char_u e_zerocount[]    INIT(="Zero count");
  758. END_OF_FILE
  759.   if test 10417 -ne `wc -c <'vim/src/globals.h'`; then
  760.     echo shar: \"'vim/src/globals.h'\" unpacked with wrong size!
  761.   fi
  762.   # end of 'vim/src/globals.h'
  763. fi
  764. if test -f 'vim/src/msdos.c' -a "${1}" != "-c" ; then 
  765.   echo shar: Will not clobber existing file \"'vim/src/msdos.c'\"
  766. else
  767.   echo shar: Extracting \"'vim/src/msdos.c'\" \(19401 characters\)
  768.   sed "s/^X//" >'vim/src/msdos.c' <<'END_OF_FILE'
  769. X/* vi:ts=4:sw=4
  770. X *
  771. X * VIM - Vi IMproved        by Bram Moolenaar
  772. X *
  773. X * Read the file "credits.txt" for a list of people who contributed.
  774. X * Read the file "uganda.txt" for copying and usage conditions.
  775. X */
  776. X
  777. X/*
  778. X * msdos.c
  779. X *
  780. X * MSDOS system-dependent routines.
  781. X * A cheap plastic imitation of the amiga dependent code.
  782. X * A lot in this file was made by Juergen Weigert (jw).
  783. X */
  784. X
  785. X#include <io.h>
  786. X#include "vim.h"
  787. X#include "globals.h"
  788. X#include "param.h"
  789. X#include "proto.h"
  790. X#include <conio.h>
  791. X#include <fcntl.h>
  792. X#include <bios.h>
  793. X#include <alloc.h>
  794. X
  795. Xstatic int WaitForChar __ARGS((int));
  796. Xstatic int change_drive __ARGS((int));
  797. Xstatic int cbrk_handler __ARGS(());
  798. X
  799. Xtypedef struct filelist
  800. X{
  801. X    char_u    **file;
  802. X    int        nfiles;
  803. X    int        maxfiles;
  804. X} FileList;
  805. X
  806. Xstatic void        addfile __ARGS((FileList *, char_u *, int));
  807. Xstatic int        pstrcmp();    /* __ARGS((char **, char **)); BCC does not like this */
  808. Xstatic void        strlowcpy __ARGS((char_u *, char_u *));
  809. Xstatic int        expandpath __ARGS((FileList *, char_u *, int, int, int));
  810. X
  811. Xstatic int cbrk_pressed = FALSE;    /* set by ctrl-break interrupt */
  812. Xstatic int ctrlc_pressed = FALSE;    /* set when ctrl-C or ctrl-break detected */
  813. Xstatic int delayed_redraw = FALSE;    /* set when ctrl-C detected */
  814. X
  815. X    long
  816. Xmch_avail_mem(special)
  817. X    int special;
  818. X{
  819. X    return coreleft();
  820. X}
  821. X
  822. X    void
  823. Xvim_delay()
  824. X{
  825. X    delay(500);
  826. X}
  827. X
  828. X/*
  829. X * this version of remove is not scared by a readonly (backup) file
  830. X *
  831. X * returns -1 on error, 0 otherwise (just like remove())
  832. X */
  833. X    int
  834. Xvim_remove(name)
  835. X    char_u *name;
  836. X{
  837. X    (void)setperm(name, 0);    /* default permissions */
  838. X    return unlink(name);
  839. X}
  840. X
  841. X/*
  842. X * mch_write(): write the output buffer to the screen
  843. X */
  844. X    void
  845. Xmch_write(s, len)
  846. X    char_u    *s;
  847. X    int        len;
  848. X{
  849. X    char_u    *p;
  850. X    int        row, col;
  851. X
  852. X    if (term_console)        /* translate ESC | sequences into bios calls */
  853. X        while (len--)
  854. X        {
  855. X            if (s[0] == '\n')
  856. X                putch('\r');
  857. X            else if (s[0] == ESC && len > 1 && s[1] == '|')
  858. X            {
  859. X                switch (s[2])
  860. X                {
  861. X                case 'J':    clrscr();
  862. X                            goto got3;
  863. X
  864. X                case 'K':    clreol();
  865. X                            goto got3;
  866. X
  867. X                case 'L':    insline();
  868. X                            goto got3;
  869. X
  870. X                case 'M':    delline();
  871. Xgot3:                        s += 3;
  872. X                            len -= 2;
  873. X                            continue;
  874. X
  875. X                case '0':
  876. X                case '1':
  877. X                case '2':
  878. X                case '3':
  879. X                case '4':
  880. X                case '5':
  881. X                case '6':
  882. X                case '7':
  883. X                case '8':
  884. X                case '9':    p = s + 2;
  885. X                            row = getdigits(&p);        /* no check for length! */
  886. X                            if (p > s + len)
  887. X                                break;
  888. X                            if (*p == ';')
  889. X                            {
  890. X                                ++p;
  891. X                                col = getdigits(&p);    /* no check for length! */
  892. X                                if (p > s + len)
  893. X                                    break;
  894. X                                if (*p == 'H' || *p == 'r')
  895. X                                {
  896. X                                    if (*p == 'H')        /* set cursor position */
  897. X                                        gotoxy(col, row);
  898. X                                    else                /* set scroll region  */
  899. X                                        window(1, row, Columns, col);
  900. X                                    len -= p - s;
  901. X                                    s = p + 1;
  902. X                                    continue;
  903. X                                }
  904. X                            }
  905. X                            else if (*p == 'm')
  906. X                            {
  907. X                                if (row == 0)
  908. X                                    normvideo();
  909. X                                else
  910. X                                    textattr(row);
  911. X                                len -= p - s;
  912. X                                s = p + 1;
  913. X                                continue;
  914. X                            }
  915. X                }
  916. X            }
  917. X            putch(*s++);
  918. X        }
  919. X    else
  920. X        write(1, s, (unsigned)len);
  921. X}
  922. X
  923. X#define POLL_SPEED 10    /* milliseconds between polls */
  924. X
  925. X/*
  926. X * Simulate WaitForChar() by slowly polling with bioskey(1) or kbhit().
  927. X *
  928. X * If Vim should work over the serial line after a 'ctty com1' we must use
  929. X * kbhit() and getch(). (jw)
  930. X * Usually kbhit() is not used, because then CTRL-C and CTRL-P
  931. X * will be catched by DOS (mool).
  932. X *
  933. X * return TRUE if a character is available, FALSE otherwise
  934. X */
  935. X
  936. X    static int
  937. XWaitForChar(msec)
  938. X    int msec;
  939. X{
  940. X    for (;;)
  941. X    {
  942. X        if ((p_biosk ? bioskey(1) : kbhit()) || cbrk_pressed)
  943. X            return TRUE;
  944. X        if (msec <= 0)
  945. X            break;
  946. X        delay(POLL_SPEED);
  947. X        msec -= POLL_SPEED;
  948. X    }
  949. X    return FALSE;
  950. X}
  951. X
  952. X/*
  953. X * GetChars(): low level input funcion.
  954. X * Get a characters from the keyboard.
  955. X * If time == 0 do not wait for characters.
  956. X * If time == n wait a short time for characters.
  957. X * If time == -1 wait forever for characters.
  958. X *
  959. X * return the number of characters obtained
  960. X */
  961. X    int
  962. XGetChars(buf, maxlen, time)
  963. X    char_u        *buf;
  964. X    int         maxlen;
  965. X    int         time;
  966. X{
  967. X    int         len = 0;
  968. X    int            c;
  969. X
  970. X/*
  971. X * if we got a ctrl-C when we were busy, there will be a "^C" somewhere
  972. X * on the sceen, so we need to redisplay it.
  973. X */
  974. X    if (delayed_redraw)
  975. X    {
  976. X        delayed_redraw = FALSE;
  977. X        updateScreen(CLEAR);
  978. X        setcursor();
  979. X        flushbuf();
  980. X    }
  981. X
  982. X    if (time >= 0)
  983. X    {
  984. X        if (WaitForChar(time) == 0)     /* no character available */
  985. X            return 0;
  986. X    }
  987. X    else    /* time == -1 */
  988. X    {
  989. X    /*
  990. X     * If there is no character available within 2 seconds (default)
  991. X     * write the autoscript file to disk
  992. X     */
  993. X        if (WaitForChar((int)p_ut) == 0)
  994. X            updatescript(0);
  995. X    }
  996. X
  997. X/*
  998. X * Try to read as many characters as there are.
  999. X * Works for the controlling tty only.
  1000. X */
  1001. X    --maxlen;        /* may get two chars at once */
  1002. X    /*
  1003. X     * we will get at least one key. Get more if they are available
  1004. X     * After a ctrl-break we have to read a 0 (!) from the buffer.
  1005. X     * bioskey(1) will return 0 if no key is available and when a
  1006. X     * ctrl-break was typed. When ctrl-break is hit, this does not always
  1007. X     * implies a key hit.
  1008. X     */
  1009. X    cbrk_pressed = FALSE;
  1010. X    if (p_biosk)
  1011. X        while ((len == 0 || bioskey(1)) && len < maxlen)
  1012. X        {
  1013. X            c = bioskey(0);            /* get the key */
  1014. X            if (c == 0)                /* ctrl-break */
  1015. X                c = 3;                /* return a CTRL-C */
  1016. X            if ((c & 0xff) == 0)
  1017. X            {
  1018. X                if (c == 0x0300)        /* CTRL-@ is 0x0300, translated into K_ZERO */
  1019. X                    c = K_ZERO;
  1020. X                else        /* extended key code 0xnn00 translated into K_NUL, nn */
  1021. X                {
  1022. X                    c >>= 8;
  1023. X                    *buf++ = K_NUL;
  1024. X                    ++len;
  1025. X                }
  1026. X            }
  1027. X
  1028. X            *buf++ = c;
  1029. X            len++;
  1030. X        }
  1031. X    else
  1032. X        while ((len == 0 || kbhit()) && len < maxlen)
  1033. X        {
  1034. X            switch (c = getch())
  1035. X            {
  1036. X            case 0:
  1037. X                    *buf++ = K_NUL;
  1038. X                    break;
  1039. X            case 3:
  1040. X                    cbrk_pressed = TRUE;
  1041. X                    /*FALLTHROUGH*/
  1042. X            default:
  1043. X                    *buf++ = c;
  1044. X            }
  1045. X            len++;
  1046. X        }
  1047. X    return len;
  1048. X}
  1049. X
  1050. X/*
  1051. X * return non-zero if a character is available
  1052. X */
  1053. X    int
  1054. Xmch_char_avail()
  1055. X{
  1056. X    return WaitForChar(0);
  1057. X}
  1058. X
  1059. X/*
  1060. X * We have no job control, fake it by starting a new shell.
  1061. X */
  1062. X    void
  1063. Xmch_suspend()
  1064. X{
  1065. X    OUTSTR("new shell started\n");
  1066. X    (void)call_shell(NULL, 0, TRUE);
  1067. X}
  1068. X
  1069. Xextern int _fmode;
  1070. X/*
  1071. X * we do not use windows, there is not much to do here
  1072. X */
  1073. X    void
  1074. Xmch_windinit()
  1075. X{
  1076. X    _fmode = O_BINARY;        /* we do our own CR-LF translation */
  1077. X    flushbuf();
  1078. X    (void)mch_get_winsize();
  1079. X}
  1080. X
  1081. X    void
  1082. Xcheck_win(argc, argv)
  1083. X    int        argc;
  1084. X    char    **argv;
  1085. X{
  1086. X    if (!isatty(0) || !isatty(1))
  1087. X    {
  1088. X        fprintf(stderr, "VIM: no controlling terminal\n");
  1089. X        exit(2);
  1090. X    }
  1091. X    /*
  1092. X     * In some cases with DOS 6.0 on a NEC notebook there is a 12 seconds
  1093. X     * delay when starting up that can be avoided by the next two lines.
  1094. X     * Don't ask me why!
  1095. X     * This could be fixed by removing setver.sys from config.sys. Forget it.
  1096. X    gotoxy(1,1);
  1097. X    cputs(" ");
  1098. X     */
  1099. X}
  1100. X
  1101. X/*
  1102. X * fname_case(): Set the case of the filename, if it already exists.
  1103. X *                 msdos filesystem is far to primitive for that. do nothing.
  1104. X */
  1105. X    void
  1106. Xfname_case(name)
  1107. X    char_u *name;
  1108. X{
  1109. X}
  1110. X
  1111. X/*
  1112. X * mch_settitle(): set titlebar of our window.
  1113. X * Dos console has no title.
  1114. X */
  1115. X    void
  1116. Xmch_settitle(title, icon)
  1117. X    char_u *title;
  1118. X    char_u *icon;
  1119. X{
  1120. X}
  1121. X
  1122. X/*
  1123. X * Restore the window/icon title. (which we don't have)
  1124. X */
  1125. X    void
  1126. Xmch_restore_title(which)
  1127. X    int which;
  1128. X{
  1129. X}
  1130. X
  1131. X/*
  1132. X * Get name of current directory into buffer 'buf' of length 'len' bytes.
  1133. X * Return OK for success, FAIL for failure.
  1134. X */
  1135. X    int
  1136. Xvim_dirname(buf, len)
  1137. X    char_u    *buf;
  1138. X    int        len;
  1139. X{
  1140. X    return (getcwd(buf, len) != NULL ? OK : FAIL);
  1141. X}
  1142. X
  1143. X/*
  1144. X * Change default drive (just like _chdrive of Borland C 3.1)
  1145. X */
  1146. X    static int
  1147. Xchange_drive(drive)
  1148. X    int drive;
  1149. X{
  1150. X    unsigned dummy;
  1151. X    union REGS regs;
  1152. X
  1153. X    regs.h.ah = 0x0e;
  1154. X    regs.h.dl = drive - 1;
  1155. X    intdos(®s, ®s);    /* set default drive */
  1156. X    regs.h.ah = 0x19;
  1157. X    intdos(®s, ®s);    /* get default drive */
  1158. X    if (regs.h.al == drive - 1)
  1159. X        return 0;
  1160. X    else
  1161. X        return -1;
  1162. X}
  1163. X
  1164. X/*
  1165. X * get absolute filename into buffer 'buf' of length 'len' bytes
  1166. X *
  1167. X * return FAIL for failure, OK otherwise
  1168. X */
  1169. X    int
  1170. XFullName(fname, buf, len)
  1171. X    char_u    *fname, *buf;
  1172. X    int        len;
  1173. X{
  1174. X    if (fname == NULL)    /* always fail */
  1175. X    {
  1176. X        *buf = NUL;
  1177. X        return FAIL;
  1178. X    }
  1179. X
  1180. X    if (isFullName(fname))        /* allready expanded */
  1181. X    {
  1182. X        STRNCPY(buf, fname, len);
  1183. X        return OK;
  1184. X    }
  1185. X
  1186. X#ifdef __BORLANDC__        /* the old Turbo C does not have this */
  1187. X    if (_fullpath(buf, fname, len) == NULL)
  1188. X    {
  1189. X        STRNCPY(buf, fname, len);    /* failed, use the relative path name */
  1190. X        return FAIL;
  1191. X    }
  1192. X    return OK;
  1193. X#else                    /* almost the same as FullName in unix.c */
  1194. X    {
  1195. X        int        l;
  1196. X        char_u    olddir[MAXPATHL];
  1197. X        char_u    *p, *q;
  1198. X        int        c;
  1199. X        int        retval = OK;
  1200. X
  1201. X        *buf = 0;
  1202. X        /*
  1203. X         * change to the directory for a moment,
  1204. X         * and then do the getwd() (and get back to where we were).
  1205. X         * This will get the correct path name with "../" things.
  1206. X         */
  1207. X        p = strrchr(fname, '/');
  1208. X        q = strrchr(fname, '\\');
  1209. X        if (q && (p == NULL || q > p))
  1210. X            p = q;
  1211. X        q = strrchr(fname, ':');
  1212. X        if (q && (p == NULL || q > p))
  1213. X            p = q;
  1214. X        if (p != NULL)
  1215. X        {
  1216. X            if (getcwd(olddir, MAXPATHL) == NULL)
  1217. X            {
  1218. X                p = NULL;        /* can't get current dir: don't chdir */
  1219. X                retval = FAIL;
  1220. X            }
  1221. X            else
  1222. X            {
  1223. X                if (*p == ':' || (p > fname && p[-1] == ':'))
  1224. X                    q = p + 1;
  1225. X                else
  1226. X                    q = p;
  1227. X                c = *q;
  1228. X                *q = NUL;
  1229. X                if (chdir(fname))
  1230. X                    retval = FAIL;
  1231. X                else
  1232. X                    fname = p + 1;
  1233. X                *q = c;
  1234. X            }
  1235. X        }
  1236. X        if (getcwd(buf, len) == NULL)
  1237. X        {
  1238. X            retval = FAIL;
  1239. X            *buf = NUL;
  1240. X        }
  1241. X        l = STRLEN(buf);
  1242. X        if (l && buf[l - 1] != '/' && buf[l - 1] != '\\')
  1243. X            strcat(buf, "\\");
  1244. X        if (p)
  1245. X            chdir(olddir);
  1246. X        strcat(buf, fname);
  1247. X        return retval;
  1248. X    }
  1249. X#endif
  1250. X}
  1251. X
  1252. X/*
  1253. X * return TRUE is fname is an absolute path name
  1254. X */
  1255. X    int
  1256. XisFullName(fname)
  1257. X    char_u        *fname;
  1258. X{
  1259. X    return (STRCHR(fname, ':') != NULL);
  1260. X}
  1261. X
  1262. X/*
  1263. X * get file permissions for 'name'
  1264. X * -1 : error
  1265. X * else FA_attributes defined in dos.h
  1266. X */
  1267. X    long
  1268. Xgetperm(name)
  1269. X    char_u *name;
  1270. X{
  1271. X    int r;
  1272. X
  1273. X    r = _chmod(name, 0, 0);         /* get file mode */
  1274. X    return r;
  1275. X}
  1276. X
  1277. X/*
  1278. X * set file permission for 'name' to 'perm'
  1279. X *
  1280. X * return FAIL for failure, OK otherwise
  1281. X */
  1282. X    int
  1283. Xsetperm(name, perm)
  1284. X    char_u    *name;
  1285. X    long    perm;
  1286. X{
  1287. X    perm |= FA_ARCH;        /* file has changed, set archive bit */
  1288. X    return (_chmod((char *)name, 1, (int)perm) == -1 ? FAIL : OK);
  1289. X}
  1290. X
  1291. X/*
  1292. X * return TRUE if "name" is a directory
  1293. X * return FALSE if "name" is not a directory
  1294. X * return -1 for error
  1295. X *
  1296. X * beware of a trailing backslash that may have been added by addfile()
  1297. X */
  1298. X    int
  1299. Xisdir(name)
  1300. X    char_u *name;
  1301. X{
  1302. X    int        f;
  1303. X    char_u    *p;
  1304. X
  1305. X    p = name + strlen(name);
  1306. X    if (p > name)
  1307. X        --p;
  1308. X    if (*p == '\\')                    /* remove trailing backslash for a moment */
  1309. X        *p = NUL;
  1310. X    else
  1311. X        p = NULL;
  1312. X    f = _chmod(name, 0, 0);
  1313. X    if (p != NULL)
  1314. X        *p = '\\';
  1315. X    if (f == -1)
  1316. X        return -1;                    /* file does not exist at all */
  1317. X    if ((f & FA_DIREC) == 0)
  1318. X        return FALSE;                /* not a directory */
  1319. X    return TRUE;
  1320. X}
  1321. X
  1322. X/*
  1323. X * Careful: mch_windexit() may be called before mch_windinit()!
  1324. X */
  1325. X    void
  1326. Xmch_windexit(r)
  1327. X    int r;
  1328. X{
  1329. X    settmode(0);
  1330. X    stoptermcap();
  1331. X    flushbuf();
  1332. X    ml_close_all();                 /* remove all memfiles */
  1333. X    exit(r);
  1334. X}
  1335. X
  1336. X/*
  1337. X * function for ctrl-break interrupt
  1338. X */
  1339. X    void interrupt
  1340. Xcatch_cbrk()
  1341. X{
  1342. X    cbrk_pressed = TRUE;
  1343. X    ctrlc_pressed = TRUE;
  1344. X}
  1345. X
  1346. X/*
  1347. X * ctrl-break handler for DOS. Never called when a ctrl-break is typed, because
  1348. X * we catch interrupt 1b. If you type ctrl-C while Vim is waiting for a
  1349. X * character this function is not called. When a ctrl-C is typed while Vim is
  1350. X * busy this function may be called. By that time a ^C has been displayed on
  1351. X * the screen, so we have to redisplay the screen. We can't do that here,
  1352. X * because we may be called by DOS. The redraw is in GetChars().
  1353. X */
  1354. X    static int
  1355. Xcbrk_handler()
  1356. X{
  1357. X    delayed_redraw = TRUE;
  1358. X    return 1;                 /* resume operation after ctrl-break */
  1359. X}
  1360. X
  1361. X/*
  1362. X * function for critical error interrupt
  1363. X * For DOS 1 and 2 return 0 (Ignore).
  1364. X * For DOS 3 and later return 3 (Fail)
  1365. X */
  1366. X    void interrupt
  1367. Xcatch_cint(bp, di, si, ds, es, dx, cx, bx, ax)
  1368. X    unsigned bp, di, si, ds, es, dx, cx, bx, ax;
  1369. X{
  1370. X    ax = (ax & 0xff00);        /* set AL to 0 */
  1371. X    if (_osmajor >= 3)
  1372. X        ax |= 3;            /* set AL to 3 */
  1373. X}
  1374. X
  1375. X/*
  1376. X * set the tty in (raw) ? "raw" : "cooked" mode
  1377. X *
  1378. X * Does not change the tty, as bioskey() and kbhit() work raw all the time.
  1379. X */
  1380. X
  1381. Xextern void interrupt CINT_FUNC();
  1382. X
  1383. X    void
  1384. Xmch_settmode(raw)
  1385. X    int  raw;
  1386. X{
  1387. X    static int saved_cbrk;
  1388. X    static void interrupt (*old_cint)();
  1389. X    static void interrupt (*old_cbrk)();
  1390. X
  1391. X    if (raw)
  1392. X    {
  1393. X        saved_cbrk = getcbrk();            /* save old ctrl-break setting */
  1394. X        setcbrk(0);                        /* do not check for ctrl-break */
  1395. X        old_cint = getvect(0x24);         /* save old critical error interrupt */
  1396. X        setvect(0x24, catch_cint);        /* install our critical error interrupt */
  1397. X        old_cbrk = getvect(0x1B);         /* save old ctrl-break interrupt */
  1398. X        setvect(0x1B, catch_cbrk);        /* install our ctrl-break interrupt */
  1399. X        ctrlbrk(cbrk_handler);            /* vim's ctrl-break handler */
  1400. X        if (term_console)
  1401. X            outstr(T_TP);                /* set colors */
  1402. X    }
  1403. X    else
  1404. X    {
  1405. X        setcbrk(saved_cbrk);            /* restore ctrl-break setting */
  1406. X        setvect(0x24, old_cint);        /* restore critical error interrupt */
  1407. X        setvect(0x1B, old_cbrk);        /* restore ctrl-break interrupt */
  1408. X        /* restore ctrl-break handler, how ??? */
  1409. X        if (term_console)
  1410. X            normvideo();                /* restore screen colors */
  1411. X    }
  1412. X}
  1413. X
  1414. X/*
  1415. X * set screen mode
  1416. X * return FAIL for failure, OK otherwise
  1417. X */
  1418. X    int
  1419. Xmch_screenmode(arg)
  1420. X    char_u        *arg;
  1421. X{
  1422. X    int                mode;
  1423. X    int                i;
  1424. X    static char_u *(names[]) = {"BW40", "C40", "BW80", "C80", "MONO", "C4350"};
  1425. X    static int        modes[]  = { BW40,   C40,   BW80,   C80,   MONO,   C4350};
  1426. X
  1427. X    mode = -1;
  1428. X    if (isdigit(*arg))                /* mode number given */
  1429. X        mode = atoi((char *)arg);
  1430. X    else
  1431. X    {
  1432. X        for (i = 0; i < sizeof(names) / sizeof(char_u *); ++i)
  1433. X            if (stricmp((char *)names[i], (char *)arg) == 0)
  1434. X            {
  1435. X                mode = modes[i];
  1436. X                break;
  1437. X            }
  1438. X    }
  1439. X    if (mode == -1)
  1440. X    {
  1441. X        EMSG("Unsupported screen mode");
  1442. X        return FAIL;
  1443. X    }
  1444. X    textmode(mode);                    /* use Borland function */
  1445. X    return OK;
  1446. X}
  1447. X
  1448. X/*
  1449. X * Structure used by Turbo-C/Borland-C to store video parameters.
  1450. X */
  1451. Xextern struct text_info _video;
  1452. X
  1453. X/*
  1454. X * try to get the real window size
  1455. X * return FAIL for failure, OK otherwise
  1456. X */
  1457. X    int
  1458. Xmch_get_winsize()
  1459. X{
  1460. X    int i;
  1461. X    struct text_info ti;
  1462. X/*
  1463. X * The screenwidth is returned by the BIOS OK.
  1464. X * The screenheight is in a location in the bios RAM, if the display is EGA or VGA.
  1465. X */
  1466. X    if (!term_console)
  1467. X        return FAIL;
  1468. X    gettextinfo(&ti);
  1469. X    Columns = ti.screenwidth;
  1470. X    Rows = ti.screenheight;
  1471. X    if (ti.currmode > 10)
  1472. X        Rows = *(char far *)MK_FP(0x40, 0x84) + 1;
  1473. X    set_window();
  1474. X
  1475. X    if (Columns < 5 || Columns > MAX_COLUMNS ||
  1476. X                    Rows < 2 || Rows > MAX_COLUMNS)
  1477. X    {
  1478. X        /* these values are overwritten by termcap size or default */
  1479. X        Columns = 80;
  1480. X        Rows = 25;
  1481. X        return FAIL;
  1482. X    }
  1483. X    check_winsize();
  1484. X
  1485. X    return OK;
  1486. X}
  1487. X
  1488. X/*
  1489. X * Set the active window for delline/insline.
  1490. X */
  1491. X    void
  1492. Xset_window()
  1493. X{
  1494. X    _video.screenheight = Rows;
  1495. X    window(1, 1, Columns, Rows);
  1496. X}
  1497. X
  1498. X    void
  1499. Xmch_set_winsize()
  1500. X{
  1501. X    /* should try to set the window size to Rows and Columns */
  1502. X    /* may involve switching display mode.... */
  1503. X}
  1504. X
  1505. X/*
  1506. X * call shell, return FAIL for failure, OK otherwise
  1507. X */
  1508. X    int
  1509. Xcall_shell(cmd, filter, cooked)
  1510. X    char_u    *cmd;
  1511. X    int     filter;         /* if != 0: called by dofilter() */
  1512. X    int        cooked;
  1513. X{
  1514. X    int        x;
  1515. X    char_u    newcmd[200];
  1516. X
  1517. X    flushbuf();
  1518. X
  1519. X    if (cooked)
  1520. X        settmode(0);        /* set to cooked mode */
  1521. X
  1522. X    if (cmd == NULL)
  1523. X        x = system(p_sh);
  1524. X    else
  1525. X    {                     /* we use "command" to start the shell, slow but easy */
  1526. X        sprintf(newcmd, "%s /c %s", p_sh, cmd);
  1527. X        x = system(newcmd);
  1528. X    }
  1529. X    outchar('\n');
  1530. X    if (cooked)
  1531. X        settmode(1);        /* set to raw mode */
  1532. X
  1533. X#ifdef WEBB_COMPLETE
  1534. X    if (x && !expand_interactively)
  1535. X#else
  1536. X    if (x)
  1537. X#endif
  1538. X    {
  1539. X        outnum((long)x);
  1540. X        outstrn((char_u *)" returned\n");
  1541. X    }
  1542. X
  1543. X    resettitle();
  1544. X    (void)mch_get_winsize();        /* display mode may have been changed */
  1545. X    return (x ? FAIL : OK);
  1546. X}
  1547. X
  1548. X/*
  1549. X * check for an "interrupt signal": CTRL-break or CTRL-C
  1550. X */
  1551. X    void
  1552. Xbreakcheck()
  1553. X{
  1554. X    if (ctrlc_pressed)
  1555. X    {
  1556. X        ctrlc_pressed = FALSE;
  1557. X        got_int = TRUE;
  1558. X    }
  1559. X}
  1560. X
  1561. X#define FL_CHUNK 32
  1562. X
  1563. X    static void
  1564. Xaddfile(fl, f, isdir)
  1565. X    FileList    *fl;
  1566. X    char_u        *f;
  1567. X    int            isdir;
  1568. X{
  1569. X    char_u        *p;
  1570. X
  1571. X    if (!fl->file)
  1572. X    {
  1573. X        fl->file = (char_u **)alloc(sizeof(char_u *) * FL_CHUNK);
  1574. X        if (!fl->file)
  1575. X            return;
  1576. X        fl->nfiles = 0;
  1577. X        fl->maxfiles = FL_CHUNK;
  1578. X    }
  1579. X    if (fl->nfiles >= fl->maxfiles)
  1580. X    {
  1581. X        char_u    **t;
  1582. X        int        i;
  1583. X
  1584. X        t = (char_u **)lalloc((long_u)(sizeof(char_u *) * (fl->maxfiles + FL_CHUNK)), TRUE);
  1585. X        if (!t)
  1586. X            return;
  1587. X        for (i = fl->nfiles - 1; i >= 0; i--)
  1588. X            t[i] = fl->file[i];
  1589. X        free(fl->file);
  1590. X        fl->file = t;
  1591. X        fl->maxfiles += FL_CHUNK;
  1592. X    }
  1593. X    p = alloc((unsigned)(STRLEN(f) + 1 + isdir));
  1594. X    if (p)
  1595. X    {
  1596. X        STRCPY(p, f);
  1597. X        if (isdir)
  1598. X            strcat(p, "\\");
  1599. X    }
  1600. X    fl->file[fl->nfiles++] = p;
  1601. X}
  1602. X
  1603. X    static int
  1604. Xpstrcmp(a, b)
  1605. X    char_u **a, **b;
  1606. X{
  1607. X    return (strcmp(*a, *b));
  1608. X}
  1609. X
  1610. X    int
  1611. Xhas_wildcard(s)
  1612. X    char_u *s;
  1613. X{
  1614. X    if (s)
  1615. X        for ( ; *s; ++s)
  1616. X            if (*s == '?' || *s == '*')
  1617. X                return TRUE;
  1618. X    return FALSE;
  1619. X}
  1620. X
  1621. X    static void
  1622. Xstrlowcpy(d, s)
  1623. X    char_u *d, *s;
  1624. X{
  1625. X    while (*s)
  1626. X        *d++ = tolower(*s++);
  1627. X    *d = '\0';
  1628. X}
  1629. X
  1630. X    static int
  1631. Xexpandpath(fl, path, fonly, donly, notf)
  1632. X    FileList    *fl;
  1633. X    char_u        *path;
  1634. X    int            fonly, donly, notf;
  1635. X{
  1636. X    char_u    buf[MAXPATH];
  1637. X    char_u    *p, *s, *e;
  1638. X    int        lastn, c, r;
  1639. X    struct    ffblk fb;
  1640. X
  1641. X    lastn = fl->nfiles;
  1642. X
  1643. X/*
  1644. X * Find the first part in the path name that contains a wildcard.
  1645. X * Copy it into buf, including the preceding characters.
  1646. X */
  1647. X    p = buf;
  1648. X    s = NULL;
  1649. X    e = NULL;
  1650. X    while (*path)
  1651. X    {
  1652. X        if (*path == '\\' || *path == ':' || *path == '/')
  1653. X        {
  1654. X            if (e)
  1655. X                break;
  1656. X            else
  1657. X                s = p;
  1658. X        }
  1659. X        if (*path == '*' || *path == '?')
  1660. X            e = p;
  1661. X        *p++ = *path++;
  1662. X    }
  1663. X    e = p;
  1664. X    if (s)
  1665. X        s++;
  1666. X    else
  1667. X        s = buf;
  1668. X
  1669. X    /* if the file name ends in "*" and does not contain a ".", addd ".*" */
  1670. X    if (e[-1] == '*' && STRCHR(s, '.') == NULL)
  1671. X    {
  1672. X        *e++ = '.';
  1673. X        *e++ = '*';
  1674. X    }
  1675. X    /* now we have one wildcard component between s and e */
  1676. X    *e = '\0';
  1677. X    r = 0;
  1678. X    /* If we are expanding wildcards we try both files and directories */
  1679. X    if ((c = findfirst(buf, &fb, (*path || !notf) ? FA_DIREC : 0)) != 0)
  1680. X    {
  1681. X        /* not found */
  1682. X        STRCPY(e, path);
  1683. X        if (notf)
  1684. X            addfile(fl, buf, FALSE);
  1685. X        return 1; /* unexpanded or empty */
  1686. X    }
  1687. X    while (!c)
  1688. X    {
  1689. X        strlowcpy(s, fb.ff_name);
  1690. X            /* ignore "." and ".." */
  1691. X        if (*s != '.' || (s[1] != '\0' && (s[1] != '.' || s[2] != '\0')))
  1692. X        {
  1693. X            strcat(buf, path);
  1694. X            if (!has_wildcard(path))
  1695. X                addfile(fl, buf, (isdir(buf) == TRUE));
  1696. X            else
  1697. X                r |= expandpath(fl, buf, fonly, donly, notf);
  1698. X        }
  1699. X        c = findnext(&fb);
  1700. X    }
  1701. X    qsort(fl->file + lastn, fl->nfiles - lastn, sizeof(char_u *), pstrcmp);
  1702. X    return r;
  1703. X}
  1704. X
  1705. X/*
  1706. X * MSDOS rebuilt of Scott Ballantynes ExpandWildCard for amiga/arp.
  1707. X * jw
  1708. X */
  1709. X
  1710. X    int
  1711. XExpandWildCards(num_pat, pat, num_file, file, files_only, list_notfound)
  1712. X    int     num_pat;
  1713. X    char_u    **pat;
  1714. X    int     *num_file;
  1715. X    char_u    ***file;
  1716. X    int     files_only, list_notfound;
  1717. X{
  1718. X    int            i, r = 0;
  1719. X    FileList    f;
  1720. X
  1721. X    f.file = NULL;
  1722. X    f.nfiles = 0;
  1723. X    for (i = 0; i < num_pat; i++)
  1724. X    {
  1725. X        if (!has_wildcard(pat[i]))
  1726. X            addfile(&f, pat[i], files_only ? FALSE : (isdir(pat[i]) == TRUE));
  1727. X        else
  1728. X            r |= expandpath(&f, pat[i], files_only, 0, list_notfound);
  1729. X    }
  1730. X    if (r == 0)
  1731. X    {
  1732. X        *num_file = f.nfiles;
  1733. X        *file = f.file;
  1734. X    }
  1735. X    else
  1736. X    {
  1737. X        *num_file = 0;
  1738. X        *file = NULL;
  1739. X    }
  1740. X    return (r ? FAIL : OK);
  1741. X}
  1742. X
  1743. X    void
  1744. XFreeWild(num, file)
  1745. X    int        num;
  1746. X    char_u    **file;
  1747. X{
  1748. X    if (file == NULL || num <= 0)
  1749. X        return;
  1750. X    while (num--)
  1751. X        free(file[num]);
  1752. X    free(file);
  1753. X}
  1754. X
  1755. X/*
  1756. X * The normal chdir() does not change the default drive.
  1757. X * This one does.
  1758. X */
  1759. X#undef chdir
  1760. X    int
  1761. Xvim_chdir(path)
  1762. X    char_u *path;
  1763. X{
  1764. X    if (path[0] == NUL)                /* just checking... */
  1765. X        return 0;
  1766. X    if (path[1] == ':')                /* has a drive name */
  1767. X    {
  1768. X        if (change_drive(toupper(path[0]) - 'A' + 1))
  1769. X            return -1;                /* invalid drive name */
  1770. X        path += 2;
  1771. X    }
  1772. X    if (*path == NUL)                /* drive name only */
  1773. X        return 0;
  1774. X    return chdir(path);                /* let the normal chdir() do the rest */
  1775. X}
  1776. END_OF_FILE
  1777.   if test 19401 -ne `wc -c <'vim/src/msdos.c'`; then
  1778.     echo shar: \"'vim/src/msdos.c'\" unpacked with wrong size!
  1779.   fi
  1780.   # end of 'vim/src/msdos.c'
  1781. fi
  1782. if test -f 'vim/todo' -a "${1}" != "-c" ; then 
  1783.   echo shar: Will not clobber existing file \"'vim/todo'\"
  1784. else
  1785.   echo shar: Extracting \"'vim/todo'\" \(19200 characters\)
  1786.   sed "s/^X//" >'vim/todo' <<'END_OF_FILE'
  1787. XKnown problems:
  1788. X
  1789. XIf file system full and write to swap file failed, get error message for
  1790. X    lnum > line_count?
  1791. XWhen editing same file in two xterms, in second type ":" at first wait-return
  1792. X    for ".swp file exists", at exit cursor is left at top of window.
  1793. XWindows NT: display is not always correct.
  1794. XWindows NT: CTRL-C in a child shell (created with ":sh" or CTRL-Z) kills Vim.
  1795. XMSDOS: When using smardrive a readonly floppy will cause problems. Test for
  1796. X    writable directory first?
  1797. XSome terminals start inverting at the position where the invert code is put.
  1798. X    This is not handled correctly. Remove 'weirdinvert' hack.
  1799. X":s/\(.*\)/\1" on line with ^M should not replace ^M by linebreaks.
  1800. XReplace with 'r' should set last inserted text.
  1801. XBS in replace mode does not work correctly with et set and after inserting a TAB.
  1802. XIn insert mode CTRL-O . does not repeat the last CTRL-O command but the insertion.
  1803. XSometimes the time stamp in the memfile is old. May be caused by opening the 
  1804. X    file r/w when testing for readonly.
  1805. XWhen doing a CTRL-Z and typing a command for the shell, while Vim is busy
  1806. X    (e.g. writing a file), the command for the shell is sometimes eaten by Vim.
  1807. XFind out why screen size is changed in unexpected place for Bob Beresh.
  1808. X
  1809. X
  1810. XTo be checked:
  1811. XCheck '\n' at end of some : commands (that do not have TRLBAR).
  1812. XCheck for '\\' at the start of search commands (undocumented vi feature).
  1813. XEnvironment name expansion for 'bdir' default value does not work?
  1814. XUsage of isspace() vi-compatible (compared to iswhite())?
  1815. XTerminal initializations compared to vi. "vs" used to make cursor very visible,
  1816. X    or for scrollbars (Webb)?
  1817. XMSDOS: After writing on a network the 'w' bit for others is set.
  1818. XWhen can the 'p' and 'P' command not be redone??
  1819. X
  1820. X
  1821. XProblems that will probably not be solved:
  1822. X
  1823. XProlem with HPterm under X (cosentino/2).
  1824. XAmiga: When using quickfix with the Manx compiler we only get the first 25
  1825. X    errors. How do we get the rest?
  1826. XAmiga: The ":cq" command does not always abort the Manx compiler. Why?
  1827. XLinux: A file with protection r--rw-rw- is seen readonly for others. The access()
  1828. X    function in GNU libc is probably wrong.
  1829. X
  1830. X
  1831. XFurther extentions and improvements:
  1832. X
  1833. XAdd icon setting for xterm (riehm/69, mulder/iconname.set).
  1834. XMake command line arguments options to be combined after a single dash, eg "-nb".
  1835. XWhen started to edit another file, make message "file 1 of 8" different.
  1836. XWhen entering text, keep other windows on same buffer updated (when a line
  1837. X    entered)?
  1838. XAmiga: When 'r' protection bit is not set, file can still be opened
  1839. X    but gives read errors. Check protection before opening.
  1840. XBind windows together, scrolling is done in both windows synchronous
  1841. X    (horizontally and vertically). Use CTRL-W b?
  1842. XRe-select last Visual selection with "v." (exactly same text, from '[ to ']).
  1843. XDon't write any pages into the swapfile until the buffer has been changed.
  1844. XCatch terminating signals and call ml_sync_all(): SIGHUP, SIGINT, SIGQUIT,
  1845. X    SIGILL, SIGABRT, SIGFPE, SIGPIPE, SIGALRM, SIGTERM, SIGBUS, SIGSEGV.
  1846. XChange ".swp" to ".vim", because it give a hint who created the file?
  1847. XUse termcap 'ts' and 'fs' entries for setting the window title. Check 'hs'
  1848. X    and use minimum of 'ws' (if present) and Columns to truncate the title.
  1849. XWhen writing check for file exists but no permission, "Permission denied".
  1850. XIn dosub() regexec is called twice for the same line. Try to avoid this.
  1851. XWhen line is too long to fit on screen, don't display it.
  1852. XWhen inserting makes cursor go past end of screen, scroll up in insertchar().
  1853. XWindow updating from memline.c: insert/delete/replace line.
  1854. XOptimize ml_append() for speed, esp. for reading a file.
  1855. XV..c should keep indent when 'ai' is set, just like <count>cc.
  1856. XIn visual select mode: Inclusion or exclusion of char under cursor depends
  1857. X    on movement command. "vwd" and "dw" do the same???
  1858. XFind out why macros of Stephen Riehm are working strange.
  1859. X:s///p prints the line after a substitution.
  1860. XMake CTRL-R (insert register contents) also work in command line mode.
  1861. XUpdatescript() can be done faster with a string instead of a char.
  1862. XAdd arguments to ":args", like ":next".
  1863. XWhen searching with 'n' give message when getting back where the search first
  1864. X    started. Remember start of search in '/ mark.
  1865. XAdd option that scrolls screen to put cursor in middle of screen after search.
  1866. XAdd \! to search patterns: matches string that does not match previous atom.
  1867. XScreen updating is inefficient with CTRL-F and CTRL-B when there are long lines.
  1868. XUse 'backupdir' for all backup files if it starts with '>'.
  1869. XWhen writing a file, name it "foo.new". Then rename "foo" to "foo.bak" and
  1870. X    "foo.new" to "foo". If dir is not writable or on write error copy "foo"
  1871. X    to "backupdir/foo.bak" and overwrite "foo". Check for correct group/owner
  1872. X    and try to set it if not. NO: this breaks with hard links.
  1873. X    INSTEAD: make Amiga and MSDOS work like unix: first make copy of file, then
  1874. X    truncate and overwrite original file. Use an option for this, default
  1875. X    on for Unix, off for Amiga/MSDOS.
  1876. XUse CTRL-E and CTRL-Y in insert mode for scroll up/down?
  1877. XUppercase characters in ex commands can be made lowercase?
  1878. XAdd t_del, code for delete key (termcap 'kD') and maybe some other keys:
  1879. X    'kI' insert key, 'kL' delete line, t_bs 'bs', etc.
  1880. XFiltering a block should only apply to the block, not to the whole lines. When
  1881. X    the number of lines is increased, add lines. When decreased, padd with
  1882. X    spaces or delete?
  1883. XCTRL-V > should move the block, not whole lines.
  1884. XAdd commands to move selected text, without deselecting.
  1885. XAdd "p" command to swap selected text with unnamed buffer.
  1886. XAdd "P" command to insert contents of unnamed buffer, move selected text to
  1887. X    position of previous deleted (to swap foo and bar in " + foo")
  1888. XIn out-of-memory situations: Free allocated space in undo (after asking).
  1889. X8-bit codes between 0x80 and 0xa0 cannot be typed directly (mostly msdos
  1890. X    problem). Need more codes for delete key and more function keys. Use
  1891. X    2-byte code? (see xvim).
  1892. XInsert octal numbers with CTRL-V o, hexadecimal with CTRL-V x and binary
  1893. X    with CTRL-V b.
  1894. XList mappings: Once with and without ^ and ~ (meta keys). Use "F1" and "PgUp"
  1895. X    for MSDOS default mappings.
  1896. XAdd option that tells which characters to display directly, e.g.
  1897. X    ":set gr=32-126,140-244", others are displayed with ^ and ~ and +
  1898. XAdd option to show character value in octal, decimal, hex and screen code.
  1899. XHow does vi detect whether a filter has messed up the screen? Check source.
  1900. X    After ":w !command" a wait_return?
  1901. XImprove screen updating code for doput() (use s_ins()).
  1902. XWith 'p' command on last line: scroll screen up (also for terminals without
  1903. X    insert line command).
  1904. XAmiga: ExpandWildCards in amiga.c: don't expand if there are no wildcards.
  1905. Xunix: Speedup wildcard expansion of "*", "~" and "$": do it internally, more
  1906. X    complicated things can still be done with the shell.
  1907. XOnly do wildcard expansion with 'wildchar' when entering a command that has a
  1908. X    file name as argument (:r :w :! :e :f :n)?
  1909. XUnix: When comparing two file names to see if they are the same file use stat()
  1910. X    and compare device/inode; much faster than FullPathName()
  1911. XIn regexp.c: "\^" after "\|" or "\(" is start of line, and "\$" before "\|"
  1912. X    and "\)" is end of line.
  1913. XRemember the "last changed" time of the edited file and check it before
  1914. X    overwriting; another user may have changed it.
  1915. XSupport for command lines longer than 256 characters (for EXINIT).
  1916. XOption for filter when reading/writing a file for compression or crypting.
  1917. XOption to set time for emsg() sleep. Interrupt sleep when key is typed? sleep
  1918. X    before second message?
  1919. XDelete message after new command has been entered and have waited for key.
  1920. XAdd "next tag" command for tags that have multiple hits.
  1921. XSupport static tags: first search for tags with current filename: "foo.c:bar",
  1922. X    then for global tags (without a filename).
  1923. XHistory stack for . command?
  1924. XUse insert/delete char when terminal supports it.
  1925. XWith undo with simple line delete/insert: optimize screen updating.
  1926. XOptimize screen redraw for slow terminals.
  1927. X"edit" option: when off changing the buffer is not possible.
  1928. XAdd "-d null" for editing from a script file without displaying.
  1929. XAdd "-R" for readonly mode (ex has it).
  1930. XWhen writing to a readonly file, ask for permission to overwrite it (if file can
  1931. X    be made writable) and restore file to readonly afterwards.
  1932. XMSDOS: search for _exrc in the directory where the binary is, instead
  1933. X    of using $VIM\_exrc.
  1934. XIn insert mode: Remember the characters that were removed with backspace and
  1935. X    re-insert them one at a time with <key1>, all together with <key2>.
  1936. XAmiga: Add possibility to set a keymap. The code in amiga.c does not work yet.
  1937. XImplement 'redraw' option.
  1938. XAdd possibility to put the value of an option into the text: "'lines'p
  1939. XUnix: WildExpand: Without csh file name with embedded space will be split in two.
  1940. XWith wildcard expansion after '%' and '#', expand current/alternate file name, so
  1941. X    it can be edited.
  1942. XAdd special code to 'sections' option to define something else but '{' or '}'
  1943. X    as the start of a section (e.g. one shiftwidth to the right).
  1944. XNopaste option: Mappings with non-printable characters are OK.
  1945. XAdd 'indent' option: Always use this amount of indent when starting a new line
  1946. X    and when formatting text.
  1947. XAdd 'crown' option to 'Q' command: preserve indent of second line.
  1948. XWhen formatting with 'Q', break at paragraph boundaries (empty lines).
  1949. XWhen 'textwidth' is negative, use for 'Q' only, no automatic formatting.
  1950. XAdd option 'comment', initally "/*,*,*/,#", giving the characters at start of
  1951. X    a line that should be left alone by the internal formatting.
  1952. XAfter formatting with Q the cursor is on the end of the last line; with = and
  1953. X    when formatprg is set it is at the start of the first line. Not good.
  1954. XAdd 'scrolloff': scroll when cursor is less then 'scrolloff' lines from top/bottom.
  1955. XAdd option to switch off ignoring braces inside quotes for "%" command??
  1956. XUse pipes for filtering on unix.
  1957. XAllow for +command and -option on any position in argv[].
  1958. XAdd commands like ]] and [[ that do not include the line jumped to.
  1959. XWhen :unab without matching "from" part and several matching "to" parts,
  1960. X    delete the entry that was used last, instead of the first in the list.
  1961. XAfter :set nowrap remove superflous redraw with wrong hor. offset if cursor
  1962. X    is right of the screen.
  1963. XAdd -x option: crypt/decrypt when writing/reading file.
  1964. XAdd count to ':', gives ":.,.+count-1"
  1965. XImprove online help: Fit into the window (also small ones), hypertext, etc.
  1966. X    (See also dh1:text/vi/vi.help). View help just like a file?
  1967. XSupport several errorformats, use the first format that matches.
  1968. XRecognize "$*" in 'makeprg'; replace it by the arguments to :make.
  1969. XAllow multiple arguments to :unmap.
  1970. XAdd option that contains characters which are included in identifiers;
  1971. X    default "[a-bA-B0-9]_", for LISP "[a-bA-B0-9]_-".
  1972. XWith :s///c highlight the pattern to be replaced and replace \&, ~, etc. when
  1973. X    showing the replacement pattern.
  1974. XAdd mappings for visual mode; use marks for start/end of selected text.
  1975. XWith ambigious mapping, print conflicting entry.
  1976. XIn insert mode add # for CTRL-R  (alternate filename).
  1977. XHighlight search string when found?
  1978. XCommand line: cursor up on empty line: go to previous command, on non-empty line:
  1979. X    go to previous matching command.
  1980. XAdd command to clear all mappings, "clearmap".
  1981. XAdd text justification option.
  1982. XWhen the edited file is a symlink, try to put the .swp file in the same dir as
  1983. X    the actual file. Adjust FullName().
  1984. XAdd new operator: clear, make area white (replace with spaces)
  1985. XAdd put function that replaces the text under it.
  1986. XAfter "inv"ing an option show the value: ":set invpaste" gives "paste is off".
  1987. XAfter ":read" set '[ and '] marks.
  1988. XIn fileio.c replace filemess() by outputting strings after each other (only
  1989. X    one wait_return().
  1990. XAfter executing a shell, put tty back in raw mode (for shells that mess with
  1991. X    the tty settings)
  1992. XMake program to transform termcap entries into something that fits in tcarr
  1993. X    structure.
  1994. XImprove error messages: when expanding '%': "no filename to substitute for '%'"
  1995. X    when expanding '#': "no alternate filename to substitute for '#'"
  1996. XPut warnings in some color (errors are inverted, normal messages plain).
  1997. XCheck handling of CTRL-V and '\' for ":" commands that do not have TRLBAR.
  1998. XWhen a file cannot be opened but does exist, give error message.
  1999. XIf file does not exists, check if directory exists.
  2000. XMSDOS: t_cv and t_ci not set, but do invert char under cursor.
  2001. XAdd option to switch off move to start of line (Waggoner/12 and 13).
  2002. XCommand to show keys that are not used and available for mapping.
  2003. XSettings edit mode: make file with ":set opt=xx", edit it, parse it as ex commands.
  2004. XWhen memory gets low, reduce the number of undo levels (with confirmation).
  2005. XAdd 'para_regex' option: regular expression for end of paragraph.
  2006. Xtag-completion command: when tag found, replace it by the prototype, when not
  2007. X    found, replace it by the longest match.
  2008. Xmake listings in a more-like way (mappings, files, settings, etc.).
  2009. X":set -w all": list one option per line.
  2010. XBefore overwriting a non-writable file with ":w!" ask for permission.
  2011. XAmiga: test for 'w' flag when reading a file.
  2012. XWhen appending to the last line, causing it to wrap, screen redraw first does it
  2013. X    at a wrong position.
  2014. XInclude patches for Russian text (Marinichev/4).
  2015. XEx commands in a mapping should not be put in the command line history.
  2016. XOption not to change the search string when using a :tag command.
  2017. XError message for ambiguous mapping: Include the arguments.
  2018. XAdd ":retab". When "et" set, convert tabs to spaces, when "noet" vice versa.
  2019. X    ":retab 8" will replace tabs and spaces with the current "ts" setting
  2020. X    to a "ts" of 8.
  2021. X:table command (Webb)
  2022. XAdd command to go to last non-blank in line (like 0 vs. ^, $ vs. ???)
  2023. XAdd 'backupdiralways', 'bda' option for 'bdir', like 'da' for 'dir'.
  2024. XAdd option to recognize identifiers with everything but spaces ('forth'?).
  2025. X    Adjust isidchar().
  2026. XMSDOS: How about supporting function keys #11 and #12?
  2027. XWith blockwise visual mode and "c" command, insert same text in every line.
  2028. XSearch filenames for starting with $HOME and replace it with "~" when displaying.
  2029. XFor 'shell' option add possibility to give arguments for fast start (e.g. -f).
  2030. X    Not to be used for ":shell".
  2031. XMake ":e file1 file2" work like ":n file1 file2"?
  2032. XGive message "No lines in buffer" when last line in buffer deleted.
  2033. XWhen displaying (file xx of yy), add "not" when curbuf is not file xx.
  2034. XAdd commands to do things in all buffers: ":Substitute", ":searchall", etc.
  2035. XMake ":sleep" accept floating point numbers, like ":sleep 0.01".
  2036. XWhen in replace mode and 'expandtab' set, make tab look like spaces.
  2037. XSupport multiple search buffers, so macros can be made without side effects.
  2038. XWith :read set '[ and '] to start/end of new lines
  2039. XMake builtin termcaps with a configuration file and a program to translate
  2040. X    it into a .h file.
  2041. XUse %> and #> for filename without path?
  2042. XAllow multiple arguments for ":edit", add them to the argument list.
  2043. XAllow multiple arguments for ":read", read all the files.
  2044. XMake options from modelines only used in the buffer where the file is read.
  2045. XFor visual mode: "." does a search for the string in the marked area. Only
  2046. X    when less than two lines. What key to use for backward search?
  2047. XMatching with "%" should be configurable. 'matchstrings' =
  2048. X        (/*,*/),(^#if,^#else,^#endif)
  2049. XExpanding ~ and $VAR in options should be done not only for the first entry.
  2050. XAdd 'resizecmd' option: vi command to be executed when window is resized.
  2051. XDo not accept mappings when waiting for key hit with --more--.
  2052. XAdd option to make settings from modelines valid only in the file where they
  2053. X    were set. Reset options when starting to edit another file.
  2054. XKeep output from listings in a window, so you can have a look at it while
  2055. X    working in another window. Put cmdline in a separate window?
  2056. XKeyword completion code should use the case from the match.
  2057. XAdd regular expression \{m,n\}: m to n matches. \{m\} is m matches, \{m,\} is
  2058. X    at least m matches. Also do \{,n\}: up to n matches.
  2059. XWhen 'backup' is not set and 'writebackup is set, use a unique name for the
  2060. X    backup file, don't deleted the ".bak" file.
  2061. X
  2062. XFrom Elvis:
  2063. Xfontchanges recognized "\\fB" etc.
  2064. X:color command
  2065. X:if and friends, conditional statements
  2066. XRead .exfilerc when starting to edit a new file (can be used to load macros for
  2067. X    specific file type).
  2068. XChange cursor shape in command/insert mode.
  2069. X'flipcase' variable: upper/lower case pairs.
  2070. X
  2071. XFrom nvi:
  2072. X'cdpath' option.
  2073. X'remapmax' option.
  2074. XAllow editing lines that do not fit in the window.
  2075. X
  2076. XFrom xvim:
  2077. XUse '\' before commands to make them linewise.
  2078. XAllow a newline in search patterns (also for :s, can delete newline).
  2079. X    Add BOW, EOW, NEWL, NLORANY, NLBUTANY, magic 'n' and 'r', etc.
  2080. XAdd register for ':', '?' and '/' commands? (yank_buf()).
  2081. XSupport mouse control (also weissman/1). With option to switch it off to
  2082. X    enable copy/paste.
  2083. XSearching in help file.
  2084. Xget code for backspace from termcap.
  2085. XRemember last cursor position, optimize setcursor().
  2086. X
  2087. XFrom xvi:
  2088. XCTRL-_ : swap 8th bit of character
  2089. X
  2090. XFrom vile:
  2091. XCTRL-X e: edit file name under the cursor (like ^] and *)
  2092. XShow unprintable characters in hex.
  2093. XUse scrollbar.
  2094. XWhen horizontal scrolling, use '<' and '>' for lines continuing outside of window.
  2095. X
  2096. XFar future extentions:
  2097. X
  2098. XAllow vertical splitting of screen (once).
  2099. XAllow editing beyond end of line, just like there are all spaces. Switch this
  2100. X    on with an option or special insert mode command. Also allow editing
  2101. X    above start and below end of buffer.
  2102. XMSdos: use extended or expanded memory.
  2103. XWhen executing macro's: Save each line for undo only once.
  2104. XSmart cut/paste: recognize words and adjust spaces before/after them.
  2105. XAdd 'notwsuffixes' option: suffixes for files where 'tw' should be 0.
  2106. XMake files with suffix in 'suffixes' option always appear in list of matched
  2107. X    files, but at the end.
  2108. XKeyword completion: first look in the file for a match, then in a dictionary (Webb).
  2109. XOption verbose; when on keep the screen uptodate, when off only redisplay when
  2110. X    input needed.
  2111. XChange the output to the message line. Don't redraw the screen until the next
  2112. X    vi command. Remember message line for redraw. Integrate the command line
  2113. X    in updateScreen().
  2114. XMode to keep text formatted while inserting/deleting. Use soft/hard returns with
  2115. X    an option to switch this off.
  2116. XMode to keep C-code formatted (sort of on-line indent). Use colors for
  2117. X    keywords, comments, etc.
  2118. XKorn-shell like command line editing (like editing a single line with vi). Use
  2119. X    :cmap! for mappings. Can be implemented like a buffer containing command
  2120. X    lines.
  2121. XAdd column numbers to ":" commands (:line1:col1,line2:col2 cmd). Block can be
  2122. X    selected with CTRL-V.
  2123. XAdd 'hidecomment' option: don't display comments in /* */ and after //.
  2124. XAdd open mode, use it when terminal has no cursor positioning.
  2125. XAdd macro language with real functions.
  2126. XFile in local directory to store contents of named registers and named marks.
  2127. X    Write when quitting, read when starting.
  2128. XSpecial "drawing mode": a line is drawn where the cursor is moved to. Backspace
  2129. X    deletes along the line (from jvim).
  2130. XSave cursor position (and other things) for a next editing session.
  2131. XPerform commands on multiple windows (:W%s/foo/bar/g), multiple arguments (:A)
  2132. X    or multiple buffers (:B).
  2133. END_OF_FILE
  2134.   if test 19200 -ne `wc -c <'vim/todo'`; then
  2135.     echo shar: \"'vim/todo'\" unpacked with wrong size!
  2136.   fi
  2137.   # end of 'vim/todo'
  2138. fi
  2139. echo shar: End of archive 20 \(of 26\).
  2140. cp /dev/null ark20isdone
  2141. MISSING=""
  2142. 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
  2143.     if test ! -f ark${I}isdone ; then
  2144.     MISSING="${MISSING} ${I}"
  2145.     fi
  2146. done
  2147. if test "${MISSING}" = "" ; then
  2148.     echo You have unpacked all 26 archives.
  2149.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2150. else
  2151.     echo You still must unpack the following archives:
  2152.     echo "        " ${MISSING}
  2153. fi
  2154. exit 0
  2155. exit 0 # Just in case...
  2156.