# HG changeset patch # User Richard M. Stallman # Date 772583665 0 # Node ID ce94573db44db0424404ebe0e1fe9c592fa41a5b # Parent 5b9bbe66631c46e4c01b7a1200f1c72eb20d0b6b (BUF_PTR_CHAR_POS): New macro. diff -r 5b9bbe66631c -r ce94573db44d src/buffer.h --- a/src/buffer.h Sat Jun 25 22:27:06 1994 +0000 +++ b/src/buffer.h Sat Jun 25 22:34:25 1994 +0000 @@ -130,6 +130,13 @@ ((ptr) - (current_buffer)->text.beg \ - (ptr - (current_buffer)->text.beg < (unsigned) GPT ? 0 : GAP_SIZE) \ + 1) + +/* Convert the address of a char in the buffer into a character position. */ +#define BUF_PTR_CHAR_POS(buf, ptr) \ +((ptr) - (buf)->text.beg \ + - (ptr - (buf)->text.beg < (unsigned) BUF_GPT ((buf)) \ + ? 0 : BUF_GAP_SIZE ((buf))) \ + + 1) struct buffer_text {