Commit Graph

646 Commits

Author SHA1 Message Date
David Bürgin
2c7e8c38e0 vim-patch:7.4.502 #2282
Problem:    Language mapping also applies to mapped characters.
Solution:   Add the 'langnoremap' option, when on 'langmap' does not apply to
            mapped characters. (Christian Brabandt)

https://github.com/vim/vim/releases/tag/v7-4-502
2015-03-29 09:55:59 -04:00
Thiago de Arruda
cdedd89d22 terminal: New module that implements a terminal emulator
This commit integrates libvterm with Neovim and implements a terminal emulator
with nvim buffers as the display mechanism. Terminal buffers can be created
using any of the following methods:

- Opening a file with name following the "term://[${cwd}//[${pid}:]]${cmd}"
  URI pattern where:
  - cwd is the working directory of the process
  - pid is the process id. This is just for use in session files where a pid
    would have been assigned to the saved buffer title.
  - cmd is the command to run
- Invoking the `:terminal` ex command
- Invoking the `termopen` function which returns a job id for automating the
  terminal window.

Some extra changes were also implemented to adapt with terminal buffers. Here's
an overview:

- The `main` function now sets a BufReadCmd autocmd to intercept the term:// URI
  and spawn the terminal buffer instead of reading the file.
- terminal buffers behave as if the following local buffer options were set:
  - `nomodifiable`
  - `swapfile`
  - `undolevels=-1`
  - `bufhidden=hide`
- All commands that delete buffers(`:bun`, `:bd` and `:bw`) behave the same for
  terminal buffers, but only work when bang is passed(eg: `:bwipeout!`)
- A new "terminal" mode was added. A consequence is that a new set of mapping
  commands were implemented with the "t" prefix(tmap, tunmap, tnoremap...)
- The `edit` function(which enters insert mode) will actually enter terminal
  mode if the current buffer is a terminal
- The `put` operator was adapted to send data to the terminal instead of
  modifying the buffer directly.
- A window being resized will also trigger a terminal resize if the window
  displays the terminal.
2015-03-25 18:57:35 -03:00
Thiago de Arruda
b16c5bf5e6 buffer: Move b_p_ma(modifiable) checks into the MODIFIABLE macro 2015-03-25 18:57:35 -03:00
Michael Reed
d85fabc24f doc: Remove refs to 'compatible' and friends
Also remove some MS-DOS references on lines already being touched.

Based on this commit:
e4db01ca87
2015-03-24 19:33:42 -04:00
bobtwinkles
03d47965c0 refactor: split some more functions from misc1.c
This commit pulls the some environment-variable handling functions out of
misc1.c and in to os/env.c. Previously submited as #1231, this is the start of
a patch series that does that work based on a more up-to-date master branch.

Major tasks accomplished:
  - move functions and fix includes
  - fix clint/clang analysis warnings
  - correct documentation comments
2015-03-24 16:13:00 -04:00
Michael Reed
8f6ecc4089 misc2.c: Move emsg* functions to message.c #2152
Clean up said functions and some outdated comments while we're at it.
2015-03-19 18:33:39 -04:00
Thiago de Arruda
c546875daf ui: Replace cursor_{on,off} by busy_{stop,start}
Switching cursor off is only necessary in two occasions:

- When redrawing to avoid terminal flickering
- When the editor is busy

The first can now be handled by the TUI, so most calls to ui_cursor_off can be
removed from the core.

So, before this commit it was only necessary to switch the cursor off to notify
the user that nvim was running some long operation. Now the cursor_{on,off}
functions have been replaced by busy_{stop,start} which can be handled in a
UI-specific way(turning the cursor off or showing a busy indicator, for
example).

To make things even more simpler, nvim is always busy except when waiting for
user input or other asynchronous events: It automatically switches to a non-busy
state when the event loop is about to be entered for more than 100 milliseconds.

`ui_busy_start` can be called when its not desired to change the busy state in
the event loop (As its now done by functions that perform blocking shell
invocations).
2015-03-15 10:30:59 -03:00
Anton Ovchinnikov
9925b3a047 Remove redundant casts 2015-03-09 00:40:50 +01:00
Floris van Liere
57811dec95 set_init_1: mb_init() on fallback encoding (utf8) #2106
Explanation:
  Running `:set encoding=utf-8` _after_ startup correctly initializes
  multibyte; but mb_init() was _not_ called during startup if locale
  detection (enc_locale()) failed. This wasn't a problem in Vim because
  the Vim default encoding (latin1) does not require mb_init(). But Nvim
  defaults to utf8, so mb_init() is required.

