aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mark.h
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2015-07-19 21:23:15 +0300
committerZyX <kp-pav@yandex.ru>2015-10-08 22:00:13 +0300
commit43fe98c9fb350b428d05021995c8892e080054b2 (patch)
treebeb6614b0c334de02f40ce5555eac57b691a2d93 /src/nvim/mark.h
parent4bc053facda4aee6cec2c6cbc9fbbe978e66503d (diff)
downloadrneovim-43fe98c9fb350b428d05021995c8892e080054b2.tar.gz
rneovim-43fe98c9fb350b428d05021995c8892e080054b2.tar.bz2
rneovim-43fe98c9fb350b428d05021995c8892e080054b2.zip
shada: Add support for merging everything like described in the doc
Diffstat (limited to 'src/nvim/mark.h')
-rw-r--r--src/nvim/mark.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/nvim/mark.h b/src/nvim/mark.h
index 3f63e274bb..aff6e7273a 100644
--- a/src/nvim/mark.h
+++ b/src/nvim/mark.h
@@ -1,6 +1,8 @@
#ifndef NVIM_MARK_H
#define NVIM_MARK_H
+#include "nvim/macros.h"
+#include "nvim/ascii.h"
#include "nvim/buffer_defs.h"
#include "nvim/mark_defs.h"
#include "nvim/memory.h"
@@ -46,6 +48,32 @@
SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_); \
} while (0)
+/// Convert mark name to the offset
+static inline int mark_global_index(const char name)
+ FUNC_ATTR_CONST
+{
+ return (ASCII_ISUPPER(name)
+ ? (name - 'A')
+ : (ascii_isdigit(name)
+ ? (NMARKS + (name - '0'))
+ : -1));
+}
+
+/// Convert local mark name to the offset
+static inline int mark_local_index(const char name)
+ FUNC_ATTR_CONST
+{
+ return (ASCII_ISLOWER(name)
+ ? (name - 'a')
+ : (name == '"'
+ ? NMARKS
+ : (name == '^'
+ ? NMARKS + 1
+ : (name == '.'
+ ? NMARKS + 2
+ : -1))));
+}
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "mark.h.generated.h"
#endif