The Reader class implements the bare bones of a command reader, handling such details as editing and cursor motion. What it does not support are such things as completion or history support - these are implemented elsewhere. Instance variables of note include: * buffer:
| 133 | |
| 134 | @dataclass(slots=True) |
| 135 | class Reader: |
| 136 | """The Reader class implements the bare bones of a command reader, |
| 137 | handling such details as editing and cursor motion. What it does |
| 138 | not support are such things as completion or history support - |
| 139 | these are implemented elsewhere. |
| 140 | |
| 141 | Instance variables of note include: |
| 142 | |
| 143 | * buffer: |
| 144 | A per-character list containing all the characters that have been |
| 145 | entered. Does not include color information. |
| 146 | * console: |
| 147 | Hopefully encapsulates the OS dependent stuff. |
| 148 | * pos: |
| 149 | A 0-based index into 'buffer' for where the insertion point |
| 150 | is. |
| 151 | * screeninfo: |
| 152 | A list of screen position tuples. Each list element is a tuple |
| 153 | representing information on visible line length for a given line. |
| 154 | Allows for efficient skipping of color escape sequences. |
| 155 | * cxy, lxy: |
| 156 | the position of the insertion point in screen ... |
| 157 | * syntax_table: |
| 158 | Dictionary mapping characters to 'syntax class'; read the |
| 159 | emacs docs to see what this means :-) |
| 160 | * commands: |
| 161 | Dictionary mapping command names to command classes. |
| 162 | * arg: |
| 163 | The emacs-style prefix argument. It will be None if no such |
| 164 | argument has been provided. |
| 165 | * dirty: |
| 166 | True if we need to refresh the display. |
| 167 | * kill_ring: |
| 168 | The emacs-style kill-ring; manipulated with yank & yank-pop |
| 169 | * ps1, ps2, ps3, ps4: |
| 170 | prompts. ps1 is the prompt for a one-line input; for a |
| 171 | multiline input it looks like: |
| 172 | ps2> first line of input goes here |
| 173 | ps3> second and further |
| 174 | ps3> lines get ps3 |
| 175 | ... |
| 176 | ps4> and the last one gets ps4 |
| 177 | As with the usual top-level, you can set these to instances if |
| 178 | you like; str() will be called on them (once) at the beginning |
| 179 | of each command. Don't put really long or newline containing |
| 180 | strings here, please! |
| 181 | This is just the default policy; you can change it freely by |
| 182 | overriding get_prompt() (and indeed some standard subclasses |
| 183 | do). |
| 184 | * finished: |
| 185 | handle1 will set this to a true value if a command signals |
| 186 | that we're done. |
| 187 | """ |
| 188 | |
| 189 | console: console.Console |
| 190 | |
| 191 | ## state |
| 192 | buffer: list[str] = field(default_factory=list) |
nothing calls this directly
no test coverage detected
searching dependent graphs…