mirror of
https://github.com/neovim/neovim.git
synced 2026-01-27 07:31:45 +10:00
Problem: MS-Windows: running out of memory for a very long line.
Solution: Use a 32 bit value for MAXCOL also when ints are 64 bits.
8e38555ece
This still fails Vim's Windows CI, so let's see what happens...
46 lines
1.0 KiB
C
46 lines
1.0 KiB
C
#ifndef NVIM_POS_H
|
|
#define NVIM_POS_H
|
|
|
|
// for INT_MAX, LONG_MAX et al.
|
|
#include <limits.h>
|
|
|
|
typedef long linenr_T; // line number type
|
|
/// Format used to print values which have linenr_T type
|
|
#define PRIdLINENR "ld"
|
|
|
|
/// 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;
|
|
|
|
|
|
/*
|
|
* Same, but without coladd.
|
|
*/
|
|
typedef struct {
|
|
linenr_T lnum; // line number
|
|
colnr_T col; // column number
|
|
} lpos_T;
|
|
|
|
#endif // NVIM_POS_H
|