aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-01-29 22:19:47 +1000
committerDavid Walter Seikel2014-01-29 22:19:47 +1000
commit6f1347f459dbed17162d73e94bf266a1907be034 (patch)
tree5ba823834bc4a46ccb885cb4f4d932af00dfbbc1
parentDeal with terminal resize. (diff)
downloadboxes-6f1347f459dbed17162d73e94bf266a1907be034.zip
boxes-6f1347f459dbed17162d73e94bf266a1907be034.tar.gz
boxes-6f1347f459dbed17162d73e94bf266a1907be034.tar.bz2
boxes-6f1347f459dbed17162d73e94bf266a1907be034.tar.xz
Some clean ups, mostly to do with ^C now working.
-rw-r--r--boxes.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/boxes.c b/boxes.c
index f661cc9..05bd518 100644
--- a/boxes.c
+++ b/boxes.c
@@ -468,7 +468,7 @@ an array, you can do sizeof(table)/sizeof(*table). Divide the size of
468the table (in bytes) by the size of a member of the table (in bytes) to 468the table (in bytes) by the size of a member of the table (in bytes) to
469get the number of entries. 469get the number of entries.
470 470
471I should try that trick. 471I should try that trick. Seems to work, let's do that everywhere.
472*/ 472*/
473 473
474 {NULL, NULL} 474 {NULL, NULL}
@@ -1822,8 +1822,6 @@ Less and more have the "ZZ" command, but nothing else seems to have multi ordina
1822 1822
1823Some editors have a shortcut command concept. The smallest unique first part of each command will match, as well as anything longer. 1823Some editors have a shortcut command concept. The smallest unique first part of each command will match, as well as anything longer.
1824 A further complication is if we are not implementing some commands that might change what is "shortest unique prefix". 1824 A further complication is if we are not implementing some commands that might change what is "shortest unique prefix".
1825
1826 response is "\x1B[ ; R", where the spaces are replaced by digits LINES and COLUMNS respectively.
1827*/ 1825*/
1828 1826
1829 1827
@@ -2182,7 +2180,7 @@ struct keyCommand simpleCommandKeys[] =
2182// readline uses these same commands, and defaults to emacs keystrokes. 2180// readline uses these same commands, and defaults to emacs keystrokes.
2183struct function simpleEmacsCommands[] = 2181struct function simpleEmacsCommands[] =
2184{ 2182{
2185 {"nop", "Do nothing.", 0, {nop}}, 2183 {"nop", "Do nothing.", 0, {nop}},
2186 {"delete-backward-char", "Back space last character.", 0, {backSpaceChar}}, 2184 {"delete-backward-char", "Back space last character.", 0, {backSpaceChar}},
2187 {"delete-window", "Delete a box.", 0, {deleteBox}}, 2185 {"delete-window", "Delete a box.", 0, {deleteBox}},
2188 {"delete-char", "Delete current character.", 0, {deleteChar}}, 2186 {"delete-char", "Delete current character.", 0, {deleteChar}},
@@ -2191,7 +2189,7 @@ struct function simpleEmacsCommands[] =
2191 {"end-of-line", "Go to end of line.", 0, {endOfLine}}, 2189 {"end-of-line", "Go to end of line.", 0, {endOfLine}},
2192 {"accept-line", "Execute a line as a script.", 0, {executeLine}}, // From readline, which uses emacs commands, coz mg at least does not seem to have this. 2190 {"accept-line", "Execute a line as a script.", 0, {executeLine}}, // From readline, which uses emacs commands, coz mg at least does not seem to have this.
2193 {"backward-char", "Move cursor left one character.", 0, {leftChar}}, 2191 {"backward-char", "Move cursor left one character.", 0, {leftChar}},
2194 {"save-buffers-kill-emacs", "Quit the application.", 0, {quit}}, // Does more than just quit. 2192 {"save-buffers-kill-emacs", "Quit the application.", 0, {quit}}, // TODO - Does more than just quit.
2195 {"forward-char", "Move cursor right one character.", 0, {rightChar}}, 2193 {"forward-char", "Move cursor right one character.", 0, {rightChar}},
2196 {"save-buffer", "Save.", 0, {saveContent}}, 2194 {"save-buffer", "Save.", 0, {saveContent}},
2197 {"split-window-horizontally", "Split box in half horizontally.", 0, {halveBoxHorizontally}}, // TODO - Making this one up for now, mg does not have it. 2195 {"split-window-horizontally", "Split box in half horizontally.", 0, {halveBoxHorizontally}}, // TODO - Making this one up for now, mg does not have it.
@@ -2214,8 +2212,7 @@ struct keyCommand simpleEmacsKeys[] =
2214 {"^N", "next-line"}, 2212 {"^N", "next-line"},
2215 {"End", "end-of-line"}, 2213 {"End", "end-of-line"},
2216 {"^E", "end-of-line"}, 2214 {"^E", "end-of-line"},
2217 {"^X^C", "save-buffers-kill-emacs"}, // Damn, Ctrl C getting eaten by default signal handling. On the other hand, at least the "kill-emacs" part will work. lol 2215 {"^X^C", "save-buffers-kill-emacs"},
2218 {"^Xq", "save-buffers-kill-emacs"}, // TODO - Faking this so we can actually exit. Remove it later.
2219 {"^X^S", "save-buffer"}, 2216 {"^X^S", "save-buffer"},
2220 {"Home", "beginning-of-line"}, 2217 {"Home", "beginning-of-line"},
2221 {"^A", "beginning-of-line"}, 2218 {"^A", "beginning-of-line"},
@@ -2230,7 +2227,7 @@ struct keyCommand simpleEmacsKeys[] =
2230 {"^F", "forward-char"}, 2227 {"^F", "forward-char"},
2231 {"^[x", "execute-extended-command"}, // M-x 2228 {"^[x", "execute-extended-command"}, // M-x
2232 {"^X2", "split-window-vertically"}, 2229 {"^X2", "split-window-vertically"},
2233 {"^X3", "split-window-horizontally"}, // TODO - Again, just making this up for now. 2230 {"^X3", "split-window-horizontally"}, // TODO - Just making this up for now.
2234 {"^XP", "other-window"}, 2231 {"^XP", "other-window"},
2235 {"^XP", "other-window"}, 2232 {"^XP", "other-window"},
2236 {"^X0", "delete-window"}, 2233 {"^X0", "delete-window"},
@@ -2289,7 +2286,7 @@ struct context simpleEmacs =
2289// TODO - Some of these might be wrong. Just going by the inadequate joe docs for now. 2286// TODO - Some of these might be wrong. Just going by the inadequate joe docs for now.
2290struct function simpleJoeCommands[] = 2287struct function simpleJoeCommands[] =
2291{ 2288{
2292 {"nop", "Do nothing.", 0, {nop}}, 2289 {"nop", "Do nothing.", 0, {nop}},
2293 {"backs", "Back space last character.", 0, {backSpaceChar}}, 2290 {"backs", "Back space last character.", 0, {backSpaceChar}},
2294 {"abort", "Delete a box.", 0, {deleteBox}}, 2291 {"abort", "Delete a box.", 0, {deleteBox}},
2295 {"delch", "Delete current character.", 0, {deleteChar}}, 2292 {"delch", "Delete current character.", 0, {deleteChar}},
@@ -2726,7 +2723,7 @@ struct keyCommand simpleViInsertKeys[] =
2726 {"Del", "deleteChar"}, 2723 {"Del", "deleteChar"},
2727 {"Return", "splitLine"}, 2724 {"Return", "splitLine"},
2728 {"^[", "visual"}, 2725 {"^[", "visual"},
2729 {"^C", "visual"}, // TODO - Ctrl-C is filtered by the default signal handling, which we might want to disable. 2726 {"^C", "visual"},
2730 {NULL, NULL} 2727 {NULL, NULL}
2731}; 2728};
2732 2729
@@ -2847,7 +2844,6 @@ void boxes_main(void)
2847 VSTART restart output on ^Q, IXON turns that on. 2844 VSTART restart output on ^Q, IXON turns that on.
2848 VSTATUS display status info and sends SIGINFO on ^T. Not in POSIX, not supported in Linux. Does not seem to be any method of turning it off where it is supported. 2845 VSTATUS display status info and sends SIGINFO on ^T. Not in POSIX, not supported in Linux. Does not seem to be any method of turning it off where it is supported.
2849 VSTOP stop output on ^S, IXON turns that on. 2846 VSTOP stop output on ^S, IXON turns that on.
2850
2851 */ 2847 */
2852 termio.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IUCLC | IXON | IXOFF | IXANY); 2848 termio.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IUCLC | IXON | IXOFF | IXANY);
2853 termio.c_oflag &= ~OPOST; 2849 termio.c_oflag &= ~OPOST;