Skip to content

Commit

Permalink
Minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-arch committed Apr 27, 2024
1 parent b59c132 commit 6e21f07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -3276,20 +3276,20 @@ complete_bookmark_names(char *text, const size_t words_n, int *exit_status)
{
*exit_status = FUNC_SUCCESS;

// rl_line_buffer is either "bm " or "bookmarks "
/* rl_line_buffer is either "bm " or "bookmarks " */
char *q = rl_line_buffer + (rl_line_buffer[1] == 'o' ? 9 : 2);

if (q && *(q + 1) == 'a' && (*(q + 2) == ' '
|| strncmp(q + 1, "add ", 4) == 0)) {
if (words_n > 3) // Do not complete anything after "bm add FILE"
if (words_n > 3) /* Do not complete anything after "bm add FILE" */
rl_attempted_completion_over = 1;
else // 'bm add': complete with path completion
else /* 'bm add': complete with path completion */
*exit_status = FUNC_FAILURE;

return (char **)NULL;
}

// If not 'bm add' complete with bookmarks
/* If not 'bm add' complete with bookmarks */
#ifndef _NO_SUGGESTIONS
if (suggestion.type != FILE_SUG)
rl_attempted_completion_over = 1;
Expand Down
4 changes: 4 additions & 0 deletions src/suggestions.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,12 @@ restore_cursor_position(const size_t slines)
{
if (slines > 1)
MOVE_CURSOR_UP((int)slines - 1);

MOVE_CURSOR_LEFT(term_cols);

if (conf.highlight == 0 && rl_point < rl_end)
curcol -= (rl_end - rl_point);

MOVE_CURSOR_RIGHT(curcol > 0 ? curcol - 1 : curcol);
}

Expand All @@ -468,6 +471,7 @@ calculate_suggestion_lines(int *baej, const size_t suggestion_len)
size_t cucs = cuc + suggestion_len;
if (conf.highlight == 0 && rl_point < rl_end)
cucs += (size_t)(rl_end - rl_point - 1);

/* slines: amount of lines we need to print the suggestion, including
* the current line. */
size_t slines = 1;
Expand Down

0 comments on commit 6e21f07

Please sign in to comment.