updated for version 7.0005

This commit is contained in:
Bram Moolenaar
2004-07-03 16:05:59 +00:00
parent cfbc5ee48e
commit 592e0a2a1d
20 changed files with 739 additions and 365 deletions

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 7.0aa. Last change: 2004 Jul 02
*options.txt* For Vim version 7.0aa. Last change: 2004 Jul 03
VIM REFERENCE MANUAL by Bram Moolenaar
@ -3881,8 +3881,8 @@ A jump table for the options with a short description can be found at |Q_op|.
precedes:c Character to show in the first column, when 'wrap'
is off and there is text preceding the character
visible in the first column.
nbsp:c Character to show for non-breakable space. Left to
blank when omitted.
nbsp:c Character to show for a non-breakable space (character
0xA0, 160). Left blank when omitted.
The characters ':' and ',' should not be used. UTF-8 characters can
be used when 'encoding' is "utf-8", otherwise only printable
@ -4260,10 +4260,26 @@ A jump table for the options with a short description can be found at |Q_op|.
Print the line number in front of each line. When the 'n' option is
excluded from 'cpoptions' a wrapped line will not use the column of
line numbers (this is the default when 'compatible' isn't set).
The 'numberwidth' option can be used to set the room used for the line
number.
When a long, wrapped line doesn't start with the first character, '-'
characters are put before the number.
See |hl-LineNr| for the highlighting used for the number.
*'numberwidth'* *'nuw'*
'numberwidth' 'nuw' number (Vim default: 4 Vi default: 8)
local to window
Minimal number of columns to use for the line number. Only relevant
when the 'number' option is set.
Since one space is always between the number and the text, there is
one less character for the number itself.
The value is the minimum width. A bigger width is used when needed to
fit the highest line number in the buffer. Thus with the Vim default
of 4 there is room for a line number up to 999. When the buffer has
1000 lines five columns will be used.
The minimum value is 1, the maximum value is 10.
NOTE: 'numberwidth' is reset to 8 when 'compatible' is set.
*'osfiletype'* *'oft'* *E366*
'osfiletype' 'oft' string (RISC-OS default: "Text",
others default: "")

View File

@ -1,4 +1,4 @@
*quickref.txt* For Vim version 7.0aa. Last change: 2004 Jul 02
*quickref.txt* For Vim version 7.0aa. Last change: 2004 Jul 03
VIM REFERENCE MANUAL by Bram Moolenaar
@ -764,6 +764,7 @@ Short explanation of each option: *option-list*
|'mousetime'| |'mouset'| max time between mouse double-click
|'nrformats'| |'nf'| number formats recognized for CTRL-A command
|'number'| |'nu'| print the line number in front of each line
|'numberwidth'| |'nuw'| number of columns used for the line number
|'osfiletype'| |'oft'| operating system-specific filetype information
|'paragraphs'| |'para'| nroff macros that separate paragraphs
|'paste'| allow pasting text

View File

@ -589,6 +589,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
'nrformats' options.txt /*'nrformats'*
'nu' options.txt /*'nu'*
'number' options.txt /*'number'*
'numberwidth' options.txt /*'numberwidth'*
'nuw' options.txt /*'nuw'*
'oft' options.txt /*'oft'*
'op' vi_diff.txt /*'op'*
'open' vi_diff.txt /*'open'*
@ -4703,6 +4705,12 @@ g:explSuffixesLast pi_expl.txt /*g:explSuffixesLast*
g:explUseSeparators pi_expl.txt /*g:explUseSeparators*
g:explVertical pi_expl.txt /*g:explVertical*
g:explWinSize pi_expl.txt /*g:explWinSize*
g:netrw_a pi_netrw.txt /*g:netrw_a*
g:netrw_list_cmd pi_netrw.txt /*g:netrw_list_cmd*
g:netrw_list_hide pi_netrw.txt /*g:netrw_list_hide*
g:netrw_rm_cmd pi_netrw.txt /*g:netrw_rm_cmd*
g:netrw_rmdir_cmd pi_netrw.txt /*g:netrw_rmdir_cmd*
g:netrw_rmf_cmd pi_netrw.txt /*g:netrw_rmf_cmd*
g:var eval.txt /*g:var*
g; motion.txt /*g;*
g<Down> motion.txt /*g<Down>*
@ -5389,10 +5397,15 @@ netbeans-setup netbeans.txt /*netbeans-setup*
netbeans-support netbeans.txt /*netbeans-support*
netbeans.txt netbeans.txt /*netbeans.txt*
netrw pi_netrw.txt /*netrw*
netrw-- pi_netrw.txt /*netrw--*
netrw-D pi_netrw.txt /*netrw-D*
netrw-activate pi_netrw.txt /*netrw-activate*
netrw-browse pi_netrw.txt /*netrw-browse*
netrw-browse-var pi_netrw.txt /*netrw-browse-var*
netrw-c-l pi_netrw.txt /*netrw-c-l*
netrw-cadaver pi_netrw.txt /*netrw-cadaver*
netrw-contents pi_netrw.txt /*netrw-contents*
netrw-cr pi_netrw.txt /*netrw-cr*
netrw-credits pi_netrw.txt /*netrw-credits*
netrw-debug pi_netrw.txt /*netrw-debug*
netrw-delete pi_netrw.txt /*netrw-delete*
@ -5400,20 +5413,27 @@ netrw-dir pi_netrw.txt /*netrw-dir*
netrw-ex pi_netrw.txt /*netrw-ex*
netrw-file pi_netrw.txt /*netrw-file*
netrw-fixup pi_netrw.txt /*netrw-fixup*
netrw-ftp pi_netrw.txt /*netrw-ftp*
netrw-h pi_netrw.txt /*netrw-h*
netrw-help pi_netrw.txt /*netrw-help*
netrw-history pi_netrw.txt /*netrw-history*
netrw-list pi_netrw.txt /*netrw-list*
netrw-list-hack pi_netrw.txt /*netrw-list-hack*
netrw-move pi_netrw.txt /*netrw-move*
netrw-netrc pi_netrw.txt /*netrw-netrc*
netrw-o pi_netrw.txt /*netrw-o*
netrw-options pi_netrw.txt /*netrw-options*
netrw-passwd pi_netrw.txt /*netrw-passwd*
netrw-protocol pi_netrw.txt /*netrw-protocol*
netrw-r pi_netrw.txt /*netrw-r*
netrw-ref pi_netrw.txt /*netrw-ref*
netrw-remove pi_netrw.txt /*netrw-remove*
netrw-rename pi_netrw.txt /*netrw-rename*
netrw-s pi_netrw.txt /*netrw-s*
netrw-transparent pi_netrw.txt /*netrw-transparent*
netrw-uidpass pi_netrw.txt /*netrw-uidpass*
netrw-urls pi_netrw.txt /*netrw-urls*
netrw-v pi_netrw.txt /*netrw-v*
netrw-var pi_netrw.txt /*netrw-var*
netrw-x pi_netrw.txt /*netrw-x*
netrw-xfer pi_netrw.txt /*netrw-xfer*

View File

@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.0aa. Last change: 2004 Jul 02
*todo.txt* For Vim version 7.0aa. Last change: 2004 Jul 03
VIM REFERENCE MANUAL by Bram Moolenaar
@ -30,32 +30,10 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
Docs for 'numberwidth'. index. optwin.vim
For version 7.0:
- Include many PATCHES:
7 Add "nbsp" in 'listchars'? Patch from David Blanchet, 2003 Jul 28.
again 2004 Jun 16
8 Add ":n" to fnamemodify(): normalize path, remove "../" when possible.
Aric Blumer has a patch for this.
He will update the patch for 6.3.
9 Add cursor-column highlighting. Enable it with 'cursorcolumn' option,
set highlighting with "CursorColumn" group. Useful for aligning text.
Also cursor-row highlighting. Patch from Yasuhiro Matsumoto for
underlining the cursor line, 2004 Mar 24. Update 2004 Jun 17
Alternatie: when 'number' is set highlight the number of the current
line.
7 Completion of network shares, patch by Yasuhiro Matsumoto.
Update 2004 Jun 17.
8 Patches from Peter "Rain Dog" Cucka:
- guifont selector (2002 Dec 15)
update 2004 Jun 20
7 Add an option to set the width of the 'number' column. Eight
positions is often more than needed. Or adjust the width to the
length of the file?
Add patch that adds 'numberlen' option. (James Harvey)
Other patch with min and max from Emmanuel Renieris (2002 Jul 24)
Other patch without an option by Gilles Roy (2002 Jul 25)
New patch from Emmanuel Renieris, 2004 Jun 17
Needs more work: use one option with one or two numbers
7 Be able to call a function while passing on a variable number of
arguments:
:function Foo(abc, ...)
@ -88,6 +66,9 @@ For version 7.0:
Resp: no time now.
8 Add GTK 2.3 file dialog support. Patch by Grahame Bowland, 2004 Mar 15,
but it doesn't use "initdir" or "dflt". (will update patch)
8 Add ":n" to fnamemodify(): normalize path, remove "../" when possible.
Aric Blumer has a patch for this.
He will update the patch for 6.3.
8 Add buffer-local autocommands? Reduces overhead for autocommands that
trigger often (inserting a character, switching mode).
:au Event <buffer> do-something
@ -100,6 +81,13 @@ For version 7.0:
VimResized - When the Vim window has been resized (SIGWINCH)
patch from Yakov Lerner, 2003 July 24.
He'll write documentation and send updated patch.
7 Completion of network shares, patch by Yasuhiro Matsumoto.
Update 2004 Jun 17.
How does this work? Missing comments.
gettext() Translate a message. (Patch from Yasuhiro Matsumoto)
Update 2004 Jun 17
Missing docs. Search in 'runtimepath'?
How to get the messages into the .po files?
--- responses above --
7 Make "5dd" on last-but-one-line not delete anything (Vi compatible).
Add flag in 'cpoptions' for this. When not present, "2dd" in the last
@ -152,10 +140,6 @@ For version 7.0:
find() find file in 'path' (patch from Johannes
Zellner 2001 Dec 20)
Update 2004 Jun 16.
gettext() Translate a message. (Patch from Yasuhiro
Matsumoto) How to get the messages into the
.po files?
Update 2004 Jun 17
realname() Get user name (first, last, full)
user_fullname() patch by Nikolai Weibull, Nov
3 2002)
@ -221,6 +205,7 @@ For version 7.0:
- In the kvim/KDE source files fix the formatting.
- KDE version is called "kvim". Make it "gvim", like the others?
- Better configure check for KDE include files from Dan Sharp.
- Change ga_room into ga_maxlen, so that it doesn't need to be
incremented/decremented each time.
- For string variables, use length instead of NUL termination.
@ -289,10 +274,15 @@ For version 7.0:
- Mac: Unicode input and display (Eckehard Berns, June 27)
8 Add patch from Muraoka Taro (Mar 16) to support input method on Mac?
New patch 2004 Jun 16
7 Add the MzScheme interface?
NO: it changes too much of the code, while hardly anybody will use it.
Patch on http://iamphet.nm.ru/scheme/ (Sergey Khorev)
Alt URL: http://cyber.miem.edu.ru/~iamphet/scheme/mzvim-0.560.tar.gz
7 Add the MzScheme interface? New patch 2004 Jul 2. (Sergey Khorev)
Also fix a few Lisp problems.
9 Add cursor-column highlighting. Enable it with 'cursorcolumn' option,
set highlighting with "CursorColumn" group. Useful for aligning text.
Also cursor-row highlighting. Patch from Yasuhiro Matsumoto for
underlining the cursor line: 2004 Jun 17. Should use highlight group
instead.
Alternative: when 'number' is set highlight the number of the current
line.
Vi incompatibility:
8 With undo/redo only marks in the changed lines should be changed. Other

View File

@ -1,4 +1,4 @@
*version7.txt* For Vim version 7.0aa. Last change: 2004 Jul 02
*version7.txt* For Vim version 7.0aa. Last change: 2004 Jul 03
VIM REFERENCE MANUAL by Bram Moolenaar
@ -86,6 +86,8 @@ Options: ~
mode to do any kind of completion. (Taro Muraoka)
'quoteescape' Characters used to escape quotes inside a string.
Used for the a", a' and a` text objects. |a'|
'numberwidth' Minimal width of the space used for the 'number'
option. (Emmanuel Renieris)
Ex commands: ~
@ -116,6 +118,8 @@ character selections can be used between two Vims. (Eckehard Berns)
Also fixes the problem that setting 'clipboard' to "unnamed" breaks using
"yyp".
Mac: GUI font selector. (Peter "Rain Dog" Cucka)
The netrw plugin now also supports viewing a directory, when "scp://" is used.
Deleting and renaming files is possible. (Charles Campbell)
@ -133,6 +137,8 @@ few more important commands. Used ideas from Gabriel Zachmann.
Unix: When libcall() fails obtain an error message with dlerror() and display
it. (Johannes Zellner)
Added "nbsp" in 'listchars'. (David Blanchet)
==============================================================================
COMPILE TIME CHANGES *compile-changes-7*

View File

@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2004 Jul 02
" Last Change: 2004 Jul 03
" If there already is an option window, jump to that one.
if bufwinnr("option-window") > 0
@ -359,6 +359,11 @@ call <SID>OptionG("lcs", &lcs)
call append("$", "number\tshow the line number for each line")
call append("$", "\t(local to window)")
call <SID>BinOptionL("nu")
if has("linebreak")
call append("$", "numberwidth\tnumber of columns to use for the line number")
call append("$", "\t(local to window)")
call <SID>OptionL("nuw")
endif
call <SID>Header("syntax and highlighting")

View File

@ -497,7 +497,7 @@ CClink = $(CC)
#CFLAGS = -g -O2 -fno-strength-reduce -Wall -Wmissing-prototypes
#CFLAGS = -O6 -fno-strength-reduce -Wall -Wshadow -Wmissing-prototypes
#CFLAGS = -g -DDEBUG -Wall -Wshadow -Wmissing-prototypes
#CFLAGS = -g -O2 -DSTARTUPTIME=\"vimstartup\" -fno-strength-reduce -Wall -Wmissing-prototypes
#CFLAGS = -g -O2 '-DSTARTUPTIME="vimstartup"' -fno-strength-reduce -Wall -Wmissing-prototypes
# EFENCE - Electric-Fence malloc debugging: catches memory accesses beyond
# allocated memory (and makes every malloc()/free() very slow).
@ -1492,8 +1492,11 @@ config auto/config.mk: auto/configure config.mk.in config.h.in
# Use "make reconfig" to rerun configure without cached values.
# When config.h changes, most things will be recompiled automatically.
# Use "myself" to make "all" with a possibly changed auto/config.mk.
reconfig: scratch clean config myself
# Invoke $(MAKE) to run config with the empty auto/config.mk.
# Invoke $(MAKE) to build all with the filled auto/config.mk.
reconfig: scratch clean
$(MAKE) -f Makefile config
$(MAKE) -f Makefile all
# Run autoconf to produce auto/configure.
# Note:
@ -2413,9 +2416,11 @@ objects/gui_kde_widget.o: gui_kde_widget.cc
$(KDE_DIR)/bin/dcopidl2cpp --c++-suffix cc --no-stub kvim_iface.kidl
$(CCC) -o $@ gui_kde_widget.cc
gui_kde_widget_moc.cc: objects/gui_kde_widget.o
objects/gui_kde_widget_moc.o: gui_kde_widget_moc.cc
$(CCC) -o $@ gui_kde_widget_moc.cc
kvim_iface_skel.cc: objects/gui_kde_widget.o
objects/kvim_iface_skel.o: kvim_iface_skel.cc
$(CCC) -o $@ kvim_iface_skel.cc

628
src/auto/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -993,6 +993,7 @@ dnl Skip everything by default.
SKIP_GTK=YES
SKIP_GTK2=YES
SKIP_GNOME=YES
SKIP_KDE=YES
SKIP_MOTIF=YES
SKIP_ATHENA=YES
SKIP_NEXTAW=YES

View File

@ -1956,11 +1956,11 @@ print_line_no_prefix(lnum, use_number)
linenr_T lnum;
int use_number;
{
char_u numbuf[20];
char_u numbuf[30];
if (curwin->w_p_nu || use_number)
{
sprintf((char *)numbuf, "%7ld ", (long)lnum);
sprintf((char *)numbuf, "%*ld ", number_width(curwin), (long)lnum);
msg_puts_attr(numbuf, hl_attr(HLF_N)); /* Highlight line nrs */
}
msg_prt_line(ml_get(lnum));

