Commit Graph

327 Commits

Author SHA1 Message Date
Felipe Morales
3ffc5d81c3 Add TabClosed event
TabClosed is triggered when a tab page closes.
2015-02-16 23:24:31 -05:00
Felipe Morales
66d94869a0 Add TabNewEntered
TabNewEntered is triggered after vim has entered a buffer in new tab.
2015-02-16 23:24:30 -05:00
Felipe Morales
817be96be5 Add TabNew event
TabNew triggers when entering a new tab page, but not when entering an
already created one.
2015-02-16 23:24:30 -05:00
Thiago de Arruda
e0e41b30c6 ui: Remove/adapt some old code for a big UI refactor
- Remove abstract_ui global, now it is always active
- Remove some terminal handling code
- Remove unused functions
- Remove HAVE_TGETENT/TERMINFO/TERMIOS/IOCTL #ifdefs
- Remove tgetent/terminfo from version.c
- Remove curses/terminfo dependencies
- Only start/stop termcap when starting/exiting the program
- msg_use_printf will return true if there are no attached UIs(
  messages will be written to stdout)
- Remove `ex_winpos`(implement `:winpos` with `ex_ni`)
2015-02-16 23:17:39 -03:00
Eliseo Martínez
bb674e0fcd coverity/13810: Unitialized scalar variable: HI.
Problem    : Unitialized scalar variable @ 3239.
Diagnostic : Harmless issue.
Rationale  : It's true pos.coladd is not initialized when calling
             searchit(). But that's no problem, as coladd is only set in
             that function.
Resolution : Initialize variable to 0.
2015-02-02 01:21:58 -05:00
Eliseo Martínez
8d6778a4d1 Remove nonnullret deadcode: home_replace_save. 2015-01-27 01:33:31 +01:00
Eliseo Martínez
b716b047e0 Remove long_u: ex_docmd.c: Refactor long_u. 2015-01-19 19:47:27 +01: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
Justin M. Keyes
d7e18b5c95 Revert "[WIP] "abstract_ui" fixes and improvements" 2015-01-12 10:14:52 -05:00
Justin M. Keyes
4c55c34efa Merge pull request #1657 from tarruda/abstract-ui-fixes
[WIP] "abstract_ui" fixes and improvements
2015-01-12 10:13:51 -05:00
Thiago de Arruda
d992213678 ui: Reimplement :suspend command for remote UIs.
- Remove suspend method from the UI protocol
- Handle `:suspend` by disconnecting the last channel that sent a request to
  nvim.
2015-01-12 09:47:41 -03: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
Justin M. Keyes
bb574e2202 restore 'Not Implemented' for legacy script commands (:lua :ruby ...)
- restores behavior equivalent to Vim compiled without FEAT_MZSCHEME, etc.
  (avoids spurious "E492: Not an editor command: EOF") for code such as:
```vim
  if 0
    perl << EOF
  end
  EOF
  endif
```
  see :help script-here
- fixes #1308
- fixes https://github.com/junegunn/vim-plug/issues/111
2014-12-27 16:28:02 -05:00
Justin M. Keyes
1c6cd9f239 Merge pull request #1730 from fwalch/vim-7.4.486
vim-patch:7.4.486
2014-12-26 09:34:22 -05:00
Justin M. Keyes
78faf274f3 Merge pull request #1725 from fwalch/vim-7.4.450
vim-patch:7.4.450
2014-12-26 08:42:30 -05:00
Florian Walch
9854ba7276 vim-patch:7.4.486
Problem:    Check for writing to a yank register is wrong.
Solution:   Negate the check. (Zyx).  Also clean up the #ifdefs.

https://code.google.com/p/vim/source/detail?r=v7-4-486
2014-12-25 19:05:52 +01:00
Florian Walch
75b7b04436 vim-patch:7.4.494
Problem:    Cursor shape is wrong after a CompleteDone autocommand.
Solution:   Update the cursor and mouse shape after ":normal" restores the
	    state. (Jacob Niehus)

https://code.google.com/p/vim/source/detail?r=v7-4-494
2014-12-23 21:16:56 +01:00
Florian Walch
a1c03c33b3 vim-patch:7.4.450
Problem:    Not all commands that edit another buffer support the +cmd
	    argument.
Solution:   Add the +cmd argument to relevant commands. (Marcin Szamotulski)

https://code.google.com/p/vim/source/detail?r=v7-4-450
2014-12-23 21:10:40 +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
Justin M. Keyes
943b063290 Merge pull request #1663 from philix/array_size
Define and use the ARRAY_SIZE macro
2014-12-19 02:23:26 -05:00
Felipe Oliveira Carvalho
8aeb2e37ee Use ARRAY_SIZE where Coccinelle wasn't able to do it 2014-12-18 15:41:37 -03: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
Victor Adam
4a3b3d2913 Reimplement :drop (vim-patch:0)
The :drop ex command was inadvertently removed when removing FEAT_GUI.
This patch reintroduces it.
2014-12-18 01:58:36 +01:00
Eliseo Martínez
9b1c939370 coverity/13695: Unchecked return value: RI.
Problem    : Unchecked return value (CHECKED_RETURN) @ 8554.
Diagnostic : Real issue.
Rationale  : Other invocations of `do_source` are checked and generate
             an error message if fail. There seems to be no reason why
             this particular instance could not fail the same.
