aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/pos_defs.h
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-30 20:35:25 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-30 20:35:25 +0000
commit1b7b916b7631ddf73c38e3a0070d64e4636cb2f3 (patch)
treecd08258054db80bb9a11b1061bb091c70b76926a /src/nvim/pos_defs.h
parenteaa89c11d0f8aefbb512de769c6c82f61a8baca3 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-aucmd_textputpost.tar.gz
rneovim-aucmd_textputpost.tar.bz2
rneovim-aucmd_textputpost.zip
Merge remote-tracking branch 'upstream/master' into aucmd_textputpostaucmd_textputpost
Diffstat (limited to 'src/nvim/pos_defs.h')
-rw-r--r--src/nvim/pos_defs.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/nvim/pos_defs.h b/src/nvim/pos_defs.h
new file mode 100644
index 0000000000..98a1762a5c
--- /dev/null
+++ b/src/nvim/pos_defs.h
@@ -0,0 +1,40 @@
+#pragma once
+
+#include <inttypes.h>
+
+/// Line number type
+typedef int32_t linenr_T;
+/// Format used to print values which have linenr_T type
+#define PRIdLINENR PRId32
+
+/// Column number type
+typedef int colnr_T;
+/// Format used to print values which have colnr_T type
+#define PRIdCOLNR "d"
+
+/// Maximal (invalid) line number
+enum { MAXLNUM = 0x7fffffff, };
+
+/// Maximal column number
+/// MAXCOL used to be INT_MAX, but with 64 bit ints that results in running
+/// out of memory when trying to allocate a very long line.
+enum { MAXCOL = 0x7fffffff, };
+
+/// Minimum line number
+enum { MINLNUM = 1, };
+
+/// Minimum column number
+enum { MINCOL = 1, };
+
+/// position in file or buffer
+typedef struct {
+ linenr_T lnum; ///< line number
+ colnr_T col; ///< column number
+ colnr_T coladd;
+} pos_T;
+
+/// position in file or buffer, but without coladd
+typedef struct {
+ linenr_T lnum; ///< line number
+ colnr_T col; ///< column number
+} lpos_T;