Macros | Functions | Variables
mark.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <string.h>
#include <limits.h>
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/mark.h"
#include "nvim/buffer.h"
#include "nvim/charset.h"
#include "nvim/diff.h"
#include "nvim/eval.h"
#include "nvim/ex_cmds.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/normal.h"
#include "nvim/option.h"
#include "nvim/path.h"
#include "nvim/quickfix.h"
#include "nvim/search.h"
#include "nvim/strings.h"
#include "nvim/ui.h"
#include "nvim/os/os.h"
#include "nvim/os/time.h"
#include "nvim/os/input.h"

Macros

#define one_adjust(add)
 
#define one_adjust_nodel(add)
 
#define col_adjust(pp)
 

Functions

int setmark (int c)
 
void free_fmark (fmark_T fm)
 Free fmark_T item. More...
 
void free_xfmark (xfmark_T fm)
 Free xfmark_T item. More...
 
void clear_fmark (fmark_T *fm) FUNC_ATTR_NONNULL_ALL
 Free and clear fmark_T item. More...
 
int setmark_pos (int c, pos_T *pos, int fnum)
 
void setpcmark (void)
 
void checkpcmark (void)
 
pos_Tmovemark (int count)
 
pos_Tmovechangelist (int count)
 
pos_Tgetmark_buf (buf_T *buf, int c, int changefile)
 
pos_Tgetmark (int c, int changefile)
 
pos_Tgetmark_buf_fnum (buf_T *buf, int c, int changefile, int *fnum)
 
pos_Tgetnextmark (pos_T *startpos, int dir, int begin_line)
 
void fmarks_check_names (buf_T *buf)
 
int check_mark (pos_T *pos)
 
void clrallmarks (buf_T *const buf) FUNC_ATTR_NONNULL_ALL
 
char_ufm_getname (fmark_T *fmark, int lead_len)
 
void do_marks (exarg_T *eap)
 
void ex_delmarks (exarg_T *eap)
 
void ex_jumps (exarg_T *eap)
 
void ex_clearjumps (exarg_T *eap)
 
void ex_changes (exarg_T *eap)
 
void mark_adjust (linenr_T line1, linenr_T line2, long amount, long amount_after, bool end_temp)
 
void mark_adjust_nofold (linenr_T line1, linenr_T line2, long amount, long amount_after, bool end_temp)
 
void mark_col_adjust (linenr_T lnum, colnr_T mincol, long lnum_amount, long col_amount, int spaces_removed)
 
void cleanup_jumplist (void)
 
void copy_jumplist (win_T *from, win_T *to)
 