Resolution : Check invocation and generate error message on failure.
2014-12-16 21:00:17 +01: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
d0dcf56338 Ignore compatible mode 2014-12-13 11:43:48 -08:00
Felipe Oliveira Carvalho
e11a5699be Use GA_DEEP_CLEAR where appropriate 2014-12-11 20:22:37 -03:00
Felipe Oliveira Carvalho
b603404487 GA_DEEP_CLEAR macro for garray memory deallocation
Used to free garrays of `salitem_T` and `fromto_T` in spell.c, and
garray `wcmd_T` in ex_docmd.c.

Helped-by: Jiaqi Li
2014-12-11 20:22:25 -03:00
Thiago de Arruda
8a5a8dbf0f term: Remove most calls to settmode
Nvim now relies much less on setting terminal mode to cooked mode, remove most
calls to settmode, except for those that happen on startup or when suspending.
Eventually even those will be handled by the UI layer.
2014-12-02 07:15:07 -03:00
Thiago de Arruda
05f8d261fe term: Move "set_shellsize" to screen.c as "screen_resize" 2014-12-02 07:15:06 -03:00
Justin M. Keyes
3e665efea4 Merge pull request #1497 from splinterofchaos/const-attr
constify and func-attribute memory.c and strings.c
2014-11-29 22:48:23 -05:00
Scott Prager
ecf81c3f20 strings/memory: constify and func_attr.
Fix MB_COPY_cHAR() to accept const pointers.
2014-11-27 14:38:26 -05: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
Eliseo Martínez
fcd5a8643c Fix warnings: syntax.c: get_id_list(): Double free: FP.
Problem    : Double free @ 5213.
Diagnostic : False positive.
Rationale  : Suggested error path contains two consecutive invocations
             of `ends_excmd(*p)` having different results, which is not
             possible. First invocation is before the while loop. Second
             invocation is the while loop condition itsef.
Resolution : Refactor while loop into do-while loop. That removes the
             impossible path from analysis, and, in addition, is a bit
             more efficient.
2014-11-15 12:49:18 +01:00
Scott Prager
bffea01c89 vim-patch:7.4.415
Problem:    Cannot build.  Warning for shadowed variable. (John Little)
Solution:   Add missing change.  Remove declaration.

https://code.google.com/p/vim/source/detail?name=v7-4-414&r=20dbceb6f4713ccd01be45dc531abc269fbb7579
2014-11-11 11:55:59 -05:00
Scott Prager
0051a7cb25 vim-patch:7.4.414
Problem:    Cannot define a command only when it's used.
Solution:   Add the CmdUndefined autocommand event. (partly by Yasuhiro
            Matsumoto)

https://code.google.com/p/vim/source/detail?r=v7-4-414
2014-11-11 11:55:59 -05:00
Eliseo Martínez
1575642b11 Fix warnings: ex_docmd.c: eval_vars(): Unitialized arg: FP.
Problem    : Uninitialized argument value @ 7704.
Diagnostic : False positive.
Rationale  : Error occurs if `switch(spec_idx)` doesn't enter any case,
             which should not occur after
             `spec_idx = find_cmdline_var(...)` returned non-negative.
Resolution : Add default clause to switch and error if reached.
2014-11-11 01:43:12 +01:00
Wayne Rowcliffe
7aca07b0a7 Remove W_NEXT use ->w_next 2014-09-24 19:00:50 -05: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
Wayne Rowcliffe
b4ec6c1a4b FOR_ALL_TABS helper 2014-09-22 09:26:40 -05:00
Scott Prager
def28adfdd vim-patch:7.4.312
Problem:    Cannot figure out what argument list is being used for a window.
Solution:   Add the arglistid() function. (Marcin Szamotulski)

https://code.google.com/p/vim/source/detail?r=v7-4-312
2014-09-13 18:28:32 -04:00
Wayne Rowcliffe
ac0b9714ed Additional FOR_ALL_WINDOWS usage 2014-09-08 17:27:41 -05:00
Felipe Morales
bf3d945798 vim-patch: 7.4.330
Problem:    Using a regexp pattern to highlight a specific position can
be slow.
Solution:   Add matchaddpos() to highlight specific positions
efficiently.
(Alexey Radkov.)

https://code.google.com/p/vim/source/detail?r=f9fa2e506b9f07549cd91074835c5c553db7b3a7
2014-09-04 00:18:24 -04:00
ZyX
3becb5fd21 Use lua generator in place of ex_cmds_defs header trick
Closes #788
Fixes #379
Ref #549
2014-08-20 20:21:37 +04:00
Wayne Rowcliffe
888a31ba45 FOR_ALL_BUFFERS use locally declared buffer pointer 2014-08-17 11:13:42 -05:00
Wayne Rowcliffe
8cf45786b1 Add FOR_ALL_BUFFERS helper 2014-08-02 20:19:33 -05:00
Thiago de Arruda
486c8e37c1 provider: Add support for python commands/functions
This uses the provider/scripting infrastructure to reintroduce python support
through the msgpack-rpc API.

A new 'initpython' option was added, and it must be set to a command that will
bootstrap the python provider the first time it's needed.
2014-07-17 11:37:41 -03:00
Brandon Coleman
0fff487690 move errno.h include out of vim.h 2014-07-09 00:18:20 +02:00