Merge branch 'scripting-python' (early part) into screen-scripting-soc
[screen-lua.git] / src / HACKING
blobb78d40f8913c45d4fa50764fb54e38fc3d820bf9
1 WIP notes on hacking the Screen source.
3 * Screen commands are handled by the DoAction function in process.c.
4   The local variable nr is set to an integer value representing the
5   command to be evaluated; for every command `foo', there is an
6   integer value RC_FOO for use as nr's value to represent it. Find
7   the matching case label to follow procesing of the command.
8    
9   The RC_FOO values are defined in comm.h, which is automatically
10   generated by comm.sh, based on the names of the commands
11   themselves (found in comm.c).
13 * The current display is held in the global variable "display".
14   Variable names like D_foo are shorthands for display->d_foo (where d_foo
15   is a member of "struct display").
17 * Names like D_IS, D_TI, D_SG usually refer to the values of various
18   termcap features of the current display. These are found in term.h,
19   which is automatically generated from term.c by term.sh.
21 * The main input-reading function for handling user input from a display,
22   is disp_readev_fn in display.c. This also handles automatic transformation
23   of mouse-tracking codes from display coordinates to screen-window
24   coordinates, and decodes characters from the display's encoding, passing
25   it on to the foreground input processor.
27   Input is passed through ProcessInput in process.c to handle
28   keybindings (specified by bindkey and such), and then processed by
29   layer-specific input-processing functions, which you'll find in
30   instances of struct LayFuncs. For instance, keystrokes are processed
31   by:
33         normal windows:         WinPrGocess
34         window in copy-mode:    MarkProcess
35         window list:            WListProcess
36         command input line:     InpProcess
38 * Handling string escapes (in hardstatus and the like), such as %w or
39   %{= bw}, is done in screen.c, MakeWinMsgEv().