View File

@ -3974,6 +3974,7 @@ ExpandUserDefined(xp, regmatch, num_file, file)
char_u num[50];
garray_T ga;
int save_current_SID = current_SID;
struct cmdline_info save_ccline;
if (xp->xp_arg == NULL || xp->xp_arg[0] == '\0')
return FAIL;
@ -3987,9 +3988,17 @@ ExpandUserDefined(xp, regmatch, num_file, file)
args[1] = ccline.cmdbuff;
args[2] = num;
/* Save the cmdline, we don't know what the function may do. */
save_ccline = ccline;
ccline.cmdbuff = NULL;
ccline.cmdprompt = NULL;
current_SID = xp->xp_scriptID;
all = call_vim_function(xp->xp_arg, 3, args, FALSE);
ccline = save_ccline;
current_SID = save_current_SID;
ccline.cmdbuff[ccline.cmdlen] = keep;
if (all == NULL)
return FAIL;

View File

@ -246,6 +246,7 @@
/*
* +linebreak 'showbreak', 'breakat' and 'linebreak' options.
* Also 'numberwidth'.
*/
#ifdef FEAT_NORMAL
# define FEAT_LINEBREAK

View File

@ -203,6 +203,16 @@ ControlActionUPP gScrollDrag;
/* Keeping track of which scrollbar is being dragged */
static ControlHandle dragged_sb = NULL;
#if defined(USE_CARBONIZED) && defined(MACOS_X)
static struct
{
FMFontFamily family;
FMFontSize size;
FMFontStyle style;
Boolean isPanelVisible;
} gFontPanelInfo = { 0, 0, 0, false };
#endif
/*
* The Quickdraw global is predefined in CodeWarior
* but is not in Apple MPW
@ -1436,6 +1446,99 @@ InstallAEHandlers(void)
}
#endif /* USE_AEVENT */
#if defined(USE_CARBONIZED) && defined(MACOS_X)
/*
* Callback function, installed by InstallFontPanelHandler(), below,
* to handle Font Panel events.
*/
static OSStatus
FontPanelHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent,
void *inUserData)
{
if (GetEventKind(inEvent) == kEventFontPanelClosed)
{
gFontPanelInfo.isPanelVisible = false;
return noErr;
}
if (GetEventKind(inEvent) == kEventFontSelection)
{
OSStatus status;
FMFontFamily newFamily;
FMFontSize newSize;
FMFontStyle newStyle;
/* Retrieve the font family ID number. */
status = GetEventParameter(inEvent, kEventParamFMFontFamily,
/*inDesiredType=*/typeFMFontFamily, /*outActualType=*/NULL,
/*inBufferSize=*/sizeof(FMFontFamily), /*outActualSize=*/NULL,
&newFamily);
if (status == noErr)
gFontPanelInfo.family = newFamily;
/* Retrieve the font size. */
status = GetEventParameter(inEvent, kEventParamFMFontSize,
typeFMFontSize, NULL, sizeof(FMFontSize), NULL, &newSize);
if (status == noErr)
gFontPanelInfo.size = newSize;
/* Retrieve the font style (bold, etc.). Currently unused. */
status = GetEventParameter(inEvent, kEventParamFMFontStyle,
typeFMFontStyle, NULL, sizeof(FMFontStyle), NULL, &newStyle);
if (status == noErr)
gFontPanelInfo.style = newStyle;
}
return noErr;
}
static void
InstallFontPanelHandler()
{
EventTypeSpec eventTypes[2];
EventHandlerUPP handlerUPP;
/* EventHandlerRef handlerRef; */
eventTypes[0].eventClass = kEventClassFont;
eventTypes[0].eventKind = kEventFontSelection;
eventTypes[1].eventClass = kEventClassFont;
eventTypes[1].eventKind = kEventFontPanelClosed;
handlerUPP = NewEventHandlerUPP(FontPanelHandler);
InstallApplicationEventHandler(handlerUPP, /*numTypes=*/2, eventTypes,
/*userData=*/NULL, /*handlerRef=*/NULL);
}
/*
* Fill the buffer pointed to by outName with the name and size
* of the font currently selected in the Font Panel.
*/
static void
GetFontPanelSelection(char_u* outName)
{
Str255 buf;
Boolean isBold = false, isItalic = false;
if (!outName)
return;
(void)FMGetFontFamilyName(gFontPanelInfo.family, buf);
p2cstrcpy(outName, buf);
#if 0 /* TODO: enable when styles are supported in gui_mac_find_font() */
isBold = (gFontPanelInfo.style & bold);
isItalic = (gFontPanelInfo.style & italic);
#endif
sprintf(&outName[buf[0]], ":h%d%s%s", gFontPanelInfo.size,
(isBold ? ":b" : ""), (isItalic ? ":i" : ""));
}
#endif
/*
* ------------------------------------------------------------
* Unfiled yet
@ -2614,6 +2717,28 @@ gui_mac_find_font(font_name)
*p = c;
GetFNum(pFontName, &font_id);
if (font_id == 0)
{
/*
* Try again, this time replacing underscores in the font name
* with spaces (:set guifont allows the two to be used
* interchangeably; the Font Manager doesn't).
*/
int i, changed = FALSE;
for (i = pFontName[0]; i > 0; --i)
{
if (pFontName[i] == '_')
{
pFontName[i] = ' ';
changed = TRUE;
}
}
if (changed)
GetFNum(pFontName, &font_id);
}
#else
/* name = C2Pascal_save(menu->dname); */
fontNamePtr = C2Pascal_save_and_remove_backslash(font_name);
@ -3002,6 +3127,11 @@ gui_mch_init()
gScrollDrag = NewControlActionProc(gui_mac_drag_thumb);
#endif
#if defined(USE_CARBONIZED) && defined(MACOS_X)
/* Install Carbon event callbacks. */
(void)InstallFontPanelHandler();
#endif
/* Getting a handle to the Help menu */
#ifdef USE_HELPMENU
# ifdef USE_CARBONIZED
@ -3233,6 +3363,56 @@ gui_mch_get_screen_dimensions(screen_w, screen_h)
}
#if defined(USE_CARBONIZED) && defined(MACOS_X)
/*
* Open the Font Panel and wait for the user to select a font and
* close the panel. Then fill the buffer pointed to by font_name with
* the name and size of the selected font and return the font's handle,
* or NOFONT in case of an error.
*/
static GuiFont
gui_mac_select_font(char_u *font_name)
{
GuiFont selected_font = NOFONT;
OSStatus status;
FontSelectionQDStyle curr_font;
/* Initialize the Font Panel with the current font. */
curr_font.instance.fontFamily = gui.norm_font & 0xFFFF;
curr_font.size = (gui.norm_font >> 16);
/* TODO: set fontStyle once styles are supported in gui_mac_find_font() */
curr_font.instance.fontStyle = 0;
curr_font.hasColor = false;
curr_font.version = 0; /* version number of the style structure */
status = SetFontInfoForSelection(kFontSelectionQDType,
/*numStyles=*/1, &curr_font, /*eventTarget=*/NULL);
gFontPanelInfo.family = curr_font.instance.fontFamily;
gFontPanelInfo.style = curr_font.instance.fontStyle;
gFontPanelInfo.size = curr_font.size;
/* Pop up the Font Panel. */
status = FPShowHideFontPanel();
if (status == noErr)
{
/*
* The Font Panel is modeless. We really need it to be modal,
* so we spin in an event loop until the panel is closed.
*/
gFontPanelInfo.isPanelVisible = true;
while (gFontPanelInfo.isPanelVisible)
{
EventRecord e;
WaitNextEvent(everyEvent, &e, /*sleep=*/20, /*mouseRgn=*/NULL);
}
GetFontPanelSelection(font_name);
selected_font = gui_mac_find_font(font_name);
}
return selected_font;
}
#endif
/*
* Initialise vim to use the font with the given name. Return FAIL if the font
@ -3262,6 +3442,31 @@ gui_mch_init_font(font_name, fontset)
}
font = (suggestedSize << 16) + ((long) font_id & 0xFFFF);
}
#if defined(USE_CARBONIZED) && defined(MACOS_X)
else if (STRCMP(font_name, "*") == 0)
{
char_u *new_p_guifont, font_name[512];
font = gui_mac_select_font(font_name);
if (font == NOFONT)
return FAIL;
/* Set guifont to the name of the selected font. */
new_p_guifont = alloc(STRLEN(font_name) + 1);
if (new_p_guifont != NULL)
{
STRCPY(new_p_guifont, font_name);
vim_free(p_guifont);
p_guifont = new_p_guifont;
/* Replace spaces in the font name with underscores. */
for ( ; *new_p_guifont; ++new_p_guifont)
{
if (*new_p_guifont == ' ')
*new_p_guifont = '_';
}
}
}
#endif
else
{
font = gui_mac_find_font(font_name);

View File

@ -243,3 +243,8 @@
/* Whether to draw the vertical bar on the right side of the cell. */
# define CURSOR_BAR_RIGHT (curwin->w_p_rl && (!(State & CMDLINE) || cmdmsg_rl))
#endif
#ifndef FEAT_LINEBREAK
/* Without the 'numberwidth' option line numbers are always 7 chars. */
# define number_width(x) 7
#endif

View File

@ -257,6 +257,9 @@ ml_open()
curbuf->b_ml.ml_mfp = mfp;
curbuf->b_ml.ml_flags = ML_EMPTY;
curbuf->b_ml.ml_line_count = 1;
#ifdef FEAT_LINEBREAK
curwin->w_nrwidth_line_count = 0;
#endif
#if defined(MSDOS) && !defined(DJGPP)
/* for 16 bit MS-DOS create a swapfile now, because we run out of

View File

@ -892,7 +892,7 @@ validate_cursor_col()
win_col_off(wp)
win_T *wp;
{
return ((wp->w_p_nu ? 8 : 0)
return ((wp->w_p_nu ? number_width(wp) + 1 : 0)
#ifdef FEAT_CMDWIN
+ (cmdwin_type == 0 || wp != curwin ? 0 : 1)
#endif
@ -925,7 +925,7 @@ win_col_off2(wp)
win_T *wp;
{
if (wp->w_p_nu && vim_strchr(p_cpo, CPO_NUMCOL) != NULL)
return 8;
return number_width(wp) + 1;
return 0;
}

View File

@ -106,6 +106,7 @@ typedef enum
, PV_MPS
, PV_NF
, PV_NU
, PV_NUW
, PV_OFT
, PV_PATH
, PV_PI
@ -1546,6 +1547,13 @@ static struct vimoption
{"number", "nu", P_BOOL|P_VI_DEF|P_RWIN,
(char_u *)VAR_WIN, PV_NU,
{(char_u *)FALSE, (char_u *)0L}},
{"numberwidth", "nuw", P_NUM|P_RWIN|P_VIM,
#ifdef FEAT_LINEBREAK
(char_u *)VAR_WIN, PV_NUW,
#else
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)8L, (char_u *)4L}},
{"open", NULL, P_BOOL|P_VI_DEF,
(char_u *)NULL, PV_NONE,
{(char_u *)FALSE, (char_u *)0L}},
@ -1598,7 +1606,7 @@ static struct vimoption
{"preserveindent", "pi", P_BOOL|P_VI_DEF|P_VIM,
(char_u *)&p_pi, PV_PI,
{(char_u *)FALSE, (char_u *)0L}},
{"previewheight", "pvh",P_NUM|P_VI_DEF,
{"previewheight", "pvh", P_NUM|P_VI_DEF,
#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
(char_u *)&p_pvh, PV_NONE,
#else
@ -6631,7 +6639,7 @@ set_num_option(opt_idx, varp, value, errbuf, opt_flags)
}
# ifdef FEAT_VERTSPLIT
if (pp == &p_wiw)
else if (pp == &p_wiw)
{
if (p_wiw < 1)
{
@ -6809,6 +6817,24 @@ set_num_option(opt_idx, varp, value, errbuf, opt_flags)
p_ul = value;
}
#ifdef FEAT_LINEBREAK
/* 'numberwidth' must be positive */
else if (pp == &curwin->w_p_nuw)
{
if (curwin->w_p_nuw < 1)
{
errmsg = e_positive;
curwin->w_p_nuw = 1;
}
if (curwin->w_p_nuw > 10)
{
errmsg = e_invarg;
curwin->w_p_nuw = 10;
}
curwin->w_nrwidth_line_count = 0;
}
#endif
/*
* Check the bounds for numeric options here
*/
@ -7857,6 +7883,9 @@ get_varp(p)
case PV_FMR: return (char_u *)&(curwin->w_p_fmr);
#endif
case PV_NU: return (char_u *)&(curwin->w_p_nu);
#ifdef FEAT_LINEBREAK
case PV_NUW: return (char_u *)&(curwin->w_p_nuw);
#endif
#if defined(FEAT_WINDOWS)
case PV_WFH: return (char_u *)&(curwin->w_p_wfh);
#endif
@ -8025,6 +8054,9 @@ copy_winopt(from, to)
#endif
to->wo_list = from->wo_list;
to->wo_nu = from->wo_nu;
#ifdef FEAT_LINEBREAK
to->wo_nuw = from->wo_nuw;
#endif
#ifdef FEAT_RIGHTLEFT
to->wo_rl = from->wo_rl;
to->wo_rlc = vim_strsave(from->wo_rlc);

View File

@ -43,4 +43,5 @@ void unshowmode __ARGS((int force));
int redrawing __ARGS((void));
int messaging __ARGS((void));
void showruler __ARGS((int always));
int number_width __ARGS((win_T *wp));
/* vim: set ft=c : */

View File

@ -415,6 +415,13 @@ update_screen(type)
if (clear_cmdline) /* going to clear cmdline (done below) */
check_for_delay(FALSE);
#ifdef FEAT_LINEBREAK
/* Force redraw when width of 'number' column changes. */
if (curwin->w_redr_type < NOT_VALID
&& curwin->w_nrwidth != number_width(curwin))
curwin->w_redr_type = NOT_VALID;
#endif
/*
* Only start redrawing if there is really something to do.
*/
@ -822,6 +829,17 @@ win_update(wp)
search_hl.first_lnum = 0;
#endif
#ifdef FEAT_LINEBREAK
/* Force redraw when width of 'number' column changes. */
i = number_width(curwin);
if (curwin->w_nrwidth != i)
{
type = NOT_VALID;
curwin->w_nrwidth = i;
}
else
#endif
if (buf->b_mod_set && buf->b_mod_xlines != 0 && wp->w_redraw_top != 0)
{
/*
@ -2101,9 +2119,11 @@ fold_line(wp, fold_count, foldinfo, lnum, row)
len = W_WIDTH(wp) - col;
if (len > 0)
{
if (len > 8)
len = 8;
sprintf((char *)buf, "%7ld ", (long)lnum);
int w = number_width(wp);
if (len > w + 1)
len = w + 1;
sprintf((char *)buf, "%*ld ", w, (long)lnum);
#ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
/* the line number isn't reversed */
@ -3073,7 +3093,8 @@ win_line(wp, lnum, startrow, endrow)
#endif
)
{
sprintf((char *)extra, "%7ld ", (long)lnum);
sprintf((char *)extra, "%*ld ",
number_width(wp), (long)lnum);
if (wp->w_skipcol > 0)
for (p_extra = extra; *p_extra == ' '; ++p_extra)
*p_extra = '-';
@ -3086,7 +3107,7 @@ win_line(wp, lnum, startrow, endrow)
}
else
c_extra = ' ';
n_extra = 8;
n_extra = number_width(wp) + 1;
char_attr = hl_attr(HLF_N);
}
}
@ -8457,3 +8478,40 @@ win_redr_ruler(wp, always)
}
}
#endif
#if defined(FEAT_LINEBREAK) || defined(PROTO)
/*
* Return the width of the 'number' column.
* Zero when 'number' isn't set.
* Otherwise it depends on 'numberwidth' and the line count.
*/
int
number_width(wp)
win_T *wp;
{
int n;
linenr_T lnum;
if (!wp->w_p_nu)
return 0;
lnum = wp->w_buffer->b_ml.ml_line_count;
if (lnum == wp->w_nrwidth_line_count)
return wp->w_nrwidth_width;
wp->w_nrwidth_line_count = lnum;
n = 0;
do
{
lnum /= 10;
++n;
} while (lnum > 0);
/* 'numberwidth' gives the minimal width plus one */
if (n < wp->w_p_nuw - 1)
n = wp->w_p_nuw - 1;
wp->w_nrwidth_width = n;
return n;
}
#endif

