Commit Graph

235 Commits

Author SHA1 Message Date
Anton Ovchinnikov
9925b3a047 Remove redundant casts 2015-03-09 00:40:50 +01:00
Michael Reed
70a7517d17 Macro cleanup: UNICODE16
Fix clint warnings as well.
2015-03-05 19:03:35 -05:00
Eliseo Martínez
56e339c594 Fix warnings: screen.c: screen_puts_len(): Various (4): FP/MI.
Problems   : Assigned value is garbage or undefined @ 5363.
             Result of operation is garbage or undefined @ 5356.
             Result of operation is garbage or undefined @ 5320.
             Result of operation is garbage or undefined @ 5192.
Diagnostic : False positives / Multithreading issues.
Rationale  : Suggested error paths contain incoherent values for
             has_mbyte, enc_utf8, and enc_dbcs, which should always hold
             the relationship has_mbyte = enc_utf8 || enc_dbcs, with
             enc_utf8 and enc_dbcs being mutually exclusive.
             Asserting on the globals, though, fails, because checker
             believes they could be modified by other threads in
             between.
Resolution : Make local copy of globals and assert relationship on them.
2015-02-21 10:35:48 +01: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
33cecbbf16 coverity/72768: Negative array index read: FP.
Problem    : Negative array index read @ 5674.
Diagnostic : False positive.
Rationale  : Problem occurs if for loop does not find any match, which
             implies shl->lnum == 0, and then we enter the
             `if (shl->lnum == lnum)` branch, which implies lnum == 0 as
             well. That's not possible, as function should not be called
             with lnum == 0.
Resolution : Change conditions `shl->lnum == lnum` into `bot != -1`.
2015-02-20 17:34:07 +01:00
Thiago de Arruda
d8f3458ec7 syntax: Refactor to store all term and gui attributes independently
Now the attrentry_T structure will store all attributes in separate fields for
cterm and rgb UIs.
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
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
Eliseo Martínez
d228b8a93e Remove nonnullret deadcode: vim_strsave. 2015-01-27 01:33:33 +01:00
Florian Walch
4ef289e761 vim-patch:7.4.517
Problem:    With a wrapping line the cursor may not end up in the right place.
            (Nazri Ramliy)
Solution:   Adjust n_extra for a Tab that wraps. (Christian Brabandt)

https://code.google.com/p/vim/source/detail?r=v7-4-517
2015-01-26 02:19:14 -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
Thiago de Arruda
c51c0950d3 screen: Fix screen_resize to consider minimum screen size 2015-01-15 09:01:16 -03:00
Thiago de Arruda
6f7db326cb screen: Fix highlight reset for abstract_ui 2015-01-13 21:21:20 -03:00
Thiago de Arruda
3e9c55b51b main: Fix color schemes for abstract_ui
- Set 't_Co' to 256 at startup. The value can be changed by the user for
  compatibility with terminals that are less capable.
- `has('gui_running')` will return 1 if at least one rgb UI is attached.

Even though these changes are hacky, they are necessary to make the transition
to the new UI architecture smoother.
2015-01-13 21:21:20 -03:00
Thiago de Arruda
784bda0704 ui: Fix redraw bug caused by race conditions with remote clients
Before sending a resize command to the UIs, flush the current output buffer to
ensure no redraw commands for a screen with invalid size are processed.
2015-01-13 21:21:20 -03:00
Florian Walch
65c1e265dd vim-patch:7.4.567
Problem:    Non-ascii vertical separater characters are always redrawn.
Solution:   Compare only the one byte that's stored. (Thiago Padilha)

https://code.google.com/p/vim/source/detail?r=v7-4-567
2015-01-08 08:59:20 +01:00
Florian Walch
0e8c39bd3b vim-patch:7.4.528
Problem:    Crash when using matchadd() (Yasuhiro Matsumoto)
Solution:   Copy the match regprog.

https://code.google.com/p/vim/source/detail?r=v7-4-528
2014-12-27 11:33:59 +01:00
Florian Walch
dde24224ec vim-patch:7.4.545
Problem:    Highlighting for multi-line matches is not correct.
Solution:   Stop highlight at the end of the match. (Hirohito Higashi)

https://code.google.com/p/vim/source/detail?r=v7-4-545
2014-12-24 23:29:00 +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
Daniel Fairhead
f8e3cfe220 strings.c: replace copy_spaces, copy_chars with equivalent memset. 2014-12-12 08:11:47 +00:00
Thiago de Arruda
07e569a25d ui: Add abstract_ui termcap and split UI layer
This is how Nvim behaves when the "abstract_ui" termcap is activated:

- No data is written/read to stdout/stdin by default.
- Instead of sending data to stdout, ui_write will parse the termcap codes
  and invoke dispatch functions in the ui.c module.
- The dispatch functions will forward the calls to all attached UI
  instances(each UI instance is an implementation of the UI layer and is
  registered with ui_attach).
- Like with the "builtin_gui" termcap, "abstract_ui" does not contain any key
  sequences. Instead, vim key strings(<cr>, <esc>, etc) are parsed directly by
  input_enqueue and the translated strings are pushed to the input buffer.

With this new input model, its not possible to send mouse events yet. Thats
because mouse sequence parsing happens in term.c/check_termcodes which must
return early when "abstract_ui" is activated.
2014-12-08 23:44:23 -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
49b65b0fcd Merge pull request #1516 from fmoralesc/new-patches
vim-patch:7.4.425,435,467,472,473,478
2014-11-27 20:58:39 -05:00
Felipe Morales
42dc00b767 vim-patch:7.4.472: Only draw "precedes" entry in 'listchar' when 'list' is on
vim-patch:7.4.472

Problem:    The "precedes" entry in 'listchar' will be drawn when
'showbreak is set and list is not.
Solution:   Only draw this character when 'list' is on. (Christian
Brabandt)

https://code.google.com/p/vim/source/detail?r=af998690a8841d4df95cea0bed4246f2ba98e247
2014-11-27 19:40:51 -03:00
Felipe Morales
35e2398441 vim-patch:7.4.467: Avoid a problem with unwanted linebreaks in block mode
vim-patch:7.4.467

Avoid a problem with unwanted linebreaks in block mode

https://code.google.com/p/vim/source/detail?r=v7-4-467
2014-11-27 19:40:51 -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
Eliseo Martínez
ee134fc698 Fix warnings: screen.c: screenalloc(): Np arg (2): MI.
Problems   : Null pointer argument in call to memory copy function
             @ 6465.
             Null pointer argument in call to memory copy function
             @ 6475.
Diagnostic : Multithreading issues.
Rationale  : Problem occurs if globals `enc_utf8` and `enc_dbcs` are
             modified while function is executing.
Resolution : Use local copy of globals.
2014-11-18 22:00:03 +01:00
Wayne Rowcliffe
63e2558870 Convert some values from buffer_defs.h to bools 2014-11-12 00:38:34 -06:00
Eliseo Martínez
bd7ee7d6a9 Fix warnings: screen.c: draw_tabline(): Dead assignment: HI.
Problem: Dead assignment @ 7711.
         http://neovim.org/doc/reports/clang/report-835eb6.html#EndPath

Diagnostic: Harmless issue.
Rationale : `scol` is only used within `FOR_ALL_TABS` body, which
            assigns another value to `scol` at the beginning of each
            iteration. If `FOR_ALL_TABS` body would not execute (no
            tabs) nothing harmful would happen, as code following
            `FOR_ALL_TABS` doesn't use `scol`.
Resolution: Remove.
2014-11-06 09:51:44 +01:00
Eliseo Martínez
cc996e748d Fix warnings: screen.c: showmode(): Dead assignment: HI.
Problem: Dead assignment @ 7535.
         http://neovim.org/doc/reports/clang/report-19a5cd.html#EndPath

Diagnostic: Harmless issue.
Rationale : `length = msg_col;` is unconditionally executed after this.
Resolution: Remove assignment.
2014-11-06 09:51:43 +01:00
Eliseo Martínez
04b4658978 Fix warnings: screen.c: win_line(): Dead assigment: HI.
Problem: Dead assigment.
         http://neovim.org/doc/reports/clang/report-7362ba.html#EndPath

Diagnostic: Harmless issue.
Rationale : `boguscols` is in fact unread by downstream code.
Resolution: Comment out. This is preferred here over just removing the
            line because involved logic is complex, and future readers
            of this code could find this extra knowledge useful to
            understand what the code is doing.
2014-11-06 09:51:43 +01:00
Eliseo Martínez
1eb46675b7 Fix warnings: screen.c: win_line(): Dead initialization: HI.
Problem: Dead initialization @ 3477.
         http://neovim.org/doc/reports/clang/report-94b736.html#EndPath

