/* ----------------------------------------------------------------------------1Copyright (c) 2021, Daan Leijen2This is free software; you can redistribute it and/or modify it3under the terms of the MIT License. A copy of the license can be4found in the "LICENSE" file at the root of this distribution.5-----------------------------------------------------------------------------*/6#pragma once7#ifndef IC_ENV_H8#define IC_ENV_H910#include "../include/isocline.h"11#include "common.h"12#include "term.h"13#include "tty.h"14#include "stringbuf.h"15#include "history.h"16#include "completions.h"17#include "bbcode.h"1819//-------------------------------------------------------------20// Environment21//-------------------------------------------------------------2223struct ic_env_s {24alloc_t* mem; // potential custom allocator25ic_env_t* next; // next environment (used for proper deallocation)26term_t* term; // terminal27tty_t* tty; // keyboard (NULL if stdin is a pipe, file, etc)28completions_t* completions; // current completions29history_t* history; // edit history30bbcode_t* bbcode; // print with bbcodes31const char* prompt_marker; // the prompt marker (defaults to "> ")32const char* cprompt_marker; // prompt marker for continuation lines (defaults to `prompt_marker`)33ic_highlight_fun_t* highlighter; // highlight callback34void* highlighter_arg; // user state for the highlighter.35const char* match_braces; // matching braces, e.g "()[]{}"36const char* auto_braces; // auto insertion braces, e.g "()[]{}\"\"''"37char multiline_eol; // character used for multiline input ("\") (set to 0 to disable)38bool initialized; // are we initialized?39bool noedit; // is rich editing possible (tty != NULL)40bool singleline_only; // allow only single line editing?41bool complete_nopreview; // do not show completion preview for each selection in the completion menu?42bool complete_autotab; // try to keep completing after a completion?43bool no_multiline_indent; // indent continuation lines to line up under the initial prompt44bool no_help; // show short help line for history search etc.45bool no_hint; // allow hinting?46bool no_highlight; // enable highlighting?47bool no_bracematch; // enable brace matching?48bool no_autobrace; // enable automatic brace insertion?49bool no_lscolors; // use LSCOLORS/LS_COLORS to colorize file name completions?50long hint_delay; // delay before displaying a hint in milliseconds51};5253ic_private char* ic_editline(ic_env_t* env, const char* prompt_text);5455ic_private ic_env_t* ic_get_env(void);56ic_private const char* ic_env_get_auto_braces(ic_env_t* env);57ic_private const char* ic_env_get_match_braces(ic_env_t* env);5859#endif // IC_ENV_H606162