View File

@ -169,6 +169,10 @@ typedef struct
#define w_p_list w_onebuf_opt.wo_list /* 'list' */
int wo_nu;
#define w_p_nu w_onebuf_opt.wo_nu /* 'number' */
#ifdef FEAT_LINEBREAK
long wo_nuw;
# define w_p_nuw w_onebuf_opt.wo_nuw /* 'numberwidth' */
#endif
#if defined(FEAT_WINDOWS)
int wo_wfh;
# define w_p_wfh w_onebuf_opt.wo_wfh /* 'winfixheight' */
@ -1470,6 +1474,9 @@ struct window
char w_foldinvalid; /* when TRUE: folding needs to be
recomputed */
#endif
#ifdef FEAT_LINEBREAK
int w_nrwidth; /* width of 'number' column being used */
#endif
/*
* === end of cached values ===
@ -1578,6 +1585,11 @@ struct window
#ifdef FEAT_GUI
scrollbar_T w_scrollbars[2]; /* vert. Scrollbars for this window */
#endif
#ifdef FEAT_LINEBREAK
linenr_T w_nrwidth_line_count; /* line count when ml_nrwidth_width
* was computed. */
int w_nrwidth_width; /* nr of chars to print line count. */
#endif
#ifdef FEAT_PERL
void *perl_private;