Diagnostic: Harmless issue.
Rationale : `len` is assigned a new value just some lines below. So,
            this just seems something due to old-style variable
            declarations.
Resolution: We could just remove initialization, but prefer moving
            declaration down to point of initialization.
2014-11-06 09:51:43 +01:00
Eliseo Martínez
a32442db85 Fix warnings: screen.c: redraw_asap(): Various (6): MI.
Problems: Argument with 'nonnull' attribute passed null @ 277.
          http://neovim.org/doc/reports/clang/report-9c3614.html#EndPath

          Result of operation is garbage or undefined @ 281.
          http://neovim.org/doc/reports/clang/report-45efbf.html#EndPath

          Argument with 'nonnull' attribute passed null @ 306.
          http://neovim.org/doc/reports/clang/report-ffb84f.html#EndPath

          Result of operation is garbage or undefined @ 311.
          http://neovim.org/doc/reports/clang/report-d04333.html#EndPath

          Argument with 'nonnull' attribute passed null @ 315.
          http://neovim.org/doc/reports/clang/report-786819.html#EndPath

          Uninitialized argument value @ 328.
          http://neovim.org/doc/reports/clang/report-2a5506.html#EndPath

Diagnostic: Multithreading issues.
Rationale : All reported problems can only occur if accesed globals
            change state while executing function, which could only
            happen in a multithreaded environment.
Resolution: Use local variables.
            Note that this change alters function semantics, as now
            function only depends on global values at entry time.
            This shouldn't be a problem, though, as new semantics should
            be in fact better.
2014-11-06 09:51:42 +01:00
Scott Prager
87cf661af6 vim-patch:7.4.422
Problem:    When using conceal with linebreak some text is not displayed
            correctly. (Grüner Gimpel)
Solution:   Check for conceal mode when using linebreak. (Christian Brabandt)

https://code.google.com/p/vim/source/detail?r=v7-4-422
2014-10-23 14:37:55 -04:00
Justin M. Keyes
5e65e3eae0 Merge pull request #1208 from war1025/dev/remove_for_all_windows
Remove FOR_ALL_WINDOWS and replace with FOR_ALL_WINDOWS_IN_TAB(curtab)
2014-10-03 13:44:50 -04:00
Justin M. Keyes
d41eb83019 Merge pull request #1236 from atwupack/vp-7.4.391
vim-patch:7.4.391
2014-09-26 15:57:50 -04:00
joshhartigan
5b54f3fd5e clang: Division by zero 2014-09-25 06:40:59 +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
André Twupack
78d17e1f78 vim-patch:7.4.391
Problem:    No 'cursorline' highlighting when the cursor is on a line with
            diff highlighting. (Benjamin Fritz)
Solution:   Combine the highlight attributes. (Christian Brabandt)

https://code.google.com/p/vim/source/detail?r=v7-4-391
2014-09-24 21:08:57 +02:00
Marco Hinz
366f358a62 vim-patch:7.4.405
Problem:  Screen updating is slow when using matches.
Solution: Do not use the ">=" as in patch 7.4.362, check the lnum.

https://code.google.com/p/vim/source/detail?r=v7-4-405
2014-09-23 16:46:36 +02: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
959ebfd5c2 7.4.371 2014-09-14 00:26:23 -04:00
André Twupack
12ca4f582e vim-patch:7.4.349
Problem:    When there are matches to highlight the whole window is redrawn,
            which is slow.
Solution:   Only redraw everything when lines were inserted or deleted.
            Reset b_mod_xlines when needed.  (Alexey Radkov)

https://code.google.com/p/vim/source/detail?r=v7-4-349
2014-09-11 20:46:10 +02:00
Wayne Rowcliffe
ac0b9714ed Additional FOR_ALL_WINDOWS usage 2014-09-08 17:27:41 -05:00
Wayne Rowcliffe
fe99930c46 Convert FOR_ALL_WINDOWS to use a locally declared pointer 2014-09-08 17:27:41 -05:00
Felipe Morales
9d7e3336cf vim-patch: 7.4.362
Problem:    When matchaddpos() uses a length smaller than the number of
bytes in the (last) character the highlight continues until the end of
            the line.
Solution:   Change condition from equal to larger-or-equal.

https://code.google.com/p/vim/source/detail?r=7fa2bed947fde3514a700c96861a537d816d6fd4
2014-09-04 00:18:25 -04:00