neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

pos_defs.h (997B)


      1 #pragma once
      2 
      3 #include <inttypes.h>
      4 
      5 /// Line number type
      6 typedef int32_t linenr_T;
      7 /// Format used to print values which have linenr_T type
      8 #define PRIdLINENR PRId32
      9 
     10 /// Column number type
     11 typedef int colnr_T;
     12 /// Format used to print values which have colnr_T type
     13 #define PRIdCOLNR "d"
     14 
     15 enum { MAXLNUM = 0x7fffffff, };  ///< Maximal (invalid) line number
     16 
     17 // MAXCOL used to be INT_MAX, but with 64 bit ints that results in running
     18 // out of memory when trying to allocate a very long line.
     19 enum { MAXCOL = 0x7fffffff, };   ///< Maximal column number
     20 
     21 enum { MINLNUM = 1, };           ///< Minimum line number
     22 
     23 enum { MINCOL = 1, };            ///< Minimum column number
     24 
     25 /// position in file or buffer
     26 typedef struct {
     27  linenr_T lnum;        ///< line number
     28  colnr_T col;          ///< column number
     29  colnr_T coladd;
     30 } pos_T;
     31 
     32 /// position in file or buffer, but without coladd
     33 typedef struct {
     34  linenr_T lnum;        ///< line number
     35  colnr_T col;          ///< column number
     36 } lpos_T;