diff options
Diffstat (limited to '')
-rw-r--r-- | boxes.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -496,7 +496,7 @@ typedef struct _view view; | |||
496 | 496 | ||
497 | typedef void (*boxFunction) (box *box); | 497 | typedef void (*boxFunction) (box *box); |
498 | typedef void (*eventHandler) (view *view); | 498 | typedef void (*eventHandler) (view *view); |
499 | typedef char * (*CSIhandler) (long extra, int *code, int count); | 499 | typedef char *(*CSIhandler) (long extra, int *code, int count); |
500 | 500 | ||
501 | struct function | 501 | struct function |
502 | { | 502 | { |
@@ -1829,16 +1829,27 @@ Some editors have a shortcut command concept. The smallest unique first part of | |||
1829 | 1829 | ||
1830 | char *termSize(long extra, int *params, int count) | 1830 | char *termSize(long extra, int *params, int count) |
1831 | { | 1831 | { |
1832 | struct _view *view = (struct _view *) extra; // Though we pretty much stomp on this straight away. | ||
1832 | int r = params[0], c = params[1]; | 1833 | int r = params[0], c = params[1]; |
1833 | 1834 | ||
1834 | // TODO - Deal with defaults, though perhaps this wont ever send defaults? | 1835 | // The defaults are 1, which get ignored by the heuristic below. |
1835 | // The heuristic below ignores defaults. | ||
1836 | // Check it's not an F3 key variation, coz some of them use the same CSI function code. | 1836 | // Check it's not an F3 key variation, coz some of them use the same CSI function code. |
1837 | // This is a heuristic, we are checking against an unusable terminal size. | 1837 | // This is a heuristic, we are checking against an unusable terminal size. |
1838 | // TODO - Double check what the maximum F3 variations can be. | 1838 | // TODO - Double check what the maximum F3 variations can be. |
1839 | if ((2 == count) && (8 < r) && (8 < c)) | 1839 | if ((2 == count) && (8 < r) && (8 < c)) |
1840 | { | 1840 | { |
1841 | // TODO - We got a valid terminal size response, do something with it. | 1841 | // TODO - The change is not being propogated to everything. |
1842 | sizeViewToBox(rootBox, rootBox->X, rootBox->Y, c, r - 1); | ||
1843 | calcBoxes(rootBox); | ||
1844 | drawBoxes(rootBox); | ||
1845 | |||
1846 | // Move the cursor to where it is, to check it's not now outside the terminal window. | ||
1847 | moveCursorAbsolute(rootBox->view, rootBox->view->cX, rootBox->view->cY, 0, 0); | ||
1848 | |||
1849 | // We have no idea which is the current view now. | ||
1850 | if (commandMode) view = commandLine; | ||
1851 | else view = currentBox->view; | ||
1852 | updateLine(view); | ||
1842 | } | 1853 | } |
1843 | 1854 | ||
1844 | return NULL; | 1855 | return NULL; |
@@ -1852,7 +1863,7 @@ struct CSI | |||
1852 | 1863 | ||
1853 | struct CSI CSI_terminators[] = | 1864 | struct CSI CSI_terminators[] = |
1854 | { | 1865 | { |
1855 | {"R", termSize}, | 1866 | {"R", termSize}, // Parameters are cursor line and column. Note this may be sent at other times, not just during terminal resize. |
1856 | {NULL, NULL} | 1867 | {NULL, NULL} |
1857 | }; | 1868 | }; |
1858 | 1869 | ||