Commit Graph

65 Commits

Author SHA1 Message Date
Eliseo Martínez
d228b8a93e Remove nonnullret deadcode: vim_strsave. 2015-01-27 01:33:33 +01:00
Jack Danger Canty
19c22cdb80 "halfway a line" is a very confusing phrase
If you Google for this phrase found in the Vim documentation you'll find
almost exclusively hits from the Vim documentation. I think changing
"halfway a line" to "halfway through a line" makes more sense.

There seems to be an pervasive odd use of the word 'halfway' in the
original docs which I'm updating everywhere.
2015-01-22 21:57:03 -08:00
Michael Reed
cd8e91b87e Macro cleanup: HAS_SWAP_EXISTS_ACTION
Neovim always ships with all features[0], so this serves no purpose.
Besides, this always evaluated to true.

[0]: https://github.com/neovim/neovim/wiki/Differences-from-vim
2015-01-14 15:08:19 -05:00
Michael Reed
d86ebc7afb Macro cleanup: PROTO
Regarding dict_lookup() in eval.c: both definitions are the same, the
only difference being the spacing between the indirection operator and
the indentation level.
2015-01-14 15:07:16 -05:00
Eliseo Martínez
7f7262e933 Cleanup: Rename getdigits() family functions. 2015-01-11 21:04:08 +01:00
Eliseo Martínez
04c0658024 Cleanup: Refactor getdigits().
Problem  : getdigits() currently returns a long, but at most places,
           return value is casted (unsafely) into an int. Making casts
           safe would introduce a lot of fuss in the form of assertions
           checking for limits.
Note     : We cannot just change return type to int, because, at some
           places, legitimate long values are used. For example, in
           diff.c, for line numbers.
Solution : Introduce new functions:
           - get_digits()      : Gets an intmax_t from a string.
           - get_int_digits()  : Wrapper for ints.
           - get_long_digits() : Wrapper for longs.
           And replace getdigits() invocations by the appropiate
           wrapper invocations.
2015-01-11 17:18:39 +01:00
Florian Walch
c4e0cd4418 vim-patch:7.4.452
Problem:    Can't build with tiny features. (Tony Mechelynck)
Solution:   Use "return" instead of "break".

https://code.google.com/p/vim/source/detail?r=v7-4-452
2014-12-23 16:14:24 +01:00
Florian Walch
1e17904eb2 vim-patch:7.4.449
Problem:    Can't easily close the help window. (Chris Gaal)
Solution:   Add ":helpclose". (Christian Brabandt)

https://code.google.com/p/vim/source/detail?r=v7-4-449
2014-12-23 16:14:24 +01:00
Michael Reed
a62fe49d3c Remove Amiga remnants
Notes regarding the removal of specific items:

  - Aztec C: only on the Amiga.
  - mch_check_win(): doesn't exist anymore.
  - Comment in ex_cmds.c: It seems the context for this comment was
    removed, but the comment was inadvertantly left alone.
2014-12-19 15:28:49 -05:00
Felipe Oliveira Carvalho
3c857900fe Define and use the ARRAY_SIZE macro
A similar macro is defined in the Linux kernel [1].

To refactor the code I used a slightly modified Coccinelle script I found in
[2].

```diff
// Use the macro ARRAY_SIZE when possible
//
// Confidence: High
// Copyright: (C) Gilles Muller, Julia Lawall, EMN, DIKU.  GPLv2.
// URL: http://www.emn.fr/x-info/coccinelle/rules/array.html
// Options: -I ... -all_includes can give more complete results

@@
type T;
T[] E;
@@

- (sizeof(E)/sizeof(*E))
+ ARRAY_SIZE(E)

@@
type T;
T[] E;
@@

- (sizeof(E)/sizeof(E[...]))
+ ARRAY_SIZE(E)

@@
type T;
T[] E;
@@

- (sizeof(E)/sizeof(T))
+ ARRAY_SIZE(E)

@n@
identifier AS,E;
@@

- #define AS(E) ARRAY_SIZE(E)

@@
expression E;
identifier n.AS;
@@

- AS(E)
+ ARRAY_SIZE(E)
```

`spatch --in-place --sp-file array_size.cocci -I src/ -I build/include/ -I build/src/nvim/auto/ src/nvim/*.c`

