home *** CD-ROM | disk | FTP | other *** search
- From: mool@oce.nl (Bram Moolenaar)
- Newsgroups: comp.sources.misc
- Subject: v44i026: vim - Vi IMproved editor, v3.0, Part07/26
- Date: 16 Aug 1994 21:17:56 -0500
- Organization: Sterling Software
- Sender: kent@sparky.sterling.com
- Approved: kent@sparky.sterling.com
- Message-ID: <32rs0k$kcm@sparky.sterling.com>
- X-Md4-Signature: 327b850d2f6314ae9071ae181a1ec6c9
-
- Submitted-by: mool@oce.nl (Bram Moolenaar)
- Posting-number: Volume 44, Issue 26
- Archive-name: vim/part07
- Environment: UNIX, AMIGA, MS-DOS, Windows NT
- Supersedes: vim: Volume 41, Issue 50-75
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: vim/src/screen.c vim/src/tcconfig.tc.UU vim/src/version.c
- # Wrapped by kent@sparky on Mon Aug 15 21:44:01 1994
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 7 (of 26)."'
- if test -f 'vim/src/screen.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'vim/src/screen.c'\"
- else
- echo shar: Extracting \"'vim/src/screen.c'\" \(46442 characters\)
- sed "s/^X//" >'vim/src/screen.c' <<'END_OF_FILE'
- X/* vi:ts=4:sw=4
- X *
- X * VIM - Vi IMproved by Bram Moolenaar
- X *
- X * Read the file "credits.txt" for a list of people who contributed.
- X * Read the file "uganda.txt" for copying and usage conditions.
- X */
- X
- X/*
- X * screen.c: code for displaying on the screen
- X */
- X
- X#include "vim.h"
- X#include "globals.h"
- X#include "proto.h"
- X#include "param.h"
- X
- Xchar *tgoto __PARMS((char *cm, int col, int line));
- X
- Xstatic char_u *Nextscreen = NULL; /* What is currently on the screen. */
- Xstatic char_u **LinePointers = NULL; /* array of pointers into Nextscreen */
- X
- X/*
- X * Cline_height is set (in cursupdate) to the number of physical
- X * lines taken by the line the cursor is on. We use this to avoid extra calls
- X * to plines(). The optimized routine updateline()
- X * makes sure that the size of the cursor line hasn't changed. If so, lines
- X * below the cursor will move up or down and we need to call the routine
- X * updateScreen() to examine the entire screen.
- X */
- Xstatic int Cline_height; /* current size of cursor line */
- X
- Xstatic int Cline_row; /* starting row of the cursor line on screen */
- X
- Xstatic FPOS old_cursor = {0, 0}; /* last known end of visual part */
- Xstatic int oldCurswant = 0; /* last known value of Curswant */
- Xstatic int canopt; /* TRUE when cursor goto can be optimized */
- Xstatic int invert = 0; /* set to INVERTCODE when inverting */
- X
- X#define INVERTCODE 0x80
- X
- Xstatic int win_line __ARGS((WIN *, linenr_t, int, int));
- Xstatic void screen_char __ARGS((char_u *, int, int));
- Xstatic void screenalloc __ARGS((int));
- Xstatic void screenclear2 __ARGS((void));
- Xstatic int screen_ins_lines __ARGS((int, int, int, int));
- X
- X/*
- X * updateline() - like updateScreen() but only for cursor line
- X *
- X * This determines whether or not we need to call updateScreen() to examine
- X * the entire screen for changes. This occurs if the size of the cursor line
- X * (in rows) hasn't changed.
- X */
- X void
- Xupdateline()
- X{
- X int row;
- X int n;
- X
- X if (must_redraw) /* must redraw whole screen */
- X {
- X updateScreen(must_redraw);
- X return;
- X }
- X
- X screenalloc(TRUE); /* allocate screen buffers if size changed */
- X
- X if (Nextscreen == NULL || RedrawingDisabled)
- X return;
- X
- X screen_start(); /* init cursor position of screen_char() */
- X cursor_off();
- X
- X (void)set_highlight('v');
- X row = win_line(curwin, curwin->w_cursor.lnum, Cline_row, curwin->w_height);
- X
- X if (row == curwin->w_height + 1) /* line too long for window */
- X updateScreen(VALID_TO_CURSCHAR);
- X else
- X {
- X n = row - Cline_row;
- X if (n != Cline_height) /* line changed size */
- X {
- X if (n < Cline_height) /* got smaller: delete lines */
- X win_del_lines(curwin, row, Cline_height - n, FALSE, TRUE);
- X else /* got bigger: insert lines */
- X win_ins_lines(curwin, Cline_row + Cline_height, n - Cline_height, FALSE, TRUE);
- X updateScreen(VALID_TO_CURSCHAR);
- X }
- X }
- X}
- X
- X/*
- X * updateScreen()
- X *
- X * Based on the current value of curwin->w_topline, transfer a screenfull
- X * of stuff from Filemem to Nextscreen, and update curwin->w_botline.
- X */
- X
- X void
- XupdateScreen(type)
- X int type;
- X{
- X WIN *wp;
- X
- X screenalloc(TRUE); /* allocate screen buffers if size changed */
- X if (Nextscreen == NULL)
- X return;
- X
- X if (must_redraw)
- X {
- X if (type < must_redraw) /* use maximal type */
- X type = must_redraw;
- X must_redraw = 0;
- X }
- X
- X if (type == CURSUPD) /* update cursor and then redraw NOT_VALID*/
- X {
- X curwin->w_lsize_valid = 0;
- X cursupdate(); /* will call updateScreen() */
- X return;
- X }
- X if (curwin->w_lsize_valid == 0 && type != CLEAR)
- X type = NOT_VALID;
- X
- X if (RedrawingDisabled)
- X {
- X must_redraw = type; /* remember type for next time */
- X return;
- X }
- X
- X /*
- X * if the screen was scrolled up when displaying a message, scroll it down
- X */
- X if (msg_scrolled)
- X {
- X clear_cmdline = TRUE;
- X if (msg_scrolled > Rows - 5) /* clearing is faster */
- X type = CLEAR;
- X else if (type != CLEAR)
- X {
- X if (screen_ins_lines(0, 0, msg_scrolled, (int)Rows) == FAIL)
- X type = CLEAR;
- X win_rest_invalid(firstwin); /* should do only first/last few */
- X }
- X msg_scrolled = 0;
- X }
- X
- X /*
- X * reset cmdline_row now (may have been changed temporarily)
- X */
- X compute_cmdrow();
- X
- X if (type == CLEAR) /* first clear screen */
- X {
- X screenclear(); /* will reset clear_cmdline */
- X type = NOT_VALID;
- X }
- X
- X if (clear_cmdline)
- X gotocmdline(TRUE, NUL); /* first clear cmdline */
- X
- X/* return if there is nothing to do */
- X if ((type == VALID && curwin->w_topline == curwin->w_lsize_lnum[0]) ||
- X (type == INVERTED && old_cursor.lnum == curwin->w_cursor.lnum &&
- X old_cursor.col == curwin->w_cursor.col && curwin->w_curswant == oldCurswant))
- X return;
- X
- X curwin->w_redr_type = type;
- X
- X/*
- X * go from top to bottom through the windows, redrawing the ones that need it
- X */
- X cursor_off();
- X for (wp = firstwin; wp; wp = wp->w_next)
- X {
- X if (wp->w_redr_type)
- X win_update(wp);
- X if (wp->w_redr_status)
- X win_redr_status(wp);
- X }
- X if (redraw_cmdline)
- X showmode();
- X}
- X
- X/*
- X * update a single window
- X *
- X * This may cause the windows below it also to be redrawn
- X */
- X void
- Xwin_update(wp)
- X WIN *wp;
- X{
- X int type = wp->w_redr_type;
- X register int row;
- X register int endrow;
- X linenr_t lnum;
- X linenr_t lastline = 0; /* only valid if endrow != Rows -1 */
- X int done; /* if TRUE, we hit the end of the file */
- X int didline; /* if TRUE, we finished the last line */
- X int srow = 0; /* starting row of the current line */
- X int idx;
- X int i;
- X long j;
- X
- X if (type == NOT_VALID)
- X {
- X wp->w_redr_status = TRUE;
- X wp->w_lsize_valid = 0;
- X }
- X
- X idx = 0;
- X row = 0;
- X lnum = wp->w_topline;
- X
- X /* The number of rows shown is w_height. */
- X /* The default last row is the status/command line. */
- X endrow = wp->w_height;
- X
- X if (type == VALID || type == VALID_TO_CURSCHAR)
- X {
- X /*
- X * We handle two special cases:
- X * 1: we are off the top of the screen by a few lines: scroll down
- X * 2: wp->w_topline is below wp->w_lsize_lnum[0]: may scroll up
- X */
- X if (wp->w_topline < wp->w_lsize_lnum[0]) /* may scroll down */
- X {
- X j = wp->w_lsize_lnum[0] - wp->w_topline;
- X if (j < wp->w_height - 2) /* not too far off */
- X {
- X lastline = wp->w_lsize_lnum[0] - 1;
- X i = plines_m_win(wp, wp->w_topline, lastline);
- X if (i < wp->w_height - 2) /* less than a screen off */
- X {
- X /*
- X * Try to insert the correct number of lines.
- X * If not the last window, delete the lines at the bottom.
- X * win_ins_lines may fail.
- X */
- X if (win_ins_lines(wp, 0, i, FALSE, wp == firstwin) == OK &&
- X wp->w_lsize_valid)
- X {
- X endrow = i;
- X
- X if ((wp->w_lsize_valid += j) > wp->w_height)
- X wp->w_lsize_valid = wp->w_height;
- X for (idx = wp->w_lsize_valid; idx - j >= 0; idx--)
- X {
- X wp->w_lsize_lnum[idx] = wp->w_lsize_lnum[idx - j];
- X wp->w_lsize[idx] = wp->w_lsize[idx - j];
- X }
- X idx = 0;
- X }
- X }
- X else if (lastwin == firstwin) /* far off: clearing the screen is faster */
- X screenclear();
- X }
- X else if (lastwin == firstwin) /* far off: clearing the screen is faster */
- X screenclear();
- X }
- X else /* may scroll up */
- X {
- X j = -1;
- X for (i = 0; i < wp->w_lsize_valid; i++) /* try to find wp->w_topline in wp->w_lsize_lnum[] */
- X {
- X if (wp->w_lsize_lnum[i] == wp->w_topline)
- X {
- X j = i;
- X break;
- X }
- X row += wp->w_lsize[i];
- X }
- X if (j == -1) /* wp->w_topline is not in wp->w_lsize_lnum */
- X {
- X row = 0;
- X if (lastwin == firstwin)
- X screenclear(); /* far off: clearing the screen is faster */
- X }
- X else
- X {
- X /*
- X * Try to delete the correct number of lines.
- X * wp->w_topline is at wp->w_lsize_lnum[i].
- X */
- X if ((row == 0 || win_del_lines(wp, 0, row, FALSE, wp == firstwin) == OK) && wp->w_lsize_valid)
- X {
- X srow = row;
- X row = 0;
- X for (;;)
- X {
- X if (type == VALID_TO_CURSCHAR && lnum == wp->w_cursor.lnum)
- X break;
- X if (row + srow + (int)wp->w_lsize[j] >= wp->w_height)
- X break;
- X wp->w_lsize[idx] = wp->w_lsize[j];
- X wp->w_lsize_lnum[idx] = lnum++;
- X
- X row += wp->w_lsize[idx++];
- X if ((int)++j >= wp->w_lsize_valid)
- X break;
- X }
- X wp->w_lsize_valid = idx;
- X }
- X else
- X row = 0; /* update all lines */
- X }
- X }
- X if (endrow == wp->w_height && idx == 0) /* no scrolling */
- X wp->w_lsize_valid = 0;
- X }
- X
- X done = didline = FALSE;
- X screen_start(); /* init cursor position of screen_char() */
- X
- X if (VIsual.lnum) /* check if we are updating the inverted part */
- X {
- X linenr_t from, to;
- X
- X /* find the line numbers that need to be updated */
- X if (wp->w_cursor.lnum < old_cursor.lnum)
- X {
- X from = wp->w_cursor.lnum;
- X to = old_cursor.lnum;
- X }
- X else
- X {
- X from = old_cursor.lnum;
- X to = wp->w_cursor.lnum;
- X }
- X /* if in block mode and changed column or wp->w_curswant: update all lines */
- X if (Visual_block && (wp->w_cursor.col != old_cursor.col || wp->w_curswant != oldCurswant))
- X {
- X if (from > VIsual.lnum)
- X from = VIsual.lnum;
- X if (to < VIsual.lnum)
- X to = VIsual.lnum;
- X }
- X
- X if (from < wp->w_topline)
- X from = wp->w_topline;
- X if (to >= wp->w_botline)
- X to = wp->w_botline - 1;
- X
- X /* find the minimal part to be updated */
- X if (type == INVERTED)
- X {
- X while (lnum < from) /* find start */
- X {
- X row += wp->w_lsize[idx++];
- X ++lnum;
- X }
- X srow = row;
- X for (j = idx; j < wp->w_lsize_valid; ++j) /* find end */
- X {
- X if (wp->w_lsize_lnum[j] == to + 1)
- X {
- X endrow = srow;
- X break;
- X }
- X srow += wp->w_lsize[j];
- X }
- X old_cursor = wp->w_cursor;
- X oldCurswant = wp->w_curswant;
- X }
- X /* if we update the lines between from and to set old_cursor */
- X else if (lnum <= from && (endrow == wp->w_height || lastline >= to))
- X {
- X old_cursor = wp->w_cursor;
- X oldCurswant = wp->w_curswant;
- X }
- X }
- X
- X (void)set_highlight('v');
- X
- X /*
- X * Update the screen rows from "row" to "endrow".
- X * Start at line "lnum" which is at wp->w_lsize_lnum[idx].
- X */
- X for (;;)
- X {
- X if (lnum > wp->w_buffer->b_ml.ml_line_count) /* hit the end of the file */
- X {
- X done = TRUE;
- X break;
- X }
- X srow = row;
- X row = win_line(wp, lnum, srow, endrow);
- X if (row > endrow) /* past end of screen */
- X {
- X wp->w_lsize[idx] = plines_win(wp, lnum); /* we may need the size of that */
- X wp->w_lsize_lnum[idx++] = lnum; /* too long line later on */
- X break;
- X }
- X
- X wp->w_lsize[idx] = row - srow;
- X wp->w_lsize_lnum[idx++] = lnum;
- X if (++lnum > wp->w_buffer->b_ml.ml_line_count)
- X {
- X done = TRUE;
- X break;
- X }
- X
- X if (row == endrow)
- X {
- X didline = TRUE;
- X break;
- X }
- X }
- X if (idx > wp->w_lsize_valid)
- X wp->w_lsize_valid = idx;
- X
- X /* Do we have to do off the top of the screen processing ? */
- X if (endrow != wp->w_height)
- X {
- X row = 0;
- X for (idx = 0; idx < wp->w_lsize_valid && row < wp->w_height; idx++)
- X row += wp->w_lsize[idx];
- X
- X if (row < wp->w_height)
- X {
- X done = TRUE;
- X }
- X else if (row > wp->w_height) /* Need to blank out the last line */
- X {
- X lnum = wp->w_lsize_lnum[idx - 1];
- X srow = row - wp->w_lsize[idx - 1];
- X didline = FALSE;
- X }
- X else
- X {
- X lnum = wp->w_lsize_lnum[idx - 1] + 1;
- X didline = TRUE;
- X }
- X }
- X
- X wp->w_empty_rows = 0;
- X /*
- X * If we didn't hit the end of the file, and we didn't finish the last
- X * line we were working on, then the line didn't fit.
- X */
- X if (!done && !didline)
- X {
- X if (lnum == wp->w_topline)
- X {
- X /*
- X * Single line that does not fit!
- X * Fill last line with '@' characters.
- X */
- X screen_fill(wp->w_winpos + wp->w_height - 1, wp->w_winpos + wp->w_height, 0, (int)Columns, '@', '@');
- X wp->w_botline = lnum + 1;
- X }
- X else
- X {
- X /*
- X * Clear the rest of the screen and mark the unused lines.
- X */
- X screen_fill(wp->w_winpos + srow, wp->w_winpos + wp->w_height, 0, (int)Columns, '@', ' ');
- X wp->w_botline = lnum;
- X wp->w_empty_rows = wp->w_height - srow;
- X }
- X }
- X else
- X {
- X /* make sure the rest of the screen is blank */
- X /* put '~'s on rows that aren't part of the file. */
- X screen_fill(wp->w_winpos + row, wp->w_winpos + wp->w_height, 0, (int)Columns, '~', ' ');
- X wp->w_empty_rows = wp->w_height - row;
- X
- X if (done) /* we hit the end of the file */
- X wp->w_botline = wp->w_buffer->b_ml.ml_line_count + 1;
- X else
- X wp->w_botline = lnum;
- X }
- X
- X wp->w_redr_type = 0;
- X}
- X
- X/*
- X * mark all status lines for redraw; used after first :cd
- X */
- X void
- Xstatus_redraw_all()
- X{
- X WIN *wp;
- X
- X for (wp = firstwin; wp; wp = wp->w_next)
- X wp->w_redr_status = TRUE;
- X updateScreen(NOT_VALID);
- X}
- X
- X/*
- X * Redraw the status line of window wp.
- X *
- X * If inversion is possible we use it. Else '=' characters are used.
- X */
- X void
- Xwin_redr_status(wp)
- X WIN *wp;
- X{
- X int row;
- X int col;
- X char_u *p;
- X int len;
- X int fillchar;
- X
- X if (wp->w_status_height) /* if there is a status line */
- X {
- X if (set_highlight('s') == OK) /* can highlight */
- X {
- X fillchar = ' ';
- X start_highlight();
- X }
- X else /* can't highlight, use '=' */
- X fillchar = '=';
- X
- X screen_start(); /* init cursor position */
- X row = wp->w_winpos + wp->w_height;
- X col = 0;
- X p = wp->w_buffer->b_xfilename;
- X if (p == NULL)
- X p = (char_u *)"[No File]";
- X else
- X {
- X home_replace(p, NameBuff, MAXPATHL);
- X p = NameBuff;
- X }
- X len = STRLEN(p);
- X if (wp->w_buffer->b_changed)
- X len += 4;
- X if (len > ru_col - 1)
- X {
- X screen_outchar('<', row, 0);
- X p += len - (ru_col - 1) + 1;
- X len = (ru_col - 1);
- X col = 1;
- X }
- X screen_msg(p, row, col);
- X if (wp->w_buffer->b_changed)
- X screen_msg((char_u *)" [+]", row, len - 4);
- X screen_fill(row, row + 1, len, ru_col, fillchar, fillchar);
- X
- X stop_highlight();
- X win_redr_ruler(wp, TRUE);
- X }
- X else /* no status line, can only be last window */
- X redraw_cmdline = TRUE;
- X wp->w_redr_status = FALSE;
- X}
- X
- X/*
- X * display line "lnum" of window 'wp' on the screen
- X * Start at row "startrow", stop when "endrow" is reached.
- X * Return the number of last row the line occupies.
- X */
- X
- X static int
- Xwin_line(wp, lnum, startrow, endrow)
- X WIN *wp;
- X linenr_t lnum;
- X int startrow;
- X int endrow;
- X{
- X char_u *screenp;
- X int c;
- X int col; /* visual column on screen */
- X long vcol; /* visual column for tabs */
- X int row; /* row in the window, excluding w_winpos */
- X int screen_row; /* row on the screen, including w_winpos */
- X char_u *ptr;
- X char_u extra[16]; /* "%ld" must fit in here */
- X char_u *p_extra;
- X int n_extra;
- X int n_spaces = 0;
- X
- X int fromcol, tocol; /* start/end of inverting */
- X int noinvcur = FALSE; /* don't invert the cursor */
- X int temp;
- X FPOS *top, *bot;
- X
- X row = startrow;
- X screen_row = row + wp->w_winpos;
- X col = 0;
- X vcol = 0;
- X fromcol = -10;
- X tocol = MAXCOL;
- X canopt = TRUE;
- X if (VIsual.lnum && wp == curwin) /* visual active in this window */
- X {
- X if (ltoreq(wp->w_cursor, VIsual)) /* Visual is after wp->w_cursor */
- X {
- X top = &wp->w_cursor;
- X bot = &VIsual;
- X }
- X else /* Visual is before wp->w_cursor */
- X {
- X top = &VIsual;
- X bot = &wp->w_cursor;
- X }
- X if (Visual_block) /* block mode */
- X {
- X if (lnum >= top->lnum && lnum <= bot->lnum)
- X {
- X fromcol = getvcol(wp, top, 2);
- X temp = getvcol(wp, bot, 2);
- X if (temp < fromcol)
- X fromcol = temp;
- X
- X if (wp->w_curswant != MAXCOL)
- X {
- X tocol = getvcol(wp, top, 3);
- X temp = getvcol(wp, bot, 3);
- X if (temp > tocol)
- X tocol = temp;
- X ++tocol;
- X }
- X }
- X }
- X else /* non-block mode */
- X {
- X if (lnum > top->lnum && lnum <= bot->lnum)
- X fromcol = 0;
- X else if (lnum == top->lnum)
- X fromcol = getvcol(wp, top, 2);
- X if (lnum == bot->lnum)
- X tocol = getvcol(wp, bot, 3) + 1;
- X
- X if (VIsual.col == VISUALLINE) /* linewise */
- X {
- X if (fromcol > 0)
- X fromcol = 0;
- X tocol = VISUALLINE;
- X }
- X }
- X /* if the cursor can't be switched off, don't invert the character
- X where the cursor is */
- X if ((T_CI == NULL || *T_CI == NUL) && lnum == wp->w_cursor.lnum)
- X noinvcur = TRUE;
- X
- X if (tocol <= wp->w_leftcol) /* inverting is left of screen */
- X fromcol = 0;
- X else if (fromcol >= 0 && fromcol < wp->w_leftcol) /* start of invert is left of screen */
- X fromcol = wp->w_leftcol;
- X
- X /* if inverting in this line, can't optimize cursor positioning */
- X if (fromcol >= 0)
- X canopt = FALSE;
- X }
- X
- X ptr = ml_get_buf(wp->w_buffer, lnum, FALSE);
- X if (!wp->w_p_wrap) /* advance to first character to be displayed */
- X {
- X while (vcol < wp->w_leftcol && *ptr)
- X vcol += chartabsize(*ptr++, vcol);
- X if (vcol > wp->w_leftcol)
- X {
- X n_spaces = vcol - wp->w_leftcol; /* begin with some spaces */
- X vcol = wp->w_leftcol;
- X }
- X }
- X screenp = LinePointers[screen_row];
- X if (wp->w_p_nu)
- X {
- X sprintf((char *)extra, "%7ld ", (long)lnum);
- X p_extra = extra;
- X n_extra = 8;
- X vcol -= 8; /* so vcol is 0 when line number has been printed */
- X }
- X else
- X {
- X p_extra = NULL;
- X n_extra = 0;
- X }
- X for (;;)
- X {
- X if (!canopt) /* Visual in this line */
- X {
- X if (((vcol == fromcol && !(noinvcur && vcol == wp->w_virtcol)) ||
- X (noinvcur && vcol == wp->w_virtcol + 1 && vcol >= fromcol)) &&
- X vcol < tocol)
- X start_highlight(); /* start highlighting */
- X else if (invert && (vcol == tocol || (noinvcur && vcol == wp->w_virtcol)))
- X stop_highlight(); /* stop highlighting */
- X }
- X
- X /* Get the next character to put on the screen. */
- X /*
- X * The 'extra' array contains the extra stuff that is inserted to
- X * represent special characters (non-printable stuff).
- X */
- X
- X if (n_extra)
- X {
- X c = *p_extra++;
- X n_extra--;
- X }
- X else if (n_spaces)
- X {
- X c = ' ';
- X n_spaces--;
- X }
- X else
- X {
- X if ((c = *ptr++) < ' ' || (c > '~' && c <= 0xa0))
- X {
- X /*
- X * when getting a character from the file, we may have to turn it
- X * into something else on the way to putting it into 'Nextscreen'.
- X */
- X if (c == TAB && !wp->w_p_list)
- X {
- X /* tab amount depends on current column */
- X n_spaces = (int)wp->w_buffer->b_p_ts - vcol % (int)wp->w_buffer->b_p_ts - 1;
- X c = ' ';
- X }
- X else if (c == NUL && wp->w_p_list)
- X {
- X p_extra = (char_u *)"";
- X n_extra = 1;
- X c = '$';
- X }
- X else if (c != NUL)
- X {
- X p_extra = transchar(c);
- X n_extra = charsize(c) - 1;
- X c = *p_extra++;
- X }
- X }
- X }
- X
- X if (c == NUL)
- X {
- X if (invert)
- X {
- X if (vcol == 0) /* invert first char of empty line */
- X {
- X if (*screenp != (' ' ^ INVERTCODE))
- X {
- X *screenp = (' ' ^ INVERTCODE);
- X screen_char(screenp, screen_row, col);
- X }
- X ++screenp;
- X ++col;
- X }
- X stop_highlight();
- X }
- X /*
- X * blank out the rest of this row, if necessary
- X */
- X while (col < Columns && *screenp == ' ')
- X {
- X ++screenp;
- X ++col;
- X }
- X if (col < Columns)
- X {
- X screen_fill(screen_row, screen_row + 1, col, (int)Columns, ' ', ' ');
- X col = Columns;
- X }
- X row++;
- X screen_row++;
- X break;
- X }
- X if (col >= Columns)
- X {
- X col = 0;
- X ++row;
- X ++screen_row;
- X if (!wp->w_p_wrap)
- X break;
- X if (row == endrow) /* line got too long for screen */
- X {
- X ++row;
- X break;
- X }
- X screenp = LinePointers[screen_row];
- X }
- X
- X /*
- X * Store the character in Nextscreen.
- X * Be careful with characters where (c ^ INVERTCODE == ' '), they may be
- X * confused with spaces inserted by scrolling.
- X */
- X if (*screenp != (c ^ invert) || c == (' ' ^ INVERTCODE))
- X {
- X *screenp = (c ^ invert);
- X screen_char(screenp, screen_row, col);
- X }
- X ++screenp;
- X col++;
- X vcol++;
- X }
- X
- X if (invert)
- X stop_highlight();
- X return (row);
- X}
- X
- X/*
- X * output a single character directly to the screen
- X * update NextScreen
- X * Note: must do screen_start() before this!
- X */
- X void
- Xscreen_outchar(c, row, col)
- X int c;
- X int row, col;
- X{
- X char_u buf[2];
- X
- X buf[0] = c;
- X buf[1] = NUL;
- X screen_msg(buf, row, col);
- X}
- X
- X/*
- X * put string '*msg' on the screen at position 'row' and 'col'
- X * update NextScreen
- X * Note: only outputs within one row, message is truncated at screen boundary!
- X * Note: must do screen_start() before this!
- X * Note: caller must make sure that row is valid!
- X */
- X void
- Xscreen_msg(msg, row, col)
- X char_u *msg;
- X int row;
- X int col;
- X{
- X char_u *screenp;
- X
- X screenp = LinePointers[row] + col;
- X while (*msg && col < Columns)
- X {
- X if (*screenp != (*msg ^ invert) || *msg == (' ' ^ INVERTCODE))
- X {
- X *screenp = (*msg ^ invert);
- X screen_char(screenp, row, col);
- X }
- X ++screenp;
- X ++col;
- X ++msg;
- X }
- X}
- X
- X/*
- X * last cursor position known by screen_char
- X */
- Xstatic int oldrow, oldcol; /* old cursor position */
- X
- X/*
- X * reset cursor position. Use whenever cursor moved before calling screen_char.
- X */
- X void
- Xscreen_start()
- X{
- X oldcol = 9999;
- X}
- X
- X/*
- X * set_highlight - set highlight depending on 'highlight' option and context.
- X *
- X * return FAIL if highlighting is not possible, OK otherwise
- X */
- X int
- Xset_highlight(context)
- X int context;
- X{
- X int len;
- X int i;
- X int mode;
- X
- X len = STRLEN(p_hl);
- X for (i = 0; i < len; i += 3)
- X if (p_hl[i] == context)
- X break;
- X if (i < len)
- X mode = p_hl[i + 1];
- X else
- X mode = 'i';
- X switch (mode)
- X {
- X case 'b': highlight = T_TB; /* bold */
- X unhighlight = T_TP;
- X break;
- X case 's': highlight = T_SO; /* standout */
- X unhighlight = T_SE;
- X break;
- X case 'n': highlight = NULL; /* no highlighting */
- X unhighlight = NULL;
- X break;
- X default: highlight = T_TI; /* invert/reverse */
- X unhighlight = T_TP;
- X break;
- X }
- X if (highlight == NULL || *highlight == NUL ||
- X unhighlight == NULL || *unhighlight == NUL)
- X {
- X highlight = NULL;
- X return FAIL;
- X }
- X return OK;
- X}
- X
- X void
- Xstart_highlight()
- X{
- X if (highlight != NULL)
- X {
- X outstr(highlight);
- X invert = INVERTCODE;
- X }
- X}
- X
- X void
- Xstop_highlight()
- X{
- X if (invert)
- X {
- X outstr(unhighlight);
- X invert = 0;
- X }
- X}
- X
- X/*
- X * put character '*p' on the screen at position 'row' and 'col'
- X */
- X static void
- Xscreen_char(p, row, col)
- X char_u *p;
- X int row;
- X int col;
- X{
- X int c;
- X int noinvcurs;
- X
- X /*
- X * Outputting the last character on the screen may scrollup the screen.
- X * Don't to it!
- X */
- X if (row == Rows - 1 && col == Columns - 1)
- X return;
- X if (oldcol != col || oldrow != row)
- X {
- X /* check if no cursor movement is allowed in standout mode */
- X if (invert && !p_wi && (T_MS == NULL || *T_MS == NUL))
- X noinvcurs = 7;
- X else
- X noinvcurs = 0;
- X
- X /*
- X * If we're on the same row (which happens a lot!), try to
- X * avoid a windgoto().
- X * If we are only a few characters off, output the
- X * characters. That is faster than cursor positioning.
- X * This can't be used when inverting (a part of) the line.
- X */
- X if (oldrow == row && oldcol < col)
- X {
- X register int i;
- X
- X i = col - oldcol;
- X if (i <= 4 + noinvcurs && canopt)
- X {
- X while (i)
- X {
- X c = *(p - i--);
- X outchar(c ^ invert);
- X }
- X }
- X else
- X {
- X if (noinvcurs)
- X stop_highlight();
- X
- X if (T_CRI && *T_CRI) /* use tgoto interface! jw */
- X OUTSTR(tgoto((char *)T_CRI, 0, i));
- X else
- X windgoto(row, col);
- X
- X if (noinvcurs)
- X start_highlight();
- X }
- X oldcol = col;
- X }
- X else
- X {
- X if (noinvcurs)
- X stop_highlight();
- X windgoto(oldrow = row, oldcol = col);
- X if (noinvcurs)
- X start_highlight();
- X }
- X }
- X /*
- X * For weird invert mechanism: output (un)highlight before every char
- X * Lots of extra output, but works.
- X */
- X if (p_wi)
- X {
- X if (invert)
- X outstr(highlight);
- X else
- X outstr(unhighlight);
- X }
- X outchar(*p ^ invert);
- X oldcol++;
- X}
- X
- X/*
- X * Fill the screen from 'start_row' to 'end_row', from 'start_col' to 'end_col'
- X * with character 'c1' in first column followed by 'c2' in the other columns.
- X */
- X void
- Xscreen_fill(start_row, end_row, start_col, end_col, c1, c2)
- X int start_row, end_row;
- X int start_col, end_col;
- X int c1, c2;
- X{
- X int row;
- X int col;
- X char_u *screenp;
- X int did_delete = FALSE;
- X int c;
- X
- X if (start_row >= end_row || start_col >= end_col) /* nothing to do */
- X return;
- X
- X c1 ^= invert;
- X c2 ^= invert;
- X for (row = start_row; row < end_row; ++row)
- X {
- X /* try to use delete-line termcap code */
- X if (c2 == ' ' && end_col == Columns && T_EL != NULL && *T_EL != NUL)
- X {
- X /*
- X * check if we really need to clear something
- X */
- X col = start_col;
- X screenp = LinePointers[row] + start_col;
- X if (c1 != ' ') /* don't clear first char */
- X {
- X ++col;
- X ++screenp;
- X }
- X while (col < end_col && *screenp == ' ') /* skip blanks */
- X {
- X ++col;
- X ++screenp;
- X }
- X if (col < end_col) /* something to be cleared */
- X {
- X windgoto(row, col);
- X outstr(T_EL);
- X }
- X did_delete = TRUE;
- X }
- X
- X screen_start(); /* init cursor position of screen_char() */
- X screenp = LinePointers[row] + start_col;
- X c = c1;
- X for (col = start_col; col < end_col; ++col)
- X {
- X if (*screenp != c)
- X {
- X *screenp = c;
- X if (!did_delete || c != ' ')
- X screen_char(screenp, row, col);
- X }
- X ++screenp;
- X c = c2;
- X }
- X if (row == Rows - 1)
- X {
- X redraw_cmdline = TRUE;
- X if (c1 == ' ' && c2 == ' ')
- X clear_cmdline = FALSE;
- X }
- X }
- X}
- X
- X/*
- X * recompute all w_botline's. Called after Rows changed.
- X */
- X void
- Xcomp_Botline_all()
- X{
- X WIN *wp;
- X
- X for (wp = firstwin; wp; wp = wp->w_next)
- X comp_Botline(wp);
- X}
- X
- X/*
- X * compute wp->w_botline. Can be called after wp->w_topline changed.
- X */
- X void
- Xcomp_Botline(wp)
- X WIN *wp;
- X{
- X linenr_t lnum;
- X int done = 0;
- X
- X for (lnum = wp->w_topline; lnum <= wp->w_buffer->b_ml.ml_line_count; ++lnum)
- X {
- X if ((done += plines_win(wp, lnum)) > wp->w_height)
- X break;
- X }
- X wp->w_botline = lnum; /* wp->w_botline is the line that is just below the window */
- X}
- X
- X static void
- Xscreenalloc(clear)
- X int clear;
- X{
- X static int old_Rows = 0;
- X static int old_Columns = 0;
- X register int i;
- X WIN *wp;
- X int outofmem = FALSE;
- X
- X /*
- X * Allocation of the screen buffers is done only when the size changes
- X * and when Rows and Columns have been set.
- X */
- X if ((Nextscreen != NULL && Rows == old_Rows && Columns == old_Columns) || Rows == 0 || Columns == 0)
- X return;
- X
- X comp_col(); /* recompute columns for shown command and ruler */
- X old_Rows = Rows;
- X old_Columns = Columns;
- X
- X /*
- X * If we're changing the size of the screen, free the old arrays
- X */
- X free(Nextscreen);
- X free(LinePointers);
- X for (wp = firstwin; wp; wp = wp->w_next)
- X win_free_lsize(wp);
- X
- X Nextscreen = (char_u *)malloc((size_t) (Rows * Columns));
- X LinePointers = (char_u **)malloc(sizeof(char_u *) * Rows);
- X for (wp = firstwin; wp; wp = wp->w_next)
- X {
- X if (win_alloc_lsize(wp) == FAIL)
- X {
- X outofmem = TRUE;
- X break;
- X }
- X }
- X
- X if (Nextscreen == NULL || LinePointers == NULL || outofmem)
- X {
- X emsg(e_outofmem);
- X free(Nextscreen);
- X Nextscreen = NULL;
- X }
- X else
- X {
- X for (i = 0; i < Rows; ++i)
- X LinePointers[i] = Nextscreen + i * Columns;
- X }
- X
- X if (clear)
- X screenclear2();
- X}
- X
- X void
- Xscreenclear()
- X{
- X screenalloc(FALSE); /* allocate screen buffers if size changed */
- X screenclear2();
- X}
- X
- X static void
- Xscreenclear2()
- X{
- X if (starting || Nextscreen == NULL)
- X return;
- X
- X outstr(T_ED); /* clear the display */
- X
- X /* blank out Nextscreen */
- X memset((char *)Nextscreen, ' ', (size_t)(Rows * Columns));
- X
- X win_rest_invalid(firstwin);
- X clear_cmdline = FALSE;
- X if (must_redraw == CLEAR) /* no need to clear again */
- X must_redraw = NOT_VALID;
- X}
- X
- X/*
- X * check cursor for a valid lnum
- X */
- X void
- Xcheck_cursor()
- X{
- X if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
- X curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
- X if (curwin->w_cursor.lnum <= 0)
- X curwin->w_cursor.lnum = 1;
- X}
- X
- X void
- Xcursupdate()
- X{
- X linenr_t p;
- X long nlines;
- X int i;
- X int temp;
- X
- X screenalloc(TRUE); /* allocate screen buffers if size changed */
- X
- X if (Nextscreen == NULL)
- X return;
- X
- X check_cursor();
- X if (bufempty()) /* special case - file is empty */
- X {
- X curwin->w_topline = 1;
- X curwin->w_cursor.lnum = 1;
- X curwin->w_cursor.col = 0;
- X curwin->w_lsize[0] = 0;
- X if (curwin->w_lsize_valid == 0) /* don't know about screen contents */
- X updateScreen(NOT_VALID);
- X curwin->w_lsize_valid = 1;
- X }
- X else if (curwin->w_cursor.lnum < curwin->w_topline)
- X {
- X/*
- X * If the cursor is above the top of the screen, scroll the screen to
- X * put it at the top of the screen.
- X * If we weren't very close to begin with, we scroll more, so that
- X * the line is close to the middle.
- X */
- X temp = curwin->w_height / 2 - 1;
- X if (temp < 2)
- X temp = 2;
- X if (curwin->w_topline - curwin->w_cursor.lnum >= temp) /* not very close */
- X {
- X p = curwin->w_cursor.lnum;
- X i = plines(p);
- X temp += i;
- X /* count lines for 1/2 screenheight */
- X while (i < curwin->w_height + 1 && i < temp && p > 1)
- X i += plines(--p);
- X curwin->w_topline = p;
- X if (i > curwin->w_height) /* cursor line won't fit, backup one line */
- X ++curwin->w_topline;
- X }
- X else if (p_sj > 1) /* scroll at least p_sj lines */
- X {
- X for (i = 0; i < p_sj && curwin->w_topline > 1; i += plines(--curwin->w_topline))
- X ;
- X }
- X if (curwin->w_topline > curwin->w_cursor.lnum)
- X curwin->w_topline = curwin->w_cursor.lnum;
- X updateScreen(VALID);
- X }
- X else if (curwin->w_cursor.lnum >= curwin->w_botline)
- X {
- X/*
- X * If the cursor is below the bottom of the screen, scroll the screen to
- X * put the cursor on the screen.
- X * If the cursor is less than a screenheight down
- X * compute the number of lines at the top which have the same or more
- X * rows than the rows of the lines below the bottom
- X */
- X nlines = curwin->w_cursor.lnum - curwin->w_botline + 1;
- X if (nlines <= curwin->w_height + 1)
- X {
- X /* get the number or rows to scroll minus the number of
- X free '~' rows */
- X temp = plines_m(curwin->w_botline, curwin->w_cursor.lnum) - curwin->w_empty_rows;
- X if (temp <= 0) /* curwin->w_empty_rows is larger, no need to scroll */
- X nlines = 0;
- X else if (temp > curwin->w_height) /* more than a screenfull, don't scroll */
- X nlines = temp;
- X else
- X {
- X /* scroll minimal number of lines */
- X if (temp < p_sj)
- X temp = p_sj;
- X for (i = 0, p = curwin->w_topline; i < temp && p < curwin->w_botline; ++p)
- X i += plines(p);
- X if (i >= temp) /* it's possible to scroll */
- X nlines = p - curwin->w_topline;
- X else /* below curwin->w_botline, don't scroll */
- X nlines = 9999;
- X }
- X }
- X
- X /*
- X * Scroll up if the cursor is off the bottom of the screen a bit.
- X * Otherwise put it at 1/2 of the screen.
- X */
- X if (nlines >= curwin->w_height / 2 && nlines > p_sj)
- X {
- X p = curwin->w_cursor.lnum;
- X temp = curwin->w_height / 2 + 1;
- X nlines = 0;
- X i = 0;
- X do /* this loop could win a contest ... */
- X i += plines(p);
- X while (i < temp && (nlines = 1) != 0 && --p != 0);
- X curwin->w_topline = p + nlines;
- X }
- X else
- X scrollup(nlines);
- X updateScreen(VALID);
- X }
- X else if (curwin->w_lsize_valid == 0) /* don't know about screen contents */
- X updateScreen(NOT_VALID);
- X curwin->w_row = curwin->w_col = curwin->w_virtcol = i = 0;
- X for (p = curwin->w_topline; p != curwin->w_cursor.lnum; ++p)
- X if (RedrawingDisabled) /* curwin->w_lsize[] invalid */
- X curwin->w_row += plines(p);
- X else
- X curwin->w_row += curwin->w_lsize[i++];
- X
- X Cline_row = curwin->w_row;
- X if (!RedrawingDisabled && i > curwin->w_lsize_valid)
- X /* Should only happen with a line that is too */
- X /* long to fit on the last screen line. */
- X Cline_height = 0;
- X else
- X {
- X if (RedrawingDisabled) /* curwin->w_lsize[] invalid */
- X Cline_height = plines(curwin->w_cursor.lnum);
- X else
- X Cline_height = curwin->w_lsize[i];
- X
- X curs_columns(!RedrawingDisabled); /* compute curwin->w_virtcol and curwin->w_col */
- X if (must_redraw)
- X updateScreen(must_redraw);
- X }
- X
- X if (curwin->w_set_curswant)
- X {
- X curwin->w_curswant = curwin->w_virtcol;
- X curwin->w_set_curswant = FALSE;
- X }
- X}
- X
- X/*
- X * compute curwin->w_col and curwin->w_virtcol
- X */
- X void
- Xcurs_columns(scroll)
- X int scroll; /* when TRUE, may scroll horizontally */
- X{
- X int diff;
- X
- X curwin->w_virtcol = getvcol(curwin, &curwin->w_cursor, 1);
- X curwin->w_col = curwin->w_virtcol;
- X if (curwin->w_p_nu)
- X curwin->w_col += 8;
- X
- X curwin->w_row = Cline_row;
- X if (curwin->w_p_wrap) /* long line wrapping, adjust curwin->w_row */
- X while (curwin->w_col >= Columns)
- X {
- X curwin->w_col -= Columns;
- X curwin->w_row++;
- X }
- X else if (scroll) /* no line wrapping, compute curwin->w_leftcol if scrolling is on */
- X /* if scrolling is off, curwin->w_leftcol is assumed to be 0 */
- X {
- X /* If Cursor is in columns 0, start in column 0 */
- X /* If Cursor is left of the screen, scroll rightwards */
- X /* If Cursor is right of the screen, scroll leftwards */
- X if (curwin->w_cursor.col == 0)
- X {
- X /* screen has to be redrawn with new curwin->w_leftcol */
- X if (curwin->w_leftcol != 0 && must_redraw < NOT_VALID)
- X must_redraw = NOT_VALID;
- X curwin->w_leftcol = 0;
- X }
- X else if (((diff = curwin->w_leftcol + (curwin->w_p_nu ? 8 : 0)
- X - curwin->w_col) > 0 ||
- X (diff = curwin->w_col - (curwin->w_leftcol + Columns) + 1) > 0))
- X {
- X if (p_ss == 0 || diff >= Columns / 2)
- X curwin->w_leftcol = curwin->w_col - Columns / 2;
- X else
- X {
- X if (diff < p_ss)
- X diff = p_ss;
- X if (curwin->w_col < curwin->w_leftcol + 8)
- X curwin->w_leftcol -= diff;
- X else
- X curwin->w_leftcol += diff;
- X }
- X if (curwin->w_leftcol < 0)
- X curwin->w_leftcol = 0;
- X if (must_redraw < NOT_VALID)
- X must_redraw = NOT_VALID; /* screen has to be redrawn with new curwin->w_leftcol */
- X }
- X curwin->w_col -= curwin->w_leftcol;
- X }
- X if (curwin->w_row > curwin->w_height - 1) /* Cursor past end of screen */
- X curwin->w_row = curwin->w_height - 1; /* happens with line that does not fit on screen */
- X}
- X
- X/*
- X * get virtual column number of pos
- X * type = 1: where the cursor is on this character
- X * type = 2: on the first position of this character (TAB)
- X * type = 3: on the last position of this character (TAB)
- X */
- X int
- Xgetvcol(wp, pos, type)
- X WIN *wp;
- X FPOS *pos;
- X int type;
- X{
- X int col;
- X int vcol;
- X char_u *ptr;
- X int incr;
- X int c;
- X
- X vcol = 0;
- X ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE);
- X for (col = pos->col; col >= 0; --col)
- X {
- X c = *ptr++;
- X if (c == NUL) /* make sure we don't go past the end of the line */
- X break;
- X
- X /* A tab gets expanded, depending on the current column */
- X incr = chartabsize(c, (long)vcol);
- X
- X if (col == 0) /* character at pos.col */
- X {
- X if (type == 3 || (type == 1 && c == TAB && State == NORMAL && !wp->w_p_list))
- X --incr;
- X else
- X break;
- X }
- X vcol += incr;
- X }
- X return vcol;
- X}
- X
- X void
- Xscrolldown(nlines)
- X long nlines;
- X{
- X register long done = 0; /* total # of physical lines done */
- X
- X /* Scroll up 'nlines' lines. */
- X while (nlines--)
- X {
- X if (curwin->w_topline == 1)
- X break;
- X done += plines(--curwin->w_topline);
- X }
- X /*
- X * Compute the row number of the last row of the cursor line
- X * and move it onto the screen.
- X */
- X curwin->w_row += done;
- X if (curwin->w_p_wrap)
- X curwin->w_row += plines(curwin->w_cursor.lnum) - 1 - curwin->w_virtcol / Columns;
- X while (curwin->w_row >= curwin->w_height && curwin->w_cursor.lnum > 1)
- X curwin->w_row -= plines(curwin->w_cursor.lnum--);
- X}
- X
- X void
- Xscrollup(nlines)
- X long nlines;
- X{
- X#ifdef NEVER
- X register long done = 0; /* total # of physical lines done */
- X
- X /* Scroll down 'nlines' lines. */
- X while (nlines--)
- X {
- X if (curwin->w_topline == curbuf->b_ml.ml_line_count)
- X break;
- X done += plines(curwin->w_topline);
- X if (curwin->w_cursor.lnum == curwin->w_topline)
- X ++curwin->w_cursor.lnum;
- X ++curwin->w_topline;
- X }
- X win_del_lines(curwin, 0, done, TRUE, TRUE);
- X#endif
- X curwin->w_topline += nlines;
- X if (curwin->w_topline > curbuf->b_ml.ml_line_count)
- X curwin->w_topline = curbuf->b_ml.ml_line_count;
- X if (curwin->w_cursor.lnum < curwin->w_topline)
- X curwin->w_cursor.lnum = curwin->w_topline;
- X}
- X
- X/*
- X * insert 'nlines' lines at 'row' in window 'wp'
- X * if 'invalid' is TRUE the wp->w_lsize_lnum[] is invalidated.
- X * if 'mayclear' is TRUE the screen will be cleared if it is faster than scrolling
- X * Returns FAIL if the lines are not inserted, OK for success.
- X */
- X int
- Xwin_ins_lines(wp, row, nlines, invalid, mayclear)
- X WIN *wp;
- X int row;
- X int nlines;
- X int invalid;
- X int mayclear;
- X{
- X int did_delete;
- X int nextrow;
- X int lastrow;
- X int retval;
- X
- X if (invalid)
- X wp->w_lsize_valid = 0;
- X
- X if (RedrawingDisabled || nlines <= 0 || wp->w_height < 5)
- X return FAIL;
- X
- X if (nlines > wp->w_height - row)
- X nlines = wp->w_height - row;
- X
- X if (mayclear && Rows - nlines < 5) /* only a few lines left: redraw is faster */
- X {
- X screenclear(); /* will set wp->w_lsize_valid to 0 */
- X return FAIL;
- X }
- X
- X if (nlines == wp->w_height) /* will delete all lines */
- X return FAIL;
- X
- X /*
- X * when scrolling, the message on the command line should be cleared,
- X * otherwise it will stay there forever.
- X */
- X clear_cmdline = TRUE;
- X
- X /*
- X * if the terminal can set a scroll region, use that
- X */
- X if (scroll_region)
- X {
- X scroll_region_set(wp);
- X retval = screen_ins_lines(wp->w_winpos, row, nlines, wp->w_height);
- X scroll_region_reset();
- X return retval;
- X }
- X
- X if (wp->w_next && p_tf) /* don't delete/insert on fast terminal */
- X return FAIL;
- X
- X /*
- X * If there is a next window or a status line, we first try to delete the
- X * lines at the bottom to avoid messing what is after the window.
- X * If this fails and there are following windows, don't do anything to avoid
- X * messing up those windows, better just redraw.
- X */
- X did_delete = FALSE;
- X if (wp->w_next || wp->w_status_height)
- X {
- X if (screen_del_lines(0, wp->w_winpos + wp->w_height - nlines, nlines, (int)Rows) == OK)
- X did_delete = TRUE;
- X else if (wp->w_next)
- X return FAIL;
- X }
- X /*
- X * if no lines deleted, blank the lines that will end up below the window
- X */
- X if (!did_delete)
- X {
- X wp->w_redr_status = TRUE;
- X redraw_cmdline = TRUE;
- X nextrow = wp->w_winpos + wp->w_height + wp->w_status_height;
- X lastrow = nextrow + nlines;
- X if (lastrow > Rows)
- X lastrow = Rows;
- X screen_fill(nextrow - nlines, lastrow - nlines, 0, (int)Columns, ' ', ' ');
- X }
- X
- X if (screen_ins_lines(0, wp->w_winpos + row, nlines, (int)Rows) == FAIL)
- X {
- X /* deletion will have messed up other windows */
- X if (did_delete)
- X {
- X wp->w_redr_status = TRUE;
- X win_rest_invalid(wp->w_next);
- X }
- X return FAIL;
- X }
- X
- X return OK;
- X}
- X
- X/*
- X * delete 'nlines' lines at 'row' in window 'wp'
- X * If 'invalid' is TRUE curwin->w_lsize_lnum[] is invalidated.
- X * If 'mayclear' is TRUE the screen will be cleared if it is faster than scrolling
- X * Return OK for success, FAIL if the lines are not deleted.
- X */
- X int
- Xwin_del_lines(wp, row, nlines, invalid, mayclear)
- X WIN *wp;
- X int row;
- X int nlines;
- X int invalid;
- X int mayclear;
- X{
- X int retval;
- X
- X if (invalid)
- X wp->w_lsize_valid = 0;
- X
- X if (RedrawingDisabled || nlines <= 0)
- X return FAIL;
- X
- X if (nlines > wp->w_height - row)
- X nlines = wp->w_height - row;
- X
- X if (mayclear && Rows - nlines < 5) /* only a few lines left: redraw is faster */
- X {
- X screenclear(); /* will set wp->w_lsize_valid to 0 */
- X return FAIL;
- X }
- X
- X if (nlines == wp->w_height) /* will delete all lines */
- X return FAIL;
- X
- X /*
- X * when scrolling, the message on the command line should be cleared,
- X * otherwise it will stay there forever.
- X */
- X clear_cmdline = TRUE;
- X
- X /*
- X * if the terminal can set a scroll region, use that
- X */
- X if (scroll_region)
- X {
- X scroll_region_set(wp);
- X retval = screen_del_lines(wp->w_winpos, row, nlines, wp->w_height);
- X scroll_region_reset();
- X return retval;
- X }
- X
- X if (wp->w_next && p_tf) /* don't delete/insert on fast terminal */
- X return FAIL;
- X
- X if (screen_del_lines(0, wp->w_winpos + row, nlines, (int)Rows) == FAIL)
- X return FAIL;
- X
- X /*
- X * If there are windows or status lines below, try to put them at the
- X * correct place. If we can't do that, they have to be redrawn.
- X */
- X if (wp->w_next || wp->w_status_height || cmdline_row < Rows - 1)
- X {
- X if (screen_ins_lines(0, wp->w_winpos + wp->w_height - nlines, nlines, (int)Rows) == FAIL)
- X {
- X wp->w_redr_status = TRUE;
- X win_rest_invalid(wp->w_next);
- X }
- X }
- X /*
- X * If this is the last window and there is no status line, redraw the
- X * command line later.
- X */
- X else
- X redraw_cmdline = TRUE;
- X return OK;
- X}
- X
- X/*
- X * window 'wp' and everything after it is messed up, mark it for redraw
- X */
- X void
- Xwin_rest_invalid(wp)
- X WIN *wp;
- X{
- X while (wp)
- X {
- X wp->w_lsize_valid = 0;
- X wp->w_redr_type = NOT_VALID;
- X wp->w_redr_status = TRUE;
- X wp = wp->w_next;
- X }
- X redraw_cmdline = TRUE;
- X}
- X
- X/*
- X * The rest of the routines in this file perform screen manipulations. The
- X * given operation is performed physically on the screen. The corresponding
- X * change is also made to the internal screen image. In this way, the editor
- X * anticipates the effect of editing changes on the appearance of the screen.
- X * That way, when we call screenupdate a complete redraw isn't usually
- X * necessary. Another advantage is that we can keep adding code to anticipate
- X * screen changes, and in the meantime, everything still works.
- X */
- X
- X/*
- X * insert lines on the screen and update Nextscreen
- X * 'end' is the line after the scrolled part. Normally it is Rows.
- X * When scrolling region used 'off' is the offset from the top for the region.
- X * 'row' and 'end' are relative to the start of the region.
- X *
- X * return FAIL for failure, OK for success.
- X */
- X static int
- Xscreen_ins_lines(off, row, nlines, end)
- X int off;
- X int row;
- X int nlines;
- X int end;
- X{
- X int i;
- X int j;
- X char_u *temp;
- X int cursor_row;
- X
- X if (T_CSC != NULL && *T_CSC != NUL) /* cursor relative to region */
- X cursor_row = row;
- X else
- X cursor_row = row + off;
- X
- X screenalloc(TRUE); /* allocate screen buffers if size changed */
- X if (Nextscreen == NULL)
- X return FAIL;
- X
- X if (nlines <= 0 || ((T_CIL == NULL || *T_CIL == NUL) &&
- X (T_IL == NULL || *T_IL == NUL) &&
- X (T_SR == NULL || *T_SR == NUL || row != 0)))
- X return FAIL;
- X
- X /*
- X * It "looks" better if we do all the inserts at once
- X */
- X if (T_CIL && *T_CIL)
- X {
- X windgoto(cursor_row, 0);
- X if (nlines == 1 && T_IL && *T_IL)
- X outstr(T_IL);
- X else
- X OUTSTR(tgoto((char *)T_CIL, 0, nlines));
- X }
- X else
- X {
- X for (i = 0; i < nlines; i++)
- X {
- X if (i == 0 || cursor_row != 0)
- X windgoto(cursor_row, 0);
- X if (T_IL && *T_IL)
- X outstr(T_IL);
- X else
- X outstr(T_SR);
- X }
- X }
- X /*
- X * Now shift LinePointers nlines down to reflect the inserted lines.
- X * Clear the inserted lines.
- X */
- X row += off;
- X end += off;
- X for (i = 0; i < nlines; ++i)
- X {
- X j = end - 1 - i;
- X temp = LinePointers[j];
- X while ((j -= nlines) >= row)
- X LinePointers[j + nlines] = LinePointers[j];
- X LinePointers[j + nlines] = temp;
- X memset((char *)temp, ' ', (size_t)Columns);
- X }
- X return OK;
- X}
- X
- X/*
- X * delete lines on the screen and update Nextscreen
- X * 'end' is the line after the scrolled part. Normally it is Rows.
- X * When scrolling region used 'off' is the offset from the top for the region.
- X * 'row' and 'end' are relative to the start of the region.
- X *
- X * Return OK for success, FAIL if the lines are not deleted.
- X */
- X int
- Xscreen_del_lines(off, row, nlines, end)
- X int off;
- X int row;
- X int nlines;
- X int end;
- X{
- X int j;
- X int i;
- X char_u *temp;
- X int cursor_row;
- X int cursor_end;
- X
- X if (T_CSC != NULL && *T_CSC != NUL) /* cursor relative to region */
- X {
- X cursor_row = row;
- X cursor_end = end;
- X }
- X else
- X {
- X cursor_row = row + off;
- X cursor_end = end + off;
- X }
- X
- X screenalloc(TRUE); /* allocate screen buffers if size changed */
- X if (Nextscreen == NULL)
- X return FAIL;
- X
- X if (nlines <= 0 || ((T_DL == NULL || *T_DL == NUL) &&
- X (T_CDL == NULL || *T_CDL == NUL) &&
- X row != 0))
- X return FAIL;
- X
- X /* delete the lines */
- X if (T_CDL && *T_CDL)
- X {
- X windgoto(cursor_row, 0);
- X if (nlines == 1 && T_DL && *T_DL)
- X outstr(T_DL);
- X else
- X OUTSTR(tgoto((char *)T_CDL, 0, nlines));
- X }
- X else
- X {
- X if (row == 0)
- X {
- X windgoto(cursor_end - 1, 0);
- X for (i = 0; i < nlines; i++)
- X outchar('\n');
- X }
- X else
- X {
- X for (i = 0; i < nlines; i++)
- X {
- X windgoto(cursor_row, 0);
- X outstr(T_DL); /* delete a line */
- X }
- X }
- X }
- X
- X /*
- X * Now shift LinePointers nlines up to reflect the deleted lines.
- X * Clear the deleted lines.
- X */
- X row += off;
- X end += off;
- X for (i = 0; i < nlines; ++i)
- X {
- X j = row + i;
- X temp = LinePointers[j];
- X while ((j += nlines) <= end - 1)
- X LinePointers[j - nlines] = LinePointers[j];
- X LinePointers[j - nlines] = temp;
- X memset((char *)temp, ' ', (size_t)Columns);
- X }
- X return OK;
- X}
- X
- X/*
- X * show the current mode and ruler
- X *
- X * If clear_cmdline is TRUE, clear it first.
- X * If clear_cmdline is FALSE there may be a message there that needs to be
- X * cleared only if a mode is shown.
- X */
- X void
- Xshowmode()
- X{
- X int did_clear = clear_cmdline;
- X int need_clear = FALSE;
- X
- X if ((p_smd && (State & INSERT)) || Recording)
- X {
- X gotocmdline(clear_cmdline, NUL);
- X if (p_smd)
- X {
- X if (State & INSERT)
- X {
- X msg_outstr((char_u *)"-- ");
- X if (p_ri)
- X msg_outstr((char_u *)"REVERSE ");
- X if (State == INSERT)
- X msg_outstr((char_u *)"INSERT --");
- X else
- X msg_outstr((char_u *)"REPLACE --");
- X need_clear = TRUE;
- X }
- X }
- X if (Recording)
- X {
- X msg_outstr((char_u *)"recording");
- X need_clear = TRUE;
- X }
- X if (need_clear && !did_clear)
- X msg_ceol();
- X }
- X win_redr_ruler(lastwin, TRUE);
- X redraw_cmdline = FALSE;
- X}
- X
- X/*
- X * delete mode message
- X */
- X void
- Xdelmode()
- X{
- X if (Recording)
- X MSG("recording");
- X else
- X MSG("");
- X}
- X
- X/*
- X * if ruler option is set: show current cursor position
- X * if always is FALSE, only print if position has changed
- X */
- X void
- Xshowruler(always)
- X int always;
- X{
- X win_redr_ruler(curwin, always);
- X}
- X
- X void
- Xwin_redr_ruler(wp, always)
- X WIN *wp;
- X int always;
- X{
- X static linenr_t oldlnum = 0;
- X static colnr_t oldcol = 0;
- X char_u buffer[30];
- X int row;
- X int fillchar;
- X
- X if (p_ru && (redraw_cmdline || always || wp->w_cursor.lnum != oldlnum || wp->w_virtcol != oldcol))
- X {
- X cursor_off();
- X if (wp->w_status_height)
- X {
- X row = wp->w_winpos + wp->w_height;
- X if (set_highlight('s') == OK) /* can use highlighting */
- X {
- X fillchar = ' ';
- X start_highlight();
- X }
- X else
- X fillchar = '=';
- X }
- X else
- X {
- X row = Rows - 1;
- X fillchar = ' ';
- X }
- X /*
- X * Some sprintfs return the lenght, some return a pointer.
- X * To avoid portability problems we use strlen here.
- X */
- X sprintf((char *)buffer, "%ld,%d", wp->w_cursor.lnum, (int)wp->w_cursor.col + 1);
- X if (wp->w_cursor.col != wp->w_virtcol)
- X sprintf((char *)buffer + STRLEN(buffer), "-%d", wp->w_virtcol + 1);
- X
- X screen_start(); /* init cursor position */
- X screen_msg(buffer, row, ru_col);
- X screen_fill(row, row + 1, ru_col + (int)STRLEN(buffer), (int)Columns, fillchar, fillchar);
- X oldlnum = wp->w_cursor.lnum;
- X oldcol = wp->w_virtcol;
- X stop_highlight();
- X }
- X}
- X
- X/*
- X * screen_valid: Returns TRUE if there is a valid screen to write to.
- X * Returns FALSE when starting up and screen not initialized yet.
- X * Used by msg() to decide to use either screen_msg() or printf().
- X */
- X int
- Xscreen_valid()
- X{
- X screenalloc(FALSE); /* allocate screen buffers if size changed */
- X return (Nextscreen != NULL);
- X}
- END_OF_FILE
- if test 46442 -ne `wc -c <'vim/src/screen.c'`; then
- echo shar: \"'vim/src/screen.c'\" unpacked with wrong size!
- fi
- # end of 'vim/src/screen.c'
- fi
- if test -f 'vim/src/tcconfig.tc.UU' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'vim/src/tcconfig.tc.UU'\"
- else
- echo shar: Extracting \"'vim/src/tcconfig.tc.UU'\" \(2368 characters\)
- sed "s/^X//" >'vim/src/tcconfig.tc.UU' <<'END_OF_FILE'
- Xbegin 644 vim/src/tcconfig.tc
- XM5'5R8F\@0R!#;VYF:6=U<F%T:6]N($9I;&4@&@ !#1(7 1H @$! ( "
- XM ( 0 # ( @ $ $ 4 0 !@ ! ( $ ! D @ T @ ! X
- XM @ !$ 0 ($@ " $P " !D % " %0 " $ %@ " %P " $
- XM& " $ 9 ! %E $ 68 0 !9P ! %H $ 6D 0 !:@ ! %K $
- XM 6P 0 !;0 ! %N $ 6\ 0 !< ! %Q $ 7( 0 !<P ! %T $
- XM 74 0 !=@ ! %W $ 7@ 0 !>0 ! %Z $ 7L 0 ? ! %] $
- XM 7X 0 ?P ! & $ 8( 0 A ! &% $ <@ 0 R0 ! #* $
- XM <L 0 S ! #- $ ,X 0 !SP ! #0 $ &=$ 0!DT@ ! "#5 $
- XM -< 0 V ! #9 $ =H 0 !VP ! #< $ =T 0 !W@ ! #? $
- XM . 0 X0 ! #B $ 2P!1
- XM "T!
- XM@ !$.EQ40UQ)3D-,541%
- XM
- XM "X!@ !$
- XM.EQ40UQ,24(
- XM
- XM "\!4 !624TN
- XM4%)*
- XM # !! S,@ ,0$% #(U
- XM ,@$% #$P, ,P%_ $U31$]3.U=)3$1?0T%21%,
- XM
- XM
- XM T 1X *@ -0$>
- XM "H #8!'@ J
- XM W 1X *@
- XM . $> "H #D!
- XM'@ J Z 1X *@
- XM .P$> "H
- XM #P!'@ J ]
- XM 8
- XM
- XM ^ 00
- XM. #\!4
- XM $ !
- XM1 !$.EQ40P
- XM $$!4
- XM
- X9 /__ @ :
- X
- Xend
- END_OF_FILE
- if test 2368 -ne `wc -c <'vim/src/tcconfig.tc.UU'`; then
- echo shar: \"'vim/src/tcconfig.tc.UU'\" unpacked with wrong size!
- else
- echo shar: Uudecoding \"'vim/src/tcconfig.tc'\" \(1690 characters\)
- cat vim/src/tcconfig.tc.UU | uudecode
- if test 1690 -ne `wc -c <'vim/src/tcconfig.tc'`; then
- echo shar: \"'vim/src/tcconfig.tc'\" uudecoded with wrong size!
- else
- rm vim/src/tcconfig.tc.UU
- fi
- fi
- # end of 'vim/src/tcconfig.tc.UU'
- fi
- if test -f 'vim/src/version.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'vim/src/version.c'\"
- else
- echo shar: Extracting \"'vim/src/version.c'\" \(15714 characters\)
- sed "s/^X//" >'vim/src/version.c' <<'END_OF_FILE'
- X/* vi:ts=4:sw=4:tw=78
- X *
- X * VIM - Vi IMproved by Bram Moolenaar
- X *
- X * Read the file "credits.txt" for a list of people who contributed.
- X * Read the file "uganda.txt" for copying and usage conditions.
- X */
- X
- X/*
- X Started with Stevie version 3.6 (Fish disk 217) - GRWalter (Fred)
- X
- X VIM 1.0 - Changed so many things that I felt that a new name was required
- X (I didn't like the name Stevie that much: I don't have an ST).
- X - VIM stands for "Vi IMitation".
- X - New storage structure, MULTI-LEVEL undo and redo,
- X improved screen output, removed an awful number of bugs,
- X removed fixed size buffers, added counts to a lot of commands,
- X added new commands, added new options, added 'smart indent',
- X added recording mode, added script files, moved help to a file,
- X etc. etc. etc.
- X - Compiles under Manx/Aztec C 5.0. You can use "rez" to make VIM
- X resident.
- X - Bram Moolenaar (Mool)
- X
- X VIM 1.09 - spaces can be used in tags file instead of tabs (compatible with
- X Manx ctags).
- X
- X VIM 1.10 - Csh not required anymore for CTRL-D. Search options /e and /s added.
- X Shell option implemented. BS in replace mode does not delete
- X character. Backspace, wrapmargin and tags options added.
- X Added support for Manx's QuickFix mode (just like "Z").
- X The ENV: environment variables instead of the Old Manx environment
- X variables are now used, because Vim was compiled with version 5.0d
- X of the compiler. "mool" library not used anymore. Added index to
- X help screens.
- X
- X VIM 1.11 - removed bug that caused :e of same file, but with name in upper case,
- X to re-edit that file.
- X
- X VIM 1.12 - The second character of several commands (e.g. 'r', 't', 'm') not
- X :mapped anymore (UNIX vi does it like this, don't know why); Some
- X operators did not work when doing a 'l' on the last character in
- X a line (e.g. 'yl'); Added :mapping when executing registers;
- X Removed vi incompatibility from 't' and 'T' commands; :mapping! also
- X works for command line editing; Changed a few details to have Vim
- X run the macros for solving a maze and Towers of Hanoi! It now also
- X runs the Turing machine macros!
- X
- X VIM 1.13 - Removed a bug for !! on empty line. "$" no longer puts cursor at
- X the end of the line when combined with an operator. Added
- X automatic creation of a script file for recovery after a crash.
- X Added "-r" option. Solved bug for not detecting end of script file.
- X ".bak" is now appended, thus "main.c" and "main.h" will have
- X separate backup files.
- X
- X VIM 1.14 - Removed a few minor bugs. Added "-n" option to skip autoscript.
- X Made options more Vi compatible. Improved ^C handling. On serious
- X errors typahead and scripts are discarded. 'U' is now correctly
- X undone with 'u'. Fixed showmatch() handling of 'x' and '\x'.
- X Solved window size dependency for scripts by adding ":winsize"
- X commands to scripts. This version released on Fish disk 591.
- X
- X VIM 1.15 - No extra return in recording mode (MCHAR instead of MLINE buffer).
- X plural() argument is now a long. Search patterns shared between
- X :g, :s and /. After recovery a message is given. Overflow of mapbuf
- X is detected. Line number possible with :read. Error message when
- X characters follow a '$' in a search pattern. Cause for crash
- X removed: ":s/pat/repl/g" allocated not enough memory. Option
- X "directory" added. Option "expandtab" added. Solved showmode non-
- X functioning. Solved bug with window resizing. Removed some *NULL
- X references. CTRL-], * and # commands now skips non-identifier
- X characters. Added tag list, CTRL-T, :pop and :tags commands.
- X Added jump list, CTRL-O and CTRL-I commands. Added "shiftround"
- X option. Applied AUX and Lattice mods from Juergen Weigert.
- X Finally made linenr_t a long, files can be > 65000 lines!
- X :win command could be written to script file halfway a command.
- X Option shelltype added. With ^V no mapping anymore.
- X Added :move, :copy, :t, :mark and :k. Improved Ex address parsing.
- X Many delimiters possible with :s.
- X
- X VIM 1.16 - Solved bug with zero line number in Ex range. Added file-number to
- X jump list. Solved bug when scrolling downwards. Made tagstack vi
- X compatible. Cmdline editing: CTRL-U instead of '@'. Made Vim DICE
- X compatible. Included regexp improvements from Olaf Seibert,
- X mapstring() removed. Removed bug with CTRL-U in insert mode.
- X Count allowed before ". Added uppercase (file) marks. Added
- X :marks command. Added joinspaces option. Added :jumps command. Made
- X jumplist compatible with tag list. Added count to :next and :Next.
- X
- X VIM 1.17 - Removed '"' for Ex register name. Repaired stupid bug in tag code.
- X Now compiled with Aztec 5.2a. Changed Arpbase.h for use with 2.04
- X includes. Added repdel option. Improved :set listing. Added count
- X to 'u' and CTRL-R commands. "vi:" and "ex:" in modelines must now
- X be preceded with a blank. Option "+command" for command line and
- X :edit command added.
- X
- X VIM 1.18 - Screen was not updated when all lines deleted. Readfile() now
- X puts cursor on first new line. Catch strange disk label.
- X Endless "undo line missing" loop removed. With empty file 'O' would
- X cause this. Added window size reset in windexit(). Flush .vim file
- X only when buffer has been changed. Added the nice things from
- X Elvis 1.5: Added "equalprg" and "ruler" option. Added quoting.
- X Added third meaning to 'backspace' option: backspacing over start
- X of insert. Added "-c {command}" command line option. Made generating
- X of prototypes automatically. Added insert mode command CTRL-O and
- X arrow keys. CTRL-T/CTRL-D now always insert/delete indent. When
- X starting an edit on specified lnum there was redraw of first lines.
- X Added 'inputmode' option. Added CTRL-A and CTRL-S commands. '`' is
- X now exclusive (as it should be). Added digraphs as an option.
- X Changed implementation of parameters. Added :wnext command.
- X Added ':@r' command. Changed handling of CTRL-V in command line.
- X Block macros now work. Added keyword lookup command 'K'. Added
- X CTRL-N and CTRL-P to command line editing. For DOS 2.0x the Flush
- X function is used for the autoscript file; this should solve the
- X lockup bug. Added wait_return to msg() for long messages.
- X
- X VIM 1.19 - Changes from Juergen Weigert:
- X Terminal type no longer restricted to machine console. New
- X option -T terminal. New set option "term". Builtin termcap
- X entries for "amiga", "ansi", "atari", "nansi", "pcterm".
- X Ported to MSDOS. New set option "textmode" ("tx") to control
- X CR-LF translation. CTRL-U and CTRL-D scroll half a screen full,
- X rather than 12 lines. New set option "writebackup" ("wb") to
- X disable even the 'backup when writing' feature.
- X Ported to SunOS. Full termcap support. Does resize on SIGWINCH.
- X
- X Made storage.c portable. Added reading of ".vimrc". Added
- X 'helpfile' option. With quoting the first char of an empty line
- X is inverted. Optimized screen updating a bit. Startup code
- X looks for VIMINIT variable and .vimrc file first. Added option
- X helpfile. Solved bug of inserting deletes: redefined ISSPECIAL.
- X Changed inchar() to use key codes from termcap. Added parameters
- X for terminal codes. Replaced aux device handling by amiga window
- X handling. Added optional termcap code. Added 'V', format
- X operator.
- X
- X VIM 1.20 - wait_return only ignores CR, LF and space. 'V' also works for
- X single line. No redrawing while formatting text. Added CTRL-Z.
- X Added usage of termcap "ks" and "ke". Fixed showmatch().
- X Added timeout option. Added newfile argument to readfile().
- X
- X VIM 1.21 - Added block mode. Added 'o' command for quoting. Added :set inv.
- X Added pos2ptr(). Added repeating and '$' to Quoting.
- X
- X VIM 1.22 - Fixed a bug in doput() with count > 1.
- X Port to linux by Juergen Weigert included.
- X More unix semantics in writeit(), forceit flag ignores errors while
- X preparing backup file. For UNIX, backup is now copied, not moved.
- X When the current directory is not writable, vim now tries a backup
- X in the directory given with the backupdir option. For UNIX, raw mode
- X has now ICRNL turned off, that allowes ^V^M. Makefiles for BSD,
- X SYSV, and linux unified in makefile.unix. For MSDOS
- X mch_get_winsize() implemented. Reimplemented builtin termcaps in
- X term.c and term.h. set_term() now handles all cases. Even builtins
- X when TERMCAP is defined. Show "..." while doing filename completion.
- X
- X VIM 1.23 - Improved MSDOS version: Added function and cursor keys to builtin
- X pcterm. Replaced setmode by settmode, delay by vim_delay and
- X delline by dellines to avoid name conflicts. Made F1 help key.
- X Renamed makecmdtab to mkcmdtab and cmdsearch to csearch for
- X 8 char name limit. Wildcard expansion adds *.* to names without a
- X dot. Added shell execution.
- X For unix: writeit() overwrites readonly files when forced write,
- X more safety checks. Termcap buffer for linux now 2048 bytes.
- X Expandone() no longer appends "*" to file name. Added "graphic"
- X option. Added ':' command to quoting.
- X
- X VIM 1.24 Adjusted number of spaces inserted by dojoin(). MSDOS version uses
- X searchpath() to find helpfile. Fixed a few small problems. Fixed
- X nasty bug in getperm() for SAS 6.0. Removed second argument from
- X wait_return(). Script files accessed in binary mode with MSDOS.
- X Added 'u' and 'U' commands to quoting (make upper or lower case).
- X Added "CTRL-V [0-9]*" to enter any byte value. Fixed doput().
- X Dodis() displays register 0. Added CTRL-B to insert mode. Attempt
- X to fix the lockup bug by adding Delay() to startscript(). -v
- X option now implies -n option. doformat() added to improve 'V'
- X command. Replace bool_t with int. Fixed handling of \& and ~ in
- X regsub(). Added interrupt handling in msdos.c for ctrl-break and
- X critical errors. Added scrolljump option. Added :stop. Added -d
- X argument. Fixed bug in quickfix startup from cli. Fixed enforcer
- X hit with aux:. Added CTRL-C handling to unix.c. Fixed "O<BS><CR>"
- X bug with autoindent. Worked around :cq not working by adding a
- X printf()!? Added default mapping for MSDOS PageUp etc. Fixed
- X cursor position after 'Y'. Added shift-cursor commands. Changed
- X ExpandFile() to keep names with errors. Added CLEAR and CURSUPD
- X arguments to updateScreen(). Fixed CTRL-@ after a change command.
- X modname() changes '.' into '_'. Added emptyrows to screen.c.
- X Fixed redo of search with offset. Added count to 'z' command.
- X Made :so! work with :global. Added writing of cursor postition to
- X startscript(). Minimized terminal requirements. Fixed problem
- X with line in tags file with mixed spaces and tabs. Fixed problem
- X with pattern "\\" in :s and :g. This version posted on Usenet.
- X
- X VIM 1.25 Improved error messages for :set. Open helpfile in binary mode
- X for MSDOS. Fixed ignorecase for Unix in cstrncmp(). Fixed read
- X from NULL with :tags after vim -t. Repaired 'z' command. Changed
- X outnum() for >32767. In msdos.c flushbuf did write(1, .. instead
- X of write(0, .. Added secure to fix security. Fixed pointer
- X use after free() bug in regsub() (made :s fail under MSDOS).
- X Added nofreeNULL(), needed for some UNIXes. Improved window
- X resizing for Unix. Fixed messages for report == 0. Added
- X bsdmemset(). Changed a few small things for portability. Added
- X :list. Made '0' and '^' exclusive. Fixed regexp for /pattern*
- X (did /(pattern)* instead of /pattern(n)*). Added "']" and "'[".
- X Changed Delay(2L) into Delay(10L). Made 'timeout' option
- X vi-compatible, added 'ttimeout' option. Changed TIOCSETP to
- X TIOCSETN in unix.c. Added "ti" and "te" termcap entries, makes
- X sun cmdtool work. Added stop- and starttermcap(). Use cooked
- X output for listings on Amiga only. Added "starting" flag, no ~s
- X anymore with every startup. Modname made portable; Added
- X 'shortname' option, Fixed problems with .vim file on messydos.
- X Global .exrc/.vimrc for Unix added. Added patches for SCO Xenix.
- X Add :w argument to list of alternate file names. Applied a few
- X changes for HPUX. Added Flock in writeit() for safety. Command
- X ":'a,'bm." moved to 'b instead of current line. Argument in
- X 'shell' option allowed. Re-implemented :copy and :move. Fixed
- X BS-CR-BS on empty line bug in edit.c. -t option was ignored if
- X there is a file ".vim". Changed amiga.c to work without
- X arp.library for dos 2.0. Fixed "\$" and "\^" in regexp. Fixed
- X pipe in filter command. Fixed CTRL-U and CTRL-D. With '}' indent
- X in front of the cursor is included in the operated text. Fixed
- X tag with '[' in search pattern. Added CTRL-V to 'r'. Fixed "tc"
- X entry in termlib.c. term_console now default off. Added :noremap
- X and ^V in :map argument. Replaced CTRL by Ctrl because some
- X unixes have this already. Fixed "Empty file" message disappearing
- X when there is no .exrc file. Added CTRL-K for entering digraphs.
- X Removed escape codes from vim.hlp, added handling of inversion to
- X help().
- X
- X VIM 1.26 For Unix: Removed global .exrc; renamed global .vimrc to vimrc.
- X Moved names of *rc and help files to makefile. Added various
- X little changes for different kinds of Unix. Changed CR-LF
- X handling in dosource() for MSDOS. Added :mkvimrc. Fixed
- X WildExpand in unix.c for empty file. Fixed incompatibility with
- X msdos share program (removed setperm(fname, 0) from fileio.c).
- X Added ":set compatible". Fixed 'history=0'.
- X
- X VIM 1.27 Added USE_LOCALE. Changed swapchar() to use toupper() and
- X tolower(). Changed init order: .vimrc before EXINIT. Half-fixed
- X lines that do not fit on screen. A few minor bug fixes. Fixed
- X typehead bug in Read() in unix.c. Added :number. Reset IXON flag
- X in unix.c for CTRL-Q. In tags file any Ex command can be used. Ex
- X search command accepts same flags as normal search command. Fixed
- X '?' in tag search pattern. 'New file' message was wrong when 'bk'
- X and 'wb' options were both off.
- X
- X Vim 1.29 to 1.31 and Vim 2.0 See ../readme2.0.
- X
- X Vim 2.0 When reading and writing files and in some other cases use short
- X filename if ":cd" not used. Fixes problem with networks. Deleted
- X "#include <ctype.h>" from regexp.c. ":v" without argument was not
- X handled correctly in doglob(). Check for tail recursion removed
- X again, because it forbids ":map! foo ^]foo", which is OK. Removed
- X redraw on exit for msdos. Fixed return value for FullName in
- X unix.c. Call_shell does not always use cooked mode, fixes problem
- X with typing CR while doing filename completion in unix. "r<TAB>"
- X now done by edit() to make expandtab works. Implemented FullName
- X for msdos. Implemented the drive specifier for the :cd command for
- X MSDOS. Added CTRL-B and CTRL-E to command line editing. Del key
- X for msdos not mapped to "x" in command mode, could not delete last
- X char of count. Fixed screen being messed up with long commands
- X when 'sc' is set. Fixed use of CR-LF in tags file. Added check
- X for abbreviation when typing ESC or CTRL-O in insert mode. Doing
- X a ":w file" does overwrite when "file" is the current file. Unmap
- X will check for 'to' string if there is no match with 'from'
- X string; Fixes ":unab foo" after ":ab foo bar". Fixed problem in
- X addstar() for msdos: Check for negative index. Added possibility
- X to switch off undo ":set ul=-1". Allow parameters to be set to
- X numbers >32000 for machines with 16 bit ints.
- X
- X Vim 2.1 to 3.0: see readme3.0
- X
- X*/
- X
- Xchar *Version = "VIM 3.0";
- X#if !defined(__DATE__) || !defined(__TIME__)
- Xchar *longVersion = "Vi IMproved 3.0 by Bram Moolenaar (1994 Aug 12)";
- X#else
- Xchar *longVersion = "Vi IMproved 3.0 by Bram Moolenaar (1994 Aug 12, compiled " __DATE__ " " __TIME__ ")";
- X#endif
- END_OF_FILE
- if test 15714 -ne `wc -c <'vim/src/version.c'`; then
- echo shar: \"'vim/src/version.c'\" unpacked with wrong size!
- fi
- # end of 'vim/src/version.c'
- fi
- echo shar: End of archive 7 \(of 26\).
- cp /dev/null ark7isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 26 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-