const void * mark_jumplist_iter (const void *const iter, const win_T *const win, xfmark_T *const fm) FUNC_ATTR_NONNULL_ARG(2
 
 if (iter_mark==&(win->w_jumplist[win->w_jumplistlen-1]))
 
const void * mark_global_iter (const void *const iter, char *const name, xfmark_T *const fm) FUNC_ATTR_NONNULL_ARG(2
 
 while ((size_t)(iter_mark-&(namedfm[0]))< ARRAY_SIZE(namedfm)&&!iter_mark->fmark.mark.lnum)
 
 if ((size_t)(iter_mark-&(namedfm[0]))==ARRAY_SIZE(namedfm)||!iter_mark->fmark.mark.lnum)
 
 while ((size_t)(++iter_mark-&(namedfm[0]))< ARRAY_SIZE(namedfm))
 
const void * mark_buffer_iter (const void *const iter, const buf_T *const buf, char *const name, fmark_T *const fm) FUNC_ATTR_NONNULL_ARG(2
 
 while (iter_mark!=NULL &&iter_mark->mark.lnum==0)
 
 if (mark_name)
 
 return (const void *)
 
bool mark_set_local (const char name, buf_T *const buf, const fmark_T fm, const bool update) FUNC_ATTR_NONNULL_ALL
 
void free_jumplist (win_T *wp)
 
void set_last_cursor (win_T *win)
 
void mark_mb_adjustpos (buf_T *buf, pos_T *lp) FUNC_ATTR_NONNULL_ALL
 

Variables

const void FUNC_ATTR_WARN_UNUSED_RESULT
 
fm = *iter_mark
 
 else
 
const xfmark_Titer_mark
 
size_t iter_off = (size_t) (iter_mark - &(namedfm[0]))
 
name
 
return NULL
 
char mark_name
 

Macro Definition Documentation

#define col_adjust (   pp)
Value:
{ \
posp = pp; \
if (posp->lnum == lnum && posp->col >= mincol) \
{ \
posp->lnum += lnum_amount; \
assert(col_amount > INT_MIN && col_amount <= INT_MAX); \
if (col_amount < 0 && posp->col <= (colnr_T)-col_amount) { \
posp->col = 0; \
} else if (posp->col < spaces_removed) { \
posp->col = (int)col_amount + spaces_removed; \
} else { \
posp->col += (colnr_T)col_amount; \
} \
} \
}
int colnr_T
Column number type.
Definition: pos.h:9
assert(len >=0)
if(iter_mark==&(win->w_jumplist[win->w_jumplistlen-1]))
Definition: mark.c:1236
#define one_adjust (   add)
Value:
{ \
lp = add; \
if (*lp >= line1 && *lp <= line2) \
{ \
if (amount == MAXLNUM) \
*lp = 0; \
*lp += amount; \
} \
else if (amount_after && *lp > line2) \
*lp += amount_after; \
}
else
Definition: mark.c:1238
if(iter_mark==&(win->w_jumplist[win->w_jumplistlen-1]))
Definition: mark.c:1236
Definition: pos.h:14
#define one_adjust_nodel (   add)
Value:
{ \
lp = add; \
if (*lp >= line1 && *lp <= line2) \
{ \
if (amount == MAXLNUM) \
*lp = line1; \
*lp += amount; \
} \
else if (amount_after && *lp > line2) \
*lp += amount_after; \
}
else
Definition: mark.c:1238
if(iter_mark==&(win->w_jumplist[win->w_jumplistlen-1]))
Definition: mark.c:1236
Definition: pos.h:14

Function Documentation

int check_mark ( pos_T pos)
void checkpcmark ( void  )
void cleanup_jumplist ( void  )
void clear_fmark ( fmark_T fm)

Free and clear fmark_T item.

void clrallmarks ( buf_T *const  buf)

Clear all marks and change list in the given buffer

Used mainly when trashing the entire buffer during ":e" type commands.

Parameters
[out]bufBuffer to clear marks in.
void copy_jumplist ( win_T from,
win_T to 
)
void do_marks ( exarg_T eap)
void ex_changes ( exarg_T eap)
void ex_clearjumps ( exarg_T eap)
void ex_delmarks ( exarg_T eap)
void ex_jumps ( exarg_T eap)
char_u* fm_getname ( fmark_T fmark,
int  lead_len 
)
void fmarks_check_names ( buf_T buf)
void free_fmark ( fmark_T  fm)

Free fmark_T item.

void free_jumplist ( win_T wp)
void free_xfmark ( xfmark_T  fm)

Free xfmark_T item.

pos_T* getmark ( int  c,
int  changefile 
)
pos_T* getmark_buf ( buf_T buf,
int  c,
int  changefile 
)
pos_T* getmark_buf_fnum ( buf_T buf,
int  c,
int  changefile,
int *  fnum 
)
pos_T* getnextmark ( pos_T startpos,
int  dir,
int  begin_line 
)
if ( iter_mark  = = &(win->w_jumplist[win->w_jumplistlen - 1]))
if ( (size_t)(iter_mark-&(namedfm[0]))  = ARRAY_SIZE(namedfm) || !iter_mark->fmark.mark.lnum)
if ( mark_name  )
void mark_adjust ( linenr_T  line1,
linenr_T  line2,
long  amount,
long  amount_after,
bool  end_temp 
)
void mark_adjust_nofold ( linenr_T  line1,
linenr_T  line2,
long  amount,
long  amount_after,
bool  end_temp 
)
const void* mark_buffer_iter ( const void *const  iter,
const buf_T *const  buf,
char *const  name,
fmark_T *const  fm 
)

Iterate over buffer marks

Warning
No mark-editing functions must be run while iteration is in progress.
Parameters
[in]iterIterator. Pass NULL to start iteration.
[in]bufBuffer.
[out]nameMark name.
[out]fmMark definition.
Returns
Pointer that needs to be passed to next mark_buffer_iter call or NULL if iteration is over.
void mark_col_adjust ( linenr_T  lnum,
colnr_T  mincol,
long  lnum_amount,
long  col_amount,
int  spaces_removed 
)
const void* mark_global_iter ( const void *const  iter,
char *const  name,
xfmark_T *const  fm 
)

Iterate over global marks

Warning
No mark-editing functions must be run while iteration is in progress.
Parameters
[in]iterIterator. Pass NULL to start iteration.
[out]nameMark name.
[out]fmMark definition.
Returns
Pointer that needs to be passed to next mark_global_iter call or NULL if iteration is over.
const void* mark_jumplist_iter ( const void *const  iter,
const win_T *const  win,
xfmark_T *const  fm 
)

Iterate over jumplist items

Warning
No jumplist-editing functions must be run while iteration is in progress.
Parameters
[in]iterIterator. Pass NULL to start iteration.
[in]winWindow for which jump list is processed.
[out]fmItem definition.
Returns
Pointer that needs to be passed to next mark_jumplist_iter call or NULL if iteration is over.
void mark_mb_adjustpos ( buf_T buf,
pos_T lp 
)

Adjust position to point to the first byte of a multi-byte character

If it points to a tail byte it is move backwards to the head byte.

Parameters
[in]bufBuffer to adjust position in.
[out]lpPosition to adjust.
bool mark_set_local ( const char  name,
buf_T *const  buf,
const fmark_T  fm,
const bool  update 
)

Set local mark

Parameters
[in]nameMark name.
[in]bufPointer to the buffer to set mark in.
[in]fmMark to be set.
[in]updateIf true then only set global mark if it was created later then existing one.
Returns
true on success, false on failure.
pos_T* movechangelist ( int  count)
pos_T* movemark ( int  count)
return ( const void *  )
void set_last_cursor ( win_T win)
int setmark ( int  c)
int setmark_pos ( int  c,
pos_T pos,
int  fnum 
)
void setpcmark ( void  )
while ( (size_t)(iter_mark-&(namedfm[0]))< ARRAY_SIZE(namedfm)&&!iter_mark->fmark.mark.  lnum)
while ( )
while ( iter_mark!  = NULL && iter_mark->mark.lnum == 0)

Variable Documentation

else
Initial value:
{
return iter_mark + 1
const xfmark_T * iter_mark
Definition: mark.c:1259
* fm = *iter_mark
const void FUNC_ATTR_WARN_UNUSED_RESULT
Initial value:
{
if (iter == NULL && win->w_jumplistlen == 0) {
*fm = (xfmark_T) {{{0, 0, 0}, 0, 0, NULL}, NULL};
return NULL;
}
const xfmark_T *const iter_mark =
(iter == NULL
? &(win->w_jumplist[0])
: (const xfmark_T *const) iter)
const xfmark_T * iter_mark
Definition: mark.c:1259
struct xfilemark xfmark_T
Structure defining extended mark (mark with file name attached)
Structure defining extended mark (mark with file name attached)
Definition: mark_defs.h:43
return NULL
Definition: mark.c:1280
* fm
Definition: mark.c:1235
const fmark_T * iter_mark
Initial value:
= (iter == NULL
? &(namedfm[0])
: (const xfmark_T *const) iter)
Structure defining extended mark (mark with file name attached)
Definition: mark_defs.h:43
return NULL
Definition: mark.c:1280
size_t iter_off = (size_t) (iter_mark - &(namedfm[0]))
char mark_name
Initial value:
= (char) (iter == NULL
? NUL
: (iter == &(buf->b_last_cursor)
? '"'
: (iter == &(buf->b_last_insert)
? '^'
: (iter == &(buf->b_last_change)
? '.'
: 'a' + (char) ((const fmark_T *)iter
- &(buf->b_namedm[0]))))))
#define NUL
Definition: ascii.h:19
Structure defining single local mark.
Definition: mark_defs.h:35
return NULL
Definition: mark.c:1280
char *const buf
Definition: encode.c:231
* name
Initial value:
= (char) (iter_off < NMARKS
? 'A' + (char) iter_off
: '0' + (char) (iter_off - NMARKS))
size_t iter_off
Definition: mark.c:1270
#define NMARKS
Maximum possible number of letter marks.
Definition: mark_defs.h:17
return NULL