[1] http://lxr.free-electrons.com/source/include/linux/kernel.h#L54
[2] http://www.emn.fr/z-info/coccinelle/rules/#macros
2014-12-18 15:41:37 -03:00
Eliseo Martínez
b8123cb4af vim-patch:7.4.543.
Adapt #1533 and #1596 to conform to upstream patch
(https://groups.google.com/forum/#!topic/vim_dev/vp0Lwo9f56s).

Problem:    Since patch 7.4.232 "1,3s/\n//" joins two lines instead of
            three.
            (Eliseo Martínez)  Issue 287
Solution:   Correct the line count. (Christian Brabandt)
            Also set the last used search pattern.
2014-12-15 01:38:56 +01:00
Felipe Oliveira Carvalho
0bc40e660c Simple refatorings that didn't fit the pattern of the last commit 2014-12-13 23:36:11 -03:00
Felipe Oliveira Carvalho
77135447e0 Reduce indentation level by early returning or continuing loop
Replace code like this

```c
func() {
    if (cond) {
	...
	...
	...
    }
    return ret;
}
```

```c
for (...) {
    if (cond) {
	...
	...
	...
    }
}
```

with

```c
func() {
    if (!cond) {
	return ret;
    }
    ...
    ...
    ...
}
```

```c
for (...) {
    if (!cond) {
	continue;
    }
    ...
    ...
    ...
}
```
2014-12-13 23:36:11 -03:00
Joel Teichroeb
e10670ac3b vim-patch:? Fix memory leak in readviminfo
Patch provided by Christian Brabandt
Improved by oni-link
2014-12-13 11:43:48 -08:00
Felipe Oliveira Carvalho
8ee5659d83 GA_DEEP_FREE_PTR: deep free macro for garrays that store simple pointers
By "simple pointer" I mean a pointer that can be freed with a call to `free`
without leaking any member pointer.

This macro does exactly what `ga_clear_strings` does.
2014-12-11 20:22:36 -03:00
Thiago de Arruda
8b6473bd41 shell: Remove kShellOptCooked from ShellOpts 2014-12-03 10:12:12 -03:00
Eliseo Martínez
d146b7c7ca Fix newline substitution: Adapt to upstream patch.
Fix previous changes to be compatible with agreed changes to upstream
vim (https://code.google.com/p/vim/issues/detail?id=287).
2014-12-02 19:04:30 +01:00
Thiago de Arruda
14f88b6865 term: Move more mouse functions to mouse.c 2014-12-02 07:21:28 -03:00
Eliseo Martínez
2072fd3058 Fix newline substitution.
Problem  : Command `s/\n//` is being translated into a call to do_join
           with a count of 1. But do_join asserts its precondition count
           >= 2, which is causing the program to abort.
Note     : This in fact revealed bigger problems: generated join command
           line count, as well as reported substitutions/lines were
           wrong in several cases, since patch 7.4.232.
           See:
           [patch] http://markmail.org/message/vo7ruair5raccawp
           [issue] https://code.google.com/p/vim/issues/detail?id=287
Solution : - Don't generate join command for single-line-range case.
           - Make generated join command include:
             * lines in range + 1, when range doesn't end at last line.
             * lines in range, when range ends at last line.
           - Make reported substitutions/lines always be
             number-of-lines-joined - 1.
2014-11-28 20:00:06 +01:00
Thiago de Arruda
bf6bb27e79 ui: Remove redundant ui.h includes
Also move read_error_exit to os/input.c
2014-11-27 15:00:30 -03:00
Thiago de Arruda
1865b8c1c1 ui: Remove ui_delay, ui_breakcheck and ui_set_shellsize
These functions only used to call another os_* function, so remove them and
replace all occurences in the project.
2014-11-27 14:27:18 -03:00
Wayne Rowcliffe
63e2558870 Convert some values from buffer_defs.h to bools 2014-11-12 00:38:34 -06:00
Eliseo Martínez
3efd39a41b Fix warnings: ex_cmds.c: do_ecmd(): Np dereference: FP.
Problem    : Dereference of null pointer @ 2768.
Diagnostic : False positive.
Rationale  : `win_valid(oldwin)` implies `oldwin` not null.
Resolution : Assert `oldwin` not null.
2014-11-11 01:43:11 +01:00
Eliseo Martínez
9c3a3e1381 Fix warnings: ex_cmds.c: do_ascii(): Garbage value (2): MI.
Problems   : Assigned value is garbage or undefined @ 127.
             Assigned value is garbage or undefined @ 152.
Diagnostic : Multithreading issues.
Rationale  : Error could only occurr if global `enc_utf8` changed while
             the function is executing.
Resolution : Use local copy of global var.
2014-11-11 01:43:10 +01:00
Kartik K. Agaram
250298884b fix 'sign unplace id'
Since the introduction of the FOR_ALL_BUFFERS macro, 'sign unplace id'
without a buffer was only removing the sign from the first buffer rather
than all buffers, as described in the documentation.

  :help sign-unplace

--

modeline discussion: https://github.com/akkartik/neovim/commit/7863c247db#commitcomment-8342590
2014-10-28 23:12:41 -04:00
Scott Prager
f2e5851dd9 vim-patch:7.4.418
Problem:    When leaving ":append" the cursor shape is like in Insert mode.
            (Jacob Niehus)
Solution:   Do not have State set to INSERT when calling getline().

https://code.google.com/p/vim/source/detail?r=v7-4-418
2014-10-16 15:55:54 -04:00
Justin M. Keyes
ff023a47e3 version: remove non-functional Vim version identifiers 2014-10-07 02:45:27 +00:00
Wayne Rowcliffe
9b6f192693 Replace FOR_ALL_WINDOWS with FOR_ALL_WINDOWS_IN_TAB(curtab) 2014-09-24 19:00:50 -05:00
Wayne Rowcliffe
683bc797a0 FOR_ALL_WINDOWS_IN_TAB and local variables in FOR_ALL_TAB_WINDOWS 2014-09-22 09:31:09 -05:00
Shougo Matsushita
9829febebc vim-patch:7.4.364
Problem:    When the viminfo file can't be renamed there is no error message.
            (Vladimir Berezhnoy)
Solution:   Check for the rename to fail.

https://code.google.com/p/vim/source/detail?r=v7-4-364
2014-09-19 19:48:39 +09:00
Wayne Rowcliffe
ac0b9714ed Additional FOR_ALL_WINDOWS usage 2014-09-08 17:27:41 -05:00
Stefan Hoffmann
5d074a0aa6 fileinfo: rename os_get_file_info{,_link,_fd} 2014-08-31 15:37:55 +02:00
Justin M. Keyes
e1c330a486 Merge pull request #1024 from war1025/dev/for_all_buffers
Add FOR_ALL_BUFFERS helper
2014-08-19 23:49:25 -04:00
Scott Prager
d2988e12fe vim-patch:7.4.276
Problem:    The fish shell is not supported.
Solution:   Use begin/end instead of () for fish. (Andy Russell)

https://code.google.com/p/vim/source/detail?r=a6b59ee633a355095e6473ec5e2a7d9088bfb853
2014-08-17 22:17:26 -04:00
Scott Prager
284539f395 Doxygen/comment style for make_filter_cmd(). 2014-08-17 22:16:00 -04:00
Scott Prager
53a3c5c21c Use sizeof over magic numbers. 2014-08-17 22:16:00 -04:00
Wayne Rowcliffe
888a31ba45 FOR_ALL_BUFFERS use locally declared buffer pointer 2014-08-17 11:13:42 -05:00
Pavel Platto
94f3d30306 os_fchown: impl and remove HAVE_FCHOWN 2014-08-13 09:13:58 +03:00
Wayne Rowcliffe
8cf45786b1 Add FOR_ALL_BUFFERS helper 2014-08-02 20:19:33 -05:00
Pavel Platto
77cb6551a6 Remove EBCDIC: Remove IF_EB macros 2014-08-02 09:16:59 +03:00
Wayne Rowcliffe
9453b7230b Statically allocate NameBuff 2014-07-22 05:28:17 -05:00
Pavel Platto
286ce271e7 Extract tempfile module from fileio
Though this module is relatively small it has very clear boundaries.
The last argument for extracting `tempfile` was the errors which I got
when I was writing unittests for it: `cimport './src/nvim/fileio.h'`
does not work for some reason.
2014-07-14 21:14:40 +02:00
Pavel Platto
29e0cd1571 Refactor vim_tempname
- temp_count is uint32_t now instead of long because it supposed to be
  at most 999999999 (comment on line 5227) temporary files. The most
  probably it was a long for compatibility with systems where int is
  16-bit.
- Use "nvim" as prefix for temp folder name instead of "v"
- Remove unused parameter from vim_tempname
2014-07-14 21:14:40 +02:00
Justin M. Keyes
180c84ed37 os_open: impl mch_open with libuv. ref #133
- use return value instead of open_req.result
- libuv uv_fs_open() returns `-errno` instead of always -1
- libuv always sets open_req.result to the return value, _except_ for OOM
  where it only sets the return value. So always use the return value.
- replace calls to mch_open macro.
- update call sites expecting -1 error
2014-07-14 09:04:54 -04:00
Pavel Platto
0868818d3e Include stdbool.h in some files which use it
Done by manual inspection of the output of this script:
grep -r -l -w "bool\|true\|false" * | grep 'c$\|h$' > has_bool
grep -r -l "stdbool.h" * | grep 'c$\|h$' > has_include
grep -F -x -v -f has_include has_bool
2014-07-11 18:33:07 -04:00
Brandon Coleman
0fff487690 move errno.h include out of vim.h 2014-07-09 00:18:20 +02:00
Brandon Coleman
bf219e1442 move <inttypes.h> include out of vim.h 2014-07-09 00:18:19 +02:00
Brandon Coleman
82b71a3056 move ascii.h include out of vim.h 2014-07-09 00:18:18 +02:00
Klemen Košir
a568e8b644 Replaced most TRUE/FALSE macros in arabic, mbyte and spell. #645 2014-07-08 17:34:08 +00:00
Klemen Košir
ef34a0ab13 Replace int with bool in some files. #654 2014-07-08 17:25:48 +00:00