Commit Graph

304 Commits

Author SHA1 Message Date
ZyX
ad7b7716bb *: Fix lint errors found in new code in previously ignored files 2015-10-08 22:00:50 +03:00
ZyX
2ba138b2f9 *: Fix problems with clang+asan Release build 2015-10-08 22:00:47 +03:00
ZyX
804e074096 eval,functests: Reference all additional_* items created by ShaDa 2015-10-08 22:00:45 +03:00
ZyX
e4c0741206 ops: Fix access to unsaved register when iterating over registers 2015-10-08 22:00:41 +03:00
ZyX
1a348f8ed8 ops: Fix “conditional … depends on unitialized …” error in op_yank_reg 2015-10-08 22:00:40 +03:00
ZyX
563f5c2650 shada: Fix memory leak when reading registers from ShaDa file
Occures once register from ShaDa file overwrites non-empty register in the
current instance.
2015-10-08 22:00:40 +03:00
ZyX
74d5084139 shada,functests: Add tests for merging ShaDa data 2015-10-08 22:00:38 +03:00
ZyX
5b3e668f3e shada: When reading marks or registers, free items when set fails 2015-10-08 22:00:17 +03:00
ZyX
07d9ab26c6 *: Make ShaDa code use VimL values for additional_\* data 2015-10-08 22:00:16 +03:00
ZyX
43fe98c9fb shada: Add support for merging everything like described in the doc 2015-10-08 22:00:13 +03:00
ZyX
9cf9c4a586 Replace references to viminfo in various places 2015-10-08 22:00:06 +03:00
ZyX
244dbe3a77 viminfo: First version of ShaDa file dumping
What works:

1. ShaDa file dumping: header, registers, jump list, history, search patterns,
   substitute strings, variables.
2. ShaDa file reading: registers, global marks, variables.

Most was not tested.

TODO:

1. Merging.
2. Reading history, local marks, jump and buffer lists.
3. Documentation update.
4. Converting some data from &encoding.
5. Safer variant of dumping viminfo (dump to temporary file then rename).
6. Removing old viminfo code (currently masked with `#if 0` in a ShaDa file for
   reference).
2015-10-08 21:59:51 +03:00
Felipe Morales
acdac914d5 clipboard: avoid clipboard during :global. #2809
This is equivalent to patches 7.4.396, 7.4.445 and 7.4.598.

vim-patch:7.4.396

Problem:    When 'clipboard' is "unnamed", :g/pat/d is very slow.
(Praful)
Solution:   Only set the clipboard after the last delete. (Christian
Brabandt)

1f285eb49a

vim-patch:7.4.445

Problem:    Clipboard may be cleared on startup.
Solution:   Set clip_did_set_selection to -1 during startup. (Christian
	    Brabandt)

1a19d37d90

vim-patch:7.4.598

Problem:    ":tabdo windo echo 'hi'" causes "* register not to be
changed.
	    (Salman Halim)
Solution:   Change how clip_did_set_selection is used and add
	    clipboard_needs_update and global_change_count.  (Christian
	    Brabandt)

af6a579263

Co-Author: @bfredl
2015-08-30 23:40:12 -04:00
Björn Linse
d4ebbaa91a clipboard: support clipboard=unnamedplus,unnamed 2015-08-07 13:06:13 +02:00
Björn Linse
162361abac clipboard: fixup inconsequential yet embarrassing mixup 2015-08-06 22:39:47 +02:00
Björn Linse
c30f2ac25d clipboard: handle middle-click paste correctly.
Also handle clipboard errors more like vim: paste from unnamed register
if clipboard provider fails.
2015-07-20 20:24:27 -04:00
Björn Linse
e9c9d44f65 clipboard: don't overwrite before pasting in visual mode. #2945
This occured when clipboard=unnamedplus and doing "+p in visual mode.
Fixes #2942.
2015-07-04 18:17:30 +02:00
Björn Linse
3fcfd52422 clipboard: avoid redundant error message on clipboard_get failure .
Fixes #2712

Helped-By: Michael Reed <m.reed@mykolab.com>
2015-06-25 19:30:29 -04:00
David Bürgin
44175224cc 'cpoptions': Remove "j" flag 2015-05-25 16:29:00 -04:00
David Bürgin
f525284778 vim-patch:7.4.594 #2654
Problem:    Using a block delete while 'breakindent' is set does not work
            properly.
Solution:   Use "line" instead of "prev_pend" as the first argument to
            lbr_chartabsize_adv().  (Hirohito Higashi)

https://github.com/vim/vim/commit/v7-4-594

See https://groups.google.com/d/msg/vim_dev/B8k0AVlqMUU/qKXeY8srpGcJ
2015-05-16 18:39:39 -04:00
Michael Reed
3c5864772f Remove char_u: message:smsg() 2015-05-13 15:29:50 -04:00
Eliseo Martínez
7c956dcbe8 Enable -Wconversion: normal.c.
Refactor summary:
- extern int opcount --> extern long opcount
- bool find_decl(..., int len, ...) --> bool find_decl(..., size_t len, ...)
  * int find_ident_under_cursor(...) --> size_t find_ident_under_cursor(...)
    - int find_ident_at_pos(...) --> size_t find_ident_at_pos(...)
    - int modify_fname(..., int *usedlen, ..., int *fnamelen) --> int modify_fname(..., size_t *usedlen, ..., size_t *fnamelen)
      * char_u *eval_vars(..., int *usedlen, ...) --> char_u *eval_vars(..., size_t *usedlen, ...)
        - int find_cmdline_var(..., int *usedlen) --> ssize_t find_cmdline_var(..., size_t *usedlen)
        - static char_u *repl_cmdline(..., int srclen, ...) --> static char_u *repl_cmdline(..., size_t srclen, ...)
    - bool get_visual_text(..., int *lenp) --> bool get_visual_text(..., size_t *lenp)
      * char_u *find_file_name_in_path(..., int len, ...) --> char_u *find_file_name_in_path(..., size_t len, ...)
        - static char_u *eval_includeexpr(..., int len) --> static char_u *eval_includeexpr(..., size_t len)
        - char_u *find_file_in_path(..., int len, ...) --> char_u *find_file_in_path(..., size_t len, ...)
          * char_u *find_file_in_path_option(..., int len, ...) --> char_u *find_file_in_path_option(..., size_t len, ...)
            - char_u *find_directory_in_path(..., int len, ...) --> char_u *find_directory_in_path(..., size_t len, ...)
      * int spell_move_to(...) --> size_t spell_move_to(...)
        - int spell_check(...) --> size_t spell_check(...)
        - static int spell_bad_len --> static size_t spell_bad_len
    - void find_pattern_in_path(..., int len, ...) --> void find_pattern_in_path(..., size_t len, ...)

Helped-by: Justin M. Keyes <justinkz@gmail.com>
2015-04-27 19:27:07 +02:00
Felipe Oliveira Carvalho
c96b933acc Improve comments and fix ascii_* attributes 2015-04-24 22:17:02 -03:00
Felipe Oliveira Carvalho
bcfc37ea98 Replace vim_isspace() with ascii_isspace() defined in ascii.h 2015-04-24 20:37:13 -03:00
Felipe Oliveira Carvalho
2ca8afc74e Replace vim_isxdigit() with to ascii_isxdigit() defined in ascii.h 2015-04-24 20:37:13 -03:00
Felipe Oliveira Carvalho
caabcae0b7 Replace VIM_ISDIGIT() and vim_isdigit() with ascii_isdigit() defined in ascii.h 2015-04-24 20:37:13 -03:00
Felipe Oliveira Carvalho
93bf201119 Replace vim_iswhite with ascii_iswhite() defined in ascii.h 2015-04-24 20:37:13 -03:00
Eliseo Martínez
178e9fc2f6 Fix warnings: ops.c: op_yank_reg(): Dead assignment: HI.
Problem    : Dead assignment @ 2480.
Diagnostic : Harmless issue.
Rationale  : It's true `reg` is not used any more after that point.
Resolution : Delete line.
2015-04-23 16:26:44 +02:00
Björn Linse
26fedb133d clipboard: cleanup valid_yank_reg and use it for :redir
This fixes missing clipboard support for `:redir`

Helped-By: Michael Reed <m.reed@mykolab.com>
Helped-By: Scott Prager <splinterofchaos@gmail.com>
2015-04-17 16:12:32 +02:00
Björn Linse
edb13791bd clipboard: simplify handling of of put in visual mode.
When clipboard=unnamed and put over visual selection, reduces number of
provider calls from 6 to 2. Also add test.
2015-04-17 11:34:06 +02:00
Björn Linse
84b7a9ac34 ops.c: eliminate unneccesary static variable y_append 2015-04-17 11:34:05 +02:00
Björn Linse
96e9d261cf ops.c: eliminate static variable y_current
This variable isn't stateful, and should be passed around instead.

Helped-By: Scott Prager <splinterofchaos@gmail.com>
Helped-By: Michael Reed <m.reed@mykolab.com>
2015-04-17 11:33:44 +02:00
Thiago de Arruda
34c48aaf12 memory: Add free wrapper and refactor project to use it
We already use wrappers for allocation, the new `xfree` function is the
equivalent for deallocation and provides a way to fully replace the malloc
implementation used by Neovim.
2015-04-13 08:22:44 -03:00
Björn Linse
a6487ae9cb ops.c: cleanup of get_yank_register 2015-04-11 11:14:22 +02:00
Björn Linse
9978a01faa clipboard: fix "" register not updated when clipboard=unnamed
Helped-By: Scott Prager <splinterofchaos@gmail.com>
2015-04-11 11:11:52 +02:00
Björn Linse
941b02af4c clipboard: adjust v:register when clipboard=unnamed
Helped-By: Nicolas Hillegeer <nicolas@hillegeer.com>
Helped-By: Michael Reed <m.reed@mykolab.com>
2015-04-11 11:11:52 +02:00
Eliseo Martínez
fa2fcf13aa Enable -Wconversion: fold.c.
Refactor summary:
- foldinfo_T.fi_lnum: int --> linenr_T
                      Reorder field for optimal packing.
- foldAddMarker(..., markerlen): int --> size_t
    * foldstartmarkerlen: int --> size_t
        - foldDelMarker(..., markerlen): int --> size_t
            * foldendmarkerlen: int --> size_t

Helped-by: oni-link <knil.ino@gmail.com>
2015-04-07 12:56:28 +02:00
Björn Linse
8c25ad6cf5 clipboard: missing return NULL when provider not available 2015-04-05 14:31:59 +02:00
Björn Linse
adcf268a72 clipboard: handle clipboard reading directly in get_yank_register
This makes :<c-r>* work as expected and
avoids clobbering zero register ("0) when pasting unnamed clipboard

Helped-By: Scott Prager <splinterofchaos@gmail.com>
Helped-By: Michael Reed <m.reed@mykolab.com>
2015-04-05 11:34:14 +02:00
Björn Linse
7422843f5c clipboard: improve the handling of newlines in get_clipboard
This makes the interpretion consistent with the way newlines are used in
the VIMENC format, while keeping the same fallback behaviour when
regtype is unspecified. Also check both cases explicitly in the tests.
2015-04-05 11:34:13 +02:00
Björn Linse
5600b80c1f clipboard: show "* and "+ in :registers
Helped-by: Robin Allen <r@foon.uk>
Helped-by: Scott Prager <splinterofchaos@gmail.com>
2015-04-05 11:34:13 +02: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
Anton Ovchinnikov
9925b3a047 Remove redundant casts 2015-03-09 00:40:50 +01:00
Michael Reed
0925870d0c Macro cleanup: ONE_CLIPBOARD 2015-03-05 19:03:35 -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
Björn Linse
d7aea1d7cc clipboard: don't clobber "0 when deleting to unnamed 2015-01-27 19:43:25 -05: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
Eliseo Martínez
79b5a629eb Remove long_u: ops.c: Refactor long_u. 2015-01-19 19:47:28 +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