Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Roblox
GitHub Repository: Roblox/luau
Path: blob/master/extern/isocline/src/env.h
2727 views
1
/* ----------------------------------------------------------------------------
2
Copyright (c) 2021, Daan Leijen
3
This is free software; you can redistribute it and/or modify it
4
under the terms of the MIT License. A copy of the license can be
5
found in the "LICENSE" file at the root of this distribution.
6
-----------------------------------------------------------------------------*/
7
#pragma once
8
#ifndef IC_ENV_H
9
#define IC_ENV_H
10
11
#include "../include/isocline.h"
12
#include "common.h"
13
#include "term.h"
14
#include "tty.h"
15
#include "stringbuf.h"
16
#include "history.h"
17
#include "completions.h"
18
#include "bbcode.h"
19
20
//-------------------------------------------------------------
21
// Environment
22
//-------------------------------------------------------------
23
24
struct ic_env_s {
25
alloc_t* mem; // potential custom allocator
26
ic_env_t* next; // next environment (used for proper deallocation)
27
term_t* term; // terminal
28
tty_t* tty; // keyboard (NULL if stdin is a pipe, file, etc)
29
completions_t* completions; // current completions
30
history_t* history; // edit history
31
bbcode_t* bbcode; // print with bbcodes
32
const char* prompt_marker; // the prompt marker (defaults to "> ")
33
const char* cprompt_marker; // prompt marker for continuation lines (defaults to `prompt_marker`)
34
ic_highlight_fun_t* highlighter; // highlight callback
35
void* highlighter_arg; // user state for the highlighter.
36
const char* match_braces; // matching braces, e.g "()[]{}"
37
const char* auto_braces; // auto insertion braces, e.g "()[]{}\"\"''"
38
char multiline_eol; // character used for multiline input ("\") (set to 0 to disable)
39
bool initialized; // are we initialized?
40
bool noedit; // is rich editing possible (tty != NULL)
41
bool singleline_only; // allow only single line editing?
42
bool complete_nopreview; // do not show completion preview for each selection in the completion menu?
43
bool complete_autotab; // try to keep completing after a completion?
44
bool no_multiline_indent; // indent continuation lines to line up under the initial prompt
45
bool no_help; // show short help line for history search etc.
46
bool no_hint; // allow hinting?
47
bool no_highlight; // enable highlighting?
48
bool no_bracematch; // enable brace matching?
49
bool no_autobrace; // enable automatic brace insertion?
50
bool no_lscolors; // use LSCOLORS/LS_COLORS to colorize file name completions?
51
long hint_delay; // delay before displaying a hint in milliseconds
52
};
53
54
ic_private char* ic_editline(ic_env_t* env, const char* prompt_text);
55
56
ic_private ic_env_t* ic_get_env(void);
57
ic_private const char* ic_env_get_auto_braces(ic_env_t* env);
58
ic_private const char* ic_env_get_match_braces(ic_env_t* env);
59
60
#endif // IC_ENV_H
61
62