| Safe Haskell | Safe-Inferred | 
|---|---|
| Language | Haskell2010 | 
Yi.UI.Common
Documentation
Record presenting a frontend's interface.
The functions layout and refresh are both run by the editor's main loop,
in response to user actions and so on. Their relation is a little subtle, and
is discussed here:
- to see some code, look at the function 
refreshEditorin Yi.Core. This is the only place wherelayoutandrefreshare used. - the function 
layoutis responsible for updating theEditorwith the width and height of the windows. Some frontends, such as Pango, need to modify their internal state to do this, and will consequently change their display. This is expected. - the function 
refreshshould cause the UI to update its display with the information given in theEditor. the functionalities of
layoutandrefreshoverlap to some extent, in the sense that both may cause the frontend to update its display. The Yi core provides the following guarantees which the frontend may take advantage of:- in the main editor loop (i.e. in the 
refreshEditorfunction),layoutwill be run (possibly multiple times) and thenrefreshwill be run. This guarantee will hold even in the case of threading (the functionrefreshEditorwill always be run atomically, usingMVars). between the last run of
layoutand the run ofrefresh, some changes may be made to theEditor. However, the text, text attributes, and (displayed) window region of all windows will remain the same. However, the cursor location may change.This guarantee allows frontends which calculate rendering of the text during the
layoutstage to avoid recalculating the render again duringrefresh. Pango is an example of such a frontend.
- in the main editor loop (i.e. in the 
 
The Yi core provides no guarantee about the OS thread from which the functions
layout and refresh are called from. In particular, subprocesses (e.g. compilation,
ghci) will run layout and refresh from new OS threads (see startSubprocessWatchers
in Yi.Core). The frontend must be preparaed for this: for instance, Gtk-based frontends
should wrap GUI updates in postGUIAsync.
Constructors
| UI | |
Fields 
  | |