closes #1271
closes #1672
2015-03-07 17:53:04 -05:00
Michael Reed
357583ff8c Macro cleanup: HAVE_SANDBOX 2015-03-05 19:03:34 -05:00
Mike Zeller
f28941b96d illumos requires the use of limits.h for things like INT_MAX #2049 2015-02-26 11:42:05 -05:00
Florian Walch
0df6b9168e Simpler handling for "always-on"/"always-off" options. #2002
'compatible' and 'edcompatible' are forced to be off.
'ttyfast' is forced to be on.
2015-02-22 14:55:58 -05:00
Thiago de Arruda
3baba1e7bc refactor: Remove term modules and termcap options
- Removed term.c, term.h and term_defs.h
- Tests for T_* values were removed. screen.c was simplified as a
  consequence(the best strategy for drawing is implemented in the UI layer)
- Redraw functions now call ui.c functions directly. Updates are flushed with
  `ui_flush()`
- Removed all termcap options(they now return empty strings for compatibility)
- &term/&ttybuiltin options return a constant value(nvim)
- &t_Co is still available, but it mirrors t_colors directly
- Remove cursor tracking from screen.c and the `screen_start` function. Now the
  UI is expected to maintain cursor state across any call, and reset it when
  resized.
- Remove unused code
2015-02-21 05:08:21 -03:00
Eliseo Martínez
690e43b461 Enable -Wconversion: Passing-by: Remove dead code (MACOS_CONVERT).
MacOS (pre Mac OS X) is not supported anymore.
2015-02-18 20:54:12 -05:00
Thiago de Arruda
419da839e0 cleanup: Remove unused functions and builtin termcaps 2015-02-16 23:17:39 -03: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
Michael Reed
af46564dd6 Remove 'edcompatible' #1911
Closes #1902
2015-02-16 21:00:30 -05:00
Michael Reed
10b2a0e529 Remove 'ttyfast'
refs #1045 #1051

