From 43fe98c9fb350b428d05021995c8892e080054b2 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 19 Jul 2015 21:23:15 +0300 Subject: shada: Add support for merging everything like described in the doc --- src/nvim/mark.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/nvim/mark.h') 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 -- cgit