2014-07-18 07:29:46 +02:00
|
|
|
/* autocomplete.h
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Toxic All Rights Reserved.
|
|
|
|
*
|
|
|
|
* This file is part of Toxic.
|
|
|
|
*
|
|
|
|
* Toxic is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Toxic is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Toxic. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-09-23 03:24:45 +02:00
|
|
|
#ifndef AUTOCOMPLETE_H
|
|
|
|
#define AUTOCOMPLETE_H
|
2014-07-18 07:29:46 +02:00
|
|
|
|
2020-04-18 02:00:00 +02:00
|
|
|
#include "windows.h"
|
|
|
|
|
2018-10-17 06:18:43 +02:00
|
|
|
/*
|
|
|
|
* Looks for all instances in list that begin with the last entered word in line according to pos,
|
|
|
|
* then fills line with the complete word. e.g. "Hello jo" would complete the line
|
|
|
|
* with "Hello john". If multiple matches, prints out all the matches and semi-completes line.
|
|
|
|
*
|
2020-10-30 01:28:09 +01:00
|
|
|
* `list` is a pointer to `n_items` strings.
|
|
|
|
*
|
|
|
|
* dir_search should be true if the line being completed is a file path.
|
2018-10-17 06:18:43 +02:00
|
|
|
*
|
|
|
|
* Returns the difference between the old len and new len of line on success.
|
|
|
|
* Returns -1 on error.
|
2020-10-30 01:28:09 +01:00
|
|
|
*
|
|
|
|
* Note: This function should not be called directly. Use complete_line() and complete_path() instead.
|
2018-10-17 06:18:43 +02:00
|
|
|
*/
|
2020-10-30 01:28:09 +01:00
|
|
|
int complete_line(ToxWindow *self, const char **list, size_t n_items);
|
2014-07-18 07:29:46 +02:00
|
|
|
|
2018-10-17 06:18:43 +02:00
|
|
|
/* Attempts to match /command "<incomplete-dir>" line to matching directories.
|
|
|
|
* If there is only one match the line is auto-completed.
|
|
|
|
*
|
|
|
|
* Returns the diff between old len and new len of ctx->line on success.
|
|
|
|
* Returns -1 if no matches or more than one match.
|
|
|
|
*/
|
2014-09-26 09:10:44 +02:00
|
|
|
int dir_match(ToxWindow *self, Tox *m, const wchar_t *line, const wchar_t *cmd);
|
2014-07-18 07:29:46 +02:00
|
|
|
|
2018-10-08 19:39:04 +02:00
|
|
|
#endif /* AUTOCOMPLETE_H */
|