builtin_commandline.c File Reference

Functions defining the commandline builtin. More...

#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <sys/types.h>
#include <termios.h>
#include <signal.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "common.h"
#include "wgetopt.h"
#include "reader.h"
#include "proc.h"
#include "parser.h"
#include "tokenizer.h"
#include "input_common.h"
#include "input.h"
#include "parse_util.h"

This graph shows which files directly or indirectly include this file:

Enumerations

enum  { STRING_MODE = 1, JOB_MODE, PROCESS_MODE, TOKEN_MODE }
 Which part of the comandbuffer are we operating on. More...
enum  { REPLACE_MODE = 1, INSERT_MODE, APPEND_MODE }
 For text insertion, how should it be done. More...

Functions

static wchar_t * get_buffer ()
 Returns the current commandline buffer.
static int get_cursor_pos ()
 Returns the position of the cursor.
static void replace_part (const wchar_t *begin, const wchar_t *end, wchar_t *insert, int append_mode)
 Replace/append/insert the selection with/at/after the specified string.
static void write_part (const wchar_t *begin, const wchar_t *end, int cut_at_cursor, int tokenize)
 Output the specified selection.
static int builtin_commandline (wchar_t **argv)
 The commandline builtin.

Variables

static wchar_t * current_buffer = 0
 Pointer to what the commandline builtin considers to be the current contents of the command line buffer.
static int current_cursor_pos = -1
 What the commandline builtin considers to be the current cursor position.

Detailed Description

Functions defining the commandline builtin.

Functions used for implementing the commandline builtin.


Enumeration Type Documentation

anonymous enum

Which part of the comandbuffer are we operating on.

Enumerator:
STRING_MODE  Operate on entire buffer.
JOB_MODE  Operate on job under cursor.
PROCESS_MODE  Operate on process under cursor.
TOKEN_MODE  Operate on token under cursor.

anonymous enum

For text insertion, how should it be done.

Enumerator:
REPLACE_MODE  Replace current text.
INSERT_MODE  Insert at cursor position.
APPEND_MODE  Insert at end of current token/command/buffer.


Function Documentation

static int builtin_commandline ( wchar_t **  argv  )  [static]

static void replace_part ( const wchar_t *  begin,
const wchar_t *  end,
wchar_t *  insert,
int  append_mode 
) [static]

Replace/append/insert the selection with/at/after the specified string.

Parameters:
begin beginning of selection
end end of selection
insert the string to insert
append_mode can be one of REPLACE_MODE, INSERT_MODE or APPEND_MODE, affects the way the test update is performed

References APPEND_MODE, buffer::buff, buff, get_buffer(), get_cursor_pos(), INSERT_MODE, out, reader_set_buffer(), REPLACE_MODE, sb_append, sb_append_substring(), sb_destroy(), and sb_init().

Referenced by builtin_commandline().

static void write_part ( const wchar_t *  begin,
const wchar_t *  end,
int  cut_at_cursor,
int  tokenize 
) [static]

Output the specified selection.

Parameters:
begin start of selection
end end of selection
cut_at_cursor whether printing should stop at the surrent cursor position
tokenize whether the string should be tokenized, printing one string token on every line and skipping non-string tokens

References buffer::buff, buff, get_buffer(), get_cursor_pos(), out, sb_append, sb_destroy(), sb_init(), sb_out, tmp, TOK_ACCEPT_UNFINISHED, tok_destroy(), tok_get_pos(), tok_has_next(), tok_init(), tok_last(), tok_last_type(), tok_next(), TOK_STRING, unescape(), and UNESCAPE_INCOMPLETE.

Referenced by builtin_commandline().


Generated on Sun Mar 8 15:46:54 2009 for fish by  doxygen 1.5.6