From 99ef0c3c2480755bd08e6f2a6d453a20e148ca52 Mon Sep 17 00:00:00 2001 From: Richard Howe Date: Tue, 27 Oct 2015 22:25:07 +0000 Subject: [PATCH] Modified line completion callback to provide current position. The line completion callback now provides the callback creator with the current position in the line the cursor is at, so completions can done in all parts of an unfinished line. --- libline.c | 2 +- libline.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libline.c b/libline.c index 111a397f..7a68f635 100644 --- a/libline.c +++ b/libline.c @@ -465,7 +465,7 @@ static int complete_line(struct line_state *ls) int nwritten; char c = 0; - completion_callback(ls->buf, &lc); + completion_callback(ls->buf, ls->pos, &lc); if (lc.len == 0) { line_beep(); } else { diff --git a/libline.h b/libline.h index d3be6c23..63545d3e 100644 --- a/libline.h +++ b/libline.h @@ -57,7 +57,7 @@ extern "C" { #include typedef struct line_completions line_completions; -typedef void (line_completion_callback) (const char *, line_completions *); +typedef void (line_completion_callback) (const char *, size_t pos, line_completions *); void line_set_vi_mode(int on); int line_get_vi_mode(void);