summaryrefslogtreecommitdiffstats
path: root/HACKING
diff options
context:
space:
mode:
Diffstat (limited to 'HACKING')
-rw-r--r--HACKING39
1 files changed, 39 insertions, 0 deletions
diff --git a/HACKING b/HACKING
new file mode 100644
index 0000000..9cd0d1a
--- /dev/null
+++ b/HACKING
@@ -0,0 +1,39 @@
+WIP notes on hacking the Screen source.
+
+* Screen commands are handled by the DoAction function in process.c.
+ The local variable nr is set to an integer value representing the
+ command to be evaluated; for every command `foo', there is an
+ integer value RC_FOO for use as nr's value to represent it. Find
+ the matching case label to follow processing of the command.
+
+ The RC_FOO values are defined in comm.h, which is automatically
+ generated by comm.sh, based on the names of the commands
+ themselves (found in comm.c).
+
+* The current display is held in the global variable "display".
+ Variable names like D_foo are shorthands for display->d_foo (where d_foo
+ is a member of "struct display").
+
+* Names like D_IS, D_TI, D_SG usually refer to the values of various
+ termcap features of the current display. These are found in term.h,
+ which is automatically generated from term.c by term.sh.
+
+* The main input-reading function for handling user input from a display,
+ is disp_readev_fn in display.c. This also handles automatic transformation
+ of mouse-tracking codes from display coordinates to screen-window
+ coordinates, and decodes characters from the display's encoding, passing
+ it on to the foreground input processor.
+
+ Input is passed through ProcessInput in process.c to handle
+ keybindings (specified by bindkey and such), and then processed by
+ layer-specific input-processing functions, which you'll find in
+ instances of struct LayFuncs. For instance, keystrokes are processed
+ by:
+
+ normal windows: WinPrGocess
+ window in copy-mode: MarkProcess
+ window list: WListProcess
+ command input line: InpProcess
+
+* Handling string escapes (in hardstatus and the like), such as %w or
+ %{= bw}, is done in screen.c, MakeWinMsgEv().