Skip to content

Commit

Permalink
Modified line completion callback to provide current position.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
howerj committed Oct 27, 2015
1 parent 7e2e2d1 commit 99ef0c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libline.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion libline.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extern "C" {
#include <stddef.h>

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);
Expand Down

0 comments on commit 99ef0c3

Please sign in to comment.