aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/indent.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-06-22 08:35:28 +0200
committerJustin M. Keyes <justinkz@gmail.com>2018-06-22 08:35:28 +0200
commite1c6109e62b4e1d12ebdab67140f82cc7dc2c0d1 (patch)
tree3bfaaf5fdba2d6c01288880f865620db1d6c1a88 /src/nvim/indent.c
parentb7514493a0c4a4389a5921f15b0b429dae5c75e7 (diff)
parenteaf2a25f12342622414b264870f41939fe41355a (diff)
downloadrneovim-e1c6109e62b4e1d12ebdab67140f82cc7dc2c0d1.tar.gz
rneovim-e1c6109e62b4e1d12ebdab67140f82cc7dc2c0d1.tar.bz2
rneovim-e1c6109e62b4e1d12ebdab67140f82cc7dc2c0d1.zip
Merge #8618 'Replace b_changedtick with always-inline functions'
Diffstat (limited to 'src/nvim/indent.c')
-rw-r--r--src/nvim/indent.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index c94186a1f2..3cc64e0033 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -21,6 +21,7 @@
#include "nvim/search.h"
#include "nvim/strings.h"
#include "nvim/undo.h"
+#include "nvim/buffer.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
@@ -454,11 +455,13 @@ int get_number_indent(linenr_T lnum)
* parameters into account. Window must be specified, since it is not
* necessarily always the current one.
*/
-int get_breakindent_win(win_T *wp, char_u *line) {
- static int prev_indent = 0; /* cached indent value */
- static long prev_ts = 0; /* cached tabstop value */
- static char_u *prev_line = NULL; /* cached pointer to line */
- static int prev_tick = 0; // changedtick of cached value
+int get_breakindent_win(win_T *wp, char_u *line)
+ FUNC_ATTR_NONNULL_ARG(1)
+{
+ static int prev_indent = 0; // Cached indent value.
+ static long prev_ts = 0; // Cached tabstop value.
+ static char_u *prev_line = NULL; // cached pointer to line.
+ static varnumber_T prev_tick = 0; // Changedtick of cached value.
int bri = 0;
/* window width minus window margin space, i.e. what rests for text */
const int eff_wwidth = wp->w_width
@@ -468,12 +471,11 @@ int get_breakindent_win(win_T *wp, char_u *line) {
/* used cached indent, unless pointer or 'tabstop' changed */
if (prev_line != line || prev_ts != wp->w_buffer->b_p_ts
- || prev_tick != wp->w_buffer->b_changedtick) {
+ || prev_tick != buf_get_changedtick(wp->w_buffer)) {
prev_line = line;
prev_ts = wp->w_buffer->b_p_ts;
- prev_tick = (int)wp->w_buffer->b_changedtick;
- prev_indent = get_indent_str(line,
- (int)wp->w_buffer->b_p_ts, wp->w_p_list);
+ prev_tick = buf_get_changedtick(wp->w_buffer);
+ prev_indent = get_indent_str(line, (int)wp->w_buffer->b_p_ts, wp->w_p_list);
}
bri = prev_indent + wp->w_p_brishift;