This was enabled by default a while ago (#1051), and has apparently not
created any issues.  The amount of actual code related to it is tiny, so
it has been removed.
2015-02-08 17:46:09 -05:00
Marco Hinz
4d70aae770 Add EndOfBuffer hl group for ~ lines after the last line in buffers
This makes it possible to highlight the lines starting with ~ at the end
of buffers and other elements highlighted using NonText.

As proposed by mhinz at
https://groups.google.com/forum/#!topic/vim_dev/p3de1iU1GXI/discussion
2015-02-02 01:16:41 -05:00
Pavel Platto
2275b9753e vim-patch:7.4.462
Problem:    Setting the local value of 'backupcopy' empty gives an error.
	    (Peter Mattern)
Solution:   When using an empty value set the flags to zero. (Hirohito
	    Higashi)

https://code.google.com/p/vim/source/detail?r=v7-4-462
2015-01-20 21:57:57 +02:00
Eliseo Martínez
c03913c991 Remove long_u: buffer_defs.h: Refactor long_u. 2015-01-19 19:47:27 +01:00
Eliseo Martínez
e1f7821874 Remove long_u: option.c: Refactor long_u. 2015-01-19 19:47:27 +01:00
Eliseo Martínez
426544ca88 Remove long_u: option.c: Enable -Wconversion. 2015-01-19 19:47:26 +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
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
Eliseo Martínez
31c8440fee Remove long_u: term: Enable -Wconversion. 2015-01-10 10:52:21 +01:00
Florian Walch
099fdb49a7 Change 'history' default to 50.
Default as of Vim 7.4.336 (not yet ported). Runtime files already
mention this new default value.
2015-01-04 21:47:59 +01:00
Florian Walch
811cb036d9 vim-patch:7.4.538
Problem:    Tests fail with small features plus Python.
Solution:   Disallow weird combination of options.  Do not set "fdm" when
	    folding is disabled.

https://code.google.com/p/vim/source/detail?r=v7-4-538
2014-12-24 23:29:00 +01:00
Florian Walch
1f73d7cb85 vim-patch:7.4.438
Problem:    Cached values for 'cino' not reset for ":set all&".
Solution:   Call parse_cino(). (Yukihiro Nakadaira)

https://code.google.com/p/vim/source/detail?r=v7-4-438
2014-12-23 16:13:31 +01:00
Marco Hinz
7e31044cd8 vim-patch:7.4.456
Problem:  'backupcopy' is global, cannot write only some
          files in a different way.
Solution: Make 'backupcopy' global-local. (Christian Brabandt)

https://code.google.com/p/vim/source/detail?r=v7-4-456
2014-12-20 16:31:59 +01: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
Eliseo Martínez
693da00920 Fix warnings: option.c: makeset()/put_setnum(): Various (3): FP.
Problems   : Dereference of null pointer @ 6251.
             Dereference of null pointer @ 6267.
             Dereference of null pointer @ 6351.
Diagnostic : False positive.
Rationale  : Problems occur if varp is null after
             `varp = get_varp_scope(p, opt_flags);`.
             That can only happen if option is hidden. Those are options
             that can be set (for backwards compatibility reasons) but
             that do nothing (see `:h hidden-options`,
             `:h missing-options`). In particular, even if setting them
             is allowed, value is not stored, so these options have no
             real value.
             So, suggested error paths should not occur, as checks
             comparing option value and default value should discard
             them.
Resolution : We could just `assert(varp)` before line 6235
             `varp_local = varp;`. That was tried and worked.
             But we prefer modifying the code to explicitly skip hidden
             options.
             A redundant `!istermoption(p)` is removed too (it's already
             checked by for loop condition).
2014-12-17 21:45:01 +01:00
Joel Teichroeb
d0dcf56338 Ignore compatible mode 2014-12-13 11:43:48 -08:00
Michael Reed
a08e31368f docs: Remove 'osfiletype' remnants
Even when this was finally removed 6 months ago in b2b920f, it had
already been disabled for a while. Due to this, just remove all remnants
of the option as opposed to putting a placeholder like what was done for
'shortname'and 'cryptmethod'.
2014-12-09 19:25:43 -05:00
Björn Linse
5476250ba3 options: change "unnamedclip" back to "clipboard=unnamed/unnamedplus"
This allows to configure which of '*' and '+' should be used for
the unnamed clipboard, and is consistent with vim.
2014-12-08 22:05:05 +01:00
Thiago de Arruda
14f88b6865 term: Move more mouse functions to mouse.c 2014-12-02 07:21:28 -03:00
Thiago de Arruda
05f8d261fe term: Move "set_shellsize" to screen.c as "screen_resize" 2014-12-02 07:15:06 -03:00
Thiago de Arruda
6f7fe5d1b9 Remove code defined under USE_IM_CONTROL #ifdefs
This is not being used and should not be part of the core anyway.
2014-11-27 20:26:10 -03: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
Fredrik Fornwall
b2b9333179 doc: Remove MS-DOS specific options bioskey and conskey #1353 2014-11-17 17:55:47 -05:00
Eliseo Martínez
3d57bcee7d Fix warnings: option.c: do_set(): Dead assignment: HI.
Problem    : Dead assignment @ 2566.
Diagnostic : Harmless issue.
Rationale  : `nextchar` is used as a lookahead buffer for the character
             next to the currently examined token. Sometimes it also
             saves that char while original string is modified (original
             position of nextchar is nullified for the string to
             terminate there). In summary, it's an auxiliary variable
             with no particular complex meaning. Safe to remove if not
             used.
Resolution : Remove dead assignment.
2014-11-15 12:40:28 +01:00
Justin M. Keyes
c5d7d75bb1 Merge pull request #1283 from splinterofchaos/breakindent-tab
vim-patch:7.4.416 + vim-patch:7.4.417
2014-11-12 16:23:27 -05:00
Scott Prager
c92e649a1e vim-patch:7.4.417
Problem:    After splitting a window and setting 'breakindent' the default
            minimum with is not respected.
Solution:   Call briopt_check() when copying options to a new window.

https://code.google.com/p/vim/source/detail?r=v7-4-417
2014-11-12 15:37:56 -05:00
Wayne Rowcliffe
63e2558870 Convert some values from buffer_defs.h to bools 2014-11-12 00:38:34 -06:00
Eliseo Martínez
7d4ec612b1 Review: Remove long_u: memfile: Refactor: int -> bool.
Replace int with bool where appropriate.
2014-11-06 22:53:43 +01:00
Joseph Anthony Pasquale Holsten
ae743f8766 Removes shelltype option and all revelant doc. #1249
Fixes #1240
2014-10-06 16:25:53 -04:00
Wayne Rowcliffe
9b6f192693 Replace FOR_ALL_WINDOWS with FOR_ALL_WINDOWS_IN_TAB(curtab) 2014-09-24 19:00:50 -05:00