Commit Graph

367 Commits

Author SHA1 Message Date
ZyX
cf4e1fb0f4 *: Fix new linter errors
Originally there were 128 new errors, so I thought this is a good idea to fix 
all of them. Of course, this commit also fixes many suppressed errors.
2016-05-01 20:35:51 +03:00
ZyX
37f1ee0084 ex_getln: Do not crash with :append/:insert/:change
This change effectively disables history for lines inserted using this method. 
Not a big problem since it does not work for them in Vim in first place.

Also solves a bug(?): ex_window() run while in :append mode opens search history 
in Vim for some reason. Now it opens empty cmdline window.
2016-04-29 19:10:50 +03:00
ZyX
fdb68e35e4 ex_getln: Make get_histtype return HIST_DEFAULT if needed 2016-04-18 03:37:23 +03:00
ZyX
5674546580 ex_getln: Make get_histtype accept length argument 2016-04-18 02:43:43 +03:00
watiko
3d9e9a92cf vim-patch:7.4.973
Problem:    When pasting on the command line line breaks result in literal
            <CR> characters. This makes pasting a long file name difficult.
Solution:   Skip the characters.

6f62fed349
2016-03-06 00:03:46 +09:00
watiko
43456e43de ex_getln.c: Enable middle click pasting in command mode 2016-03-06 00:03:46 +09:00
watiko
9036f1644f vim-patch:7.4.933
Problem:    Crash when using longest completion match.
Solution:   Fix array index.

e4eda3bc71
2016-02-16 22:56:02 +09:00
watiko
3680332325 vim-patch:7.4.926
Problem:    Completing the longest match doesn't work properly with multi-byte
            characters.
Solution:   When using multi-byte characters use another way to find the
            longest match. (Hirohito Higashi)

4f8fa1633c
2016-02-16 00:15:52 +09:00
Jurica Bradaric
b0cfb6905a vim-patch:7.4.758
Problem:    When 'conceallevel' is 1 and quitting the command-line window with
            CTRL-C the first character ':' is erased.
Solution:   Reset 'conceallevel' in the command-line window. (Hirohito
            Higashi)

fa67fbe6b8
2016-02-09 01:36:29 -05:00
watiko
a5f361e470 vim-patch:7.4.1027
Problem:    No support for binary numbers.
Solution:   Add "bin" to nrformats. (Jason Schulz)

887c1fea4a
2016-02-01 03:47:08 +09:00
watiko
43fd126298 vim-patch:7.4.782
Problem:    Still a few problems with CTRL-A and CTRL-X in Visual mode.
Solution:   Fix the reported problems. (Christian Brabandt)

5d1bc78a2b
2016-02-01 03:43:37 +09:00
Jurica Bradaric
22230196cb vim-patch:7.4.654
Problem:    glob() and globpath() cannot include links to non-existing files.
            (Charles Campbell)
Solution:   Add an argument to include all links with glob(). (James McCoy)
            Also for globpath().

a245bc79b4
2016-01-22 19:26:23 +01:00
Justin M. Keyes
9eb6a44564 Merge #3916 "Add support for binary numbers". 2016-01-21 01:34:36 -05:00
Seth Jackson
a7ade5c832 misc: UNIX => Unix #4022
Although UNIX is a registered trademark of The Open Group, it doesn't
really matter whether we refer to these systems as UNIX, Unix, or
Unix-like. So, for consistency, refer to them collectively as Unix.

Related:
http://www.greens.org/about/unix.html
http://www.unixica.com/html/unixunix.html
2016-01-16 18:34:31 -05:00
Jason Schulz
f82e982bda Fix lint issues 2016-01-15 20:32:00 -08:00
Jason Schulz
7ad3f077dc Add support for binary numbers 2016-01-15 18:21:06 -08:00
Rui Abreu Ferreira
12b23070d4 Fix Windows code in command_line_execute() 2015-12-04 23:25:04 -05:00
Michael Reed
53ee6425c8 src/*: Remove VIM - Vi improved ... header
Regarding the individual items in the header:

`Vim - Vi improved	by Bram Moolenar`
  Bram Moolenar is already mentioned throughout the documentation, as
  well as the intro screen.

`:help uganda`
  It's already shown to all users who don't use `shortmess+=I` upon
  starting nvim, and is already placed prominently in help.txt, i.e.,
  `:help` run with no arguments.

`:help credits`
  Already mentioned near the top of help.txt.

`README.md`
  Already mentioned in develop.txt.
2015-11-27 16:25:10 -05:00
Rui Abreu Ferreira
4f24b9e06f Remove unnecessary includes for errno.h 2015-11-25 16:38:33 -05:00
Michael Reed
af5483089e src: README.txt -> README.md
The former no longer exists in this repo; see the top of
src/nvim/README.md.
2015-11-23 21:38:08 -05:00
Joe Hermaszewski
442cd0672b Enable focus events in cmdline and terminal modes
This change adds switch cases for K_FOCUSGAINED and K_FOCUSLOST to the
input handling functions in ex_getln.c and terminal.c. The handling is
identical to what's found in edit.c (just calling apply_autocmds).

If one enters cmdline-mode by feeding `:` and sends a focuslost event (by
leaving the window for example) the text `<FocusLost>` will be inserted
into the command line. There is similar behaviour in terminal mode. This
patch corrects this behavior to fire the apropriate autocmd instead.

Fixes #3714
2015-11-23 13:18:27 +01:00
Thiago de Arruda
ed985d06ef ex_getln: Extract command_line_handle_key from command_line_execute 2015-10-26 10:52:02 -03:00
Thiago de Arruda
c0c562f97f ex_getln: Convert cmdline_{not_,}changed labels into functions 2015-10-26 10:52:02 -03:00
Thiago de Arruda
0701e1bfa4 ex_getln: refactor command line mode to use the state_enter loop
Split `getcmdline()` into command_line_{enter,check,execute}`
2015-10-26 10:52:02 -03:00
Thiago de Arruda
52d4978b03 ex_getln: Extract local variables from getcmdline() and fix code style
Begin refactoring getcmdline() into a state that can be managed by the
`state_enter()`:

- Move local variables into a local CommandLineState structure
- Fix code style in the entire function.
2015-10-26 10:52:02 -03:00
Thiago de Arruda
dae006a942 main: Extract normal_check from main_loop
The new function contains logic that must be executed after handling input in
normal mode and also before the first main loop iteration. Also rename
`main_loop` to `normal_enter` and move it to normal.c
2015-10-26 10:52:01 -03:00
Johan Klokkhammer Helsing
3bb2662669 vim-patch:7.4.793
Problem:    Can't specify when not to ring the bell.
Solution:   Add the 'belloff' option. (Christian Brabandt)

165bc69d1b
2015-10-18 01:58:18 +02:00
ZyX
19785a0198 ex_getln: Fix memory leak when overwriting history item 2015-10-08 22:01:12 +03:00
ZyX
ad7b7716bb *: Fix lint errors found in new code in previously ignored files 2015-10-08 22:00:50 +03:00
ZyX
bcd8789609 ex_getln: Return something from hist_type2char without asserts
Otherwise QuickBuild shows a warning that control may reach end of non-void
function.
2015-10-08 22:00:42 +03:00
ZyX
07d9ab26c6 *: Make ShaDa code use VimL values for additional_\* data 2015-10-08 22:00:16 +03:00
ZyX
0fe9679101 shada: Initial support for merging history
Currently only merges history when reading ShaDa file. No tests yet.
2015-10-08 21:59:53 +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
Thiago de Arruda
1143b416ab tui: Don't use 'pastetoggle' for automatic pasting
Add a new special key that can be used by UIs to toggle the 'paste' option and
use it in the TUI instead of the user's 'pastetoggle' value.

Close #2843 #2092
2015-10-01 15:22:48 -03:00
oni-link
367fc41943 path.c: Fix memory leak in expand_wildcards().
A file that matches with one of the patterns in 'wildignore' is ignored
when using expand_wildcards(). After removing ignored files, the array
of (file name) matches can be empty. But an empty array is never freed.
2015-09-09 19:03:45 +02:00
Thiago de Arruda
502aee690c event: Refactor async event processing
- Improve the implementation of deferred/immediate events.
- Use the new queue module to change how/when events are queued/processed by
  giving a private queue to each emitter.
- Immediate events(which only exist to break uv_run recursion) are now
  represented in the `loop->fast_events` queue.
- Events pushed to child queues are propagated to the event loop main queue and
  processed as K_EVENT keys.
2015-08-13 08:49:38 -03:00
Thiago de Arruda
3f5af6c1c4 loop: Simplify loop.c and move some code to input.c
- Declare poll timer in Loop structure instead of a loop_poll_events local
  variable.
- Move deferred event management to input.c
2015-08-13 07:41:04 -03:00
Thiago de Arruda
991d3ec1e6 event loop: New abstraction layer with refactored time/signal API
- Add event loop abstraction module under src/nvim/event. The
  src/nvim/event/loop module replaces src/nvim/os/event
- Remove direct dependency on libuv signal/timer API and use the new abstraction
  instead.
- Replace all references to uv_default_loop() by &loop.uv, a new global variable
  that wraps libuv main event loop but allows the event loop functions to be
  reused in other contexts.
2015-07-17 00:19:19 -03:00
Mark Bainter
f813fdce38 Remove char_u: add_pathsep() 2015-05-06 21:25:04 -05:00
Felipe Morales
7fc952ab67 vim-patch:7.4.542
Problem:    Using a range for window and buffer commands has a few
            problems.
            Cannot specify the type of range for a user command.
Solution:   Add the -addr argument for user commands.  Fix problems.
            (Marcin Szamotulski

https://code.google.com/p/vim/source/detail?name=v7-4-542
2015-04-28 23:08:31 -03:00
Eliseo Martínez
46f510350e Fix warnings: ex_getln.c: getexmodeline(): HI.
Problem    : Dead increment @ 1795.
Diagnostic : Harmless issue.
Rationale  : Line was necessary before (indent was used by the following
             while loop), but now that loop is removed, assignment is
             indeed dead.
Resolution : Remove line.
2015-04-27 19:50:33 +02:00
Eliseo Martínez
8ee09a3bd2 Fix warnings: ex_getln.c: init_history(): Nonnull attr passed null: HI.
Problem    : Argument with 'nonnull' attribute passed null @ 4227.
Diagnostic : Harmless issue.
Rationale  : It's true we're calling memset with NULL pointer, but it's
             also true we're doing it with zero size. We just thought
             that would work and do nothing (it was a way of avoiding
             to add a guard). It doesn't work, though, as memset
             requires nonnull arguments.
Resolution : Add guard to avoid null argument.
2015-04-27 15:55:03 +02:00
oni-link
2493b6fefc ex_getln: Fixes for some problems with getexmodeline()
Problems with line-input editing commands in Ex mode
('nvim -e' or 'Q' in normal mode):

CTRL_U: Only after the next keystroke the complete
        line change is shown if the indentation was
        not 0.

        :     asdfCTRL_U

CTRL_T: Memory reallocation with ga_grows() before a
        memmove(), but pointers into the memory are
        not updated.

        :set sw=40
        :CTRL_T
        ...

        Should complain about a memory error.

CTRL_D: Trying to reduce an indentation of 0.

        :set sw=1
        :CTRL_D

        Segfault

Helped-by: Scott Prager <splinterofchaos@gmail.com>
2015-04-26 23:47:59 -04: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
caabcae0b7 Replace VIM_ISDIGIT() and vim_isdigit() with ascii_isdigit() defined in ascii.h 2015-04-24 20:37:13 -03:00
Eliseo Martínez
920381c01b Merge #2491: Fix xfree of static value from vim_getenv() refactor.
Reviewed-by: Eliseo Martínez <eliseomarmol@gmail.com>
2015-04-23 22:00:00 +02:00
Mark Bainter
b68ce1460d Fix xfree of static value in expand_shellcmd()
The refactoring of vim_getenv() to remove the mustfree arg
included reworking calling functions.  expand_shellcmd was
also using that to track its usage of the variable within
the function, resulting in #2487. This change addresses
that scenario and cleans up some of the function for style.
2015-04-23 16:12:14 +00:00
Eliseo Martínez
c22b6124e2 Fix warnings: ex_getln.c: init_history(): NP dereference: FP.
Problem    : Dereference of null pointer @ 4199.
Diagnostic : False positive.
Rationale  : Suggested error path implies that newlen == 0 and
             newlen > hislen, which implies hislen < 0, which is
             impossible (hislen is always between 0 and 10000).
Resolution : Refactor code.
             Asserting oldlen >= 0 should have sufficed, but
             for some reason analyzer doesn't follow implications in
             that case.
             Asserting newlen != 0 || newlen <= hislen works.
             But the chance has been taken to do extensive
             refactoring of this function, as it was difficult to
             understand as it was.
             As a result of refactoring, assert is not needed anymore,
             as we don't call clear_hist_entry() in refactored version.
Refactor   : - Rework algorithm:
               * Drop guard for OOM case, which can't happen now.
               * Drop empty/growing/shrinking cases. Simplify to always
                 doing the same.
               * Perform circular array reordering in all cases
                 (before, it only did when shrinking).
               * Work in batches through memcpy/memset, instead of one
                 entry at a time, as it did before.
             - Inline variable declarations.
             - Replace `ssize_t` by `int`.
             - Introduce oldlen as entry value of hislen.
             - Add a lot of comments.

Helped-by: Scott Prager <splinterofchaos@gmail.com>
Helped-by: oni-link <knil.ino@gmail.com>
2015-04-23 16:26:44 +02:00
Eliseo Martínez
7086d435e0 Merge #2418: Remove char_u (4)
Reviewed-by: Scott Prager <splinterofchaos@gmail.com>
Reviewed-by: Michael Reed <m.reed@mykolab.com>
Reviewed-by: Eliseo Martínez <eliseomarmol@gmail.com>
2015-04-19 21:10:21 +02:00
Mark Bainter
a7e17de048 Refactor get_env() to respect const qualifier
Without the casts*, the compiler rightly warns about the os_getenv
losing the qualifier.  This refactor adds a variable to manage this
properly, and renames the original variables to increase clarity.
2015-04-18 21:37:10 +00:00