diff options
author | David Walter Seikel | 2014-01-28 18:22:05 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-01-28 18:22:05 +1000 |
commit | ae5f7a6be9c2fce2f214b37acdfd58a152517cf9 (patch) | |
tree | cc08cee35de4c54bef152ad0a99f66e9976c64fb | |
parent | Hack up editLine to make it more generic, and remove the dependency on box an... (diff) | |
download | boxes-ae5f7a6be9c2fce2f214b37acdfd58a152517cf9.zip boxes-ae5f7a6be9c2fce2f214b37acdfd58a152517cf9.tar.gz boxes-ae5f7a6be9c2fce2f214b37acdfd58a152517cf9.tar.bz2 boxes-ae5f7a6be9c2fce2f214b37acdfd58a152517cf9.tar.xz |
Document key and command matching complications that are not yet handled.
-rw-r--r-- | boxes.c | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -1790,6 +1790,20 @@ static void lineCommand(long extra, char *command, event *event) | |||
1790 | 1790 | ||
1791 | // Basically this is the main loop. | 1791 | // Basically this is the main loop. |
1792 | 1792 | ||
1793 | /* Unhandled complications - | ||
1794 | Less and more have the "ZZ" command, but nothing else seems to have multi ordinary character commands. | ||
1795 | |||
1796 | Some editors have a shortcut command concept. The smallest unique first part of each command will match, as well as anything longer. | ||
1797 | A further complication is if we are not implementing some commands that might change what is "shortest unique prefix". | ||
1798 | |||
1799 | The response from a terminal size check command includes a prefix, a suffix, with the data in the middle. | ||
1800 | send "\x1B[s\x1B[999C\x1B[999B\x1B[6n\x1B[u" | ||
1801 | Which breaks down to - save cursor position, down 999, right 999, request cursor position (DSR), restore cursor position. | ||
1802 | response is "\x1B[ ; R", where the spaces are replaced by digits LINES and COLUMNS respectively. | ||
1803 | And just to screw things up - {"\x1B[1;2R", "Shift F3"}, though no one's going to have a 1 x 2 terminal. | ||
1804 | |||
1805 | Mouse events are likely similar. | ||
1806 | */ | ||
1793 | void editLine(long extra, struct keyCommand *(*lineLoop)(long extra), void (*lineChar)(long extra, char *buffer), void (*lineCommand)(long extra, char *command, event *event)) | 1807 | void editLine(long extra, struct keyCommand *(*lineLoop)(long extra), void (*lineChar)(long extra, char *buffer), void (*lineCommand)(long extra, char *command, event *event)) |
1794 | { | 1808 | { |
1795 | struct pollfd pollfds[1]; | 1809 | struct pollfd pollfds[1]; |
@@ -2200,6 +2214,9 @@ struct context simpleJoe = | |||
2200 | // No cursor movement, just scrolling. | 2214 | // No cursor movement, just scrolling. |
2201 | // TODO - Put content into read only mode. | 2215 | // TODO - Put content into read only mode. |
2202 | // TODO - actually implement read only mode where up and down one line do actual scrolling instead of cursor movement. | 2216 | // TODO - actually implement read only mode where up and down one line do actual scrolling instead of cursor movement. |
2217 | // TODO - maybe I can support the ZZ command in one of two ways - | ||
2218 | // Just have a Z command do the quit. | ||
2219 | // Have the first Z go into a special mode, where anything other than a Z restores the original mode. | ||
2203 | 2220 | ||
2204 | struct keyCommand simpleLessKeys[] = | 2221 | struct keyCommand simpleLessKeys[] = |
2205 | { | 2222 | { |
@@ -2209,7 +2226,7 @@ struct keyCommand simpleLessKeys[] = | |||
2209 | {"End", "endOfLine"}, | 2226 | {"End", "endOfLine"}, |
2210 | {"q", "quit"}, | 2227 | {"q", "quit"}, |
2211 | {":q", "quit"}, // TODO - A vi ism, should do ex command stuff instead. | 2228 | {":q", "quit"}, // TODO - A vi ism, should do ex command stuff instead. |
2212 | {"ZZ", "quit"}, // This one will suck. | 2229 | // {"ZZ", "quit"}, // The infrastructure here does not support this style of command. |
2213 | {"PgDn", "downPage"}, | 2230 | {"PgDn", "downPage"}, |
2214 | {"f", "downPage"}, | 2231 | {"f", "downPage"}, |
2215 | {" ", "downPage"}, | 2232 | {" ", "downPage"}, |
@@ -2246,7 +2263,7 @@ struct keyCommand simpleMoreKeys[] = | |||
2246 | {"Return", "downLine"}, | 2263 | {"Return", "downLine"}, |
2247 | {"q", "quit"}, | 2264 | {"q", "quit"}, |
2248 | {":q", "quit"}, // See comments for "less". | 2265 | {":q", "quit"}, // See comments for "less". |
2249 | {"ZZ", "quit"}, // See comments for "less". | 2266 | // {"ZZ", "quit"}, // See comments for "less". |
2250 | {"f", "downPage"}, | 2267 | {"f", "downPage"}, |
2251 | {" ", "downPage"}, | 2268 | {" ", "downPage"}, |
2252 | {"^F", "downPage"}, | 2269 | {"^F", "downPage"}, |