diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/vi.c | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/editors/vi.c b/editors/vi.c index 144e9d760..e01ee1165 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | static const char vi_Version[] = | 21 | static const char vi_Version[] = |
22 | "$Id: vi.c,v 1.28 2003/03/19 09:11:45 mjn3 Exp $"; | 22 | "$Id: vi.c,v 1.29 2003/09/15 08:33:36 andersen Exp $"; |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * To compile for standalone use: | 25 | * To compile for standalone use: |
@@ -197,9 +197,6 @@ static jmp_buf restart; // catch_sig() | |||
197 | #if defined(CONFIG_FEATURE_VI_USE_SIGNALS) || defined(CONFIG_FEATURE_VI_CRASHME) | 197 | #if defined(CONFIG_FEATURE_VI_USE_SIGNALS) || defined(CONFIG_FEATURE_VI_CRASHME) |
198 | static int my_pid; | 198 | static int my_pid; |
199 | #endif | 199 | #endif |
200 | #ifdef CONFIG_FEATURE_VI_WIN_RESIZE | ||
201 | static struct winsize winsize; // remember the window size | ||
202 | #endif /* CONFIG_FEATURE_VI_WIN_RESIZE */ | ||
203 | #ifdef CONFIG_FEATURE_VI_DOT_CMD | 200 | #ifdef CONFIG_FEATURE_VI_DOT_CMD |
204 | static int adding2q; // are we currently adding user input to q | 201 | static int adding2q; // are we currently adding user input to q |
205 | static Byte *last_modifying_cmd; // last modifying cmd for "." | 202 | static Byte *last_modifying_cmd; // last modifying cmd for "." |
@@ -412,6 +409,14 @@ extern int vi_main(int argc, char **argv) | |||
412 | return (0); | 409 | return (0); |
413 | } | 410 | } |
414 | 411 | ||
412 | #ifdef CONFIG_FEATURE_VI_WIN_RESIZE | ||
413 | //----- See what the window size currently is -------------------- | ||
414 | static inline void window_size_get(int fd) | ||
415 | { | ||
416 | get_terminal_width_height(fd, &columns, &rows); | ||
417 | } | ||
418 | #endif /* CONFIG_FEATURE_VI_WIN_RESIZE */ | ||
419 | |||
415 | static void edit_file(Byte * fn) | 420 | static void edit_file(Byte * fn) |
416 | { | 421 | { |
417 | Byte c; | 422 | Byte c; |
@@ -2122,29 +2127,6 @@ static void cookmode(void) | |||
2122 | tcsetattr(0, TCSANOW, &term_orig); | 2127 | tcsetattr(0, TCSANOW, &term_orig); |
2123 | } | 2128 | } |
2124 | 2129 | ||
2125 | #ifdef CONFIG_FEATURE_VI_WIN_RESIZE | ||
2126 | //----- See what the window size currently is -------------------- | ||
2127 | static void window_size_get(int sig) | ||
2128 | { | ||
2129 | int i; | ||
2130 | |||
2131 | i = ioctl(0, TIOCGWINSZ, &winsize); | ||
2132 | if (i != 0) { | ||
2133 | // force 24x80 | ||
2134 | winsize.ws_row = 24; | ||
2135 | winsize.ws_col = 80; | ||
2136 | } | ||
2137 | if (winsize.ws_row <= 1) { | ||
2138 | winsize.ws_row = 24; | ||
2139 | } | ||
2140 | if (winsize.ws_col <= 1) { | ||
2141 | winsize.ws_col = 80; | ||
2142 | } | ||
2143 | rows = (int) winsize.ws_row; | ||
2144 | columns = (int) winsize.ws_col; | ||
2145 | } | ||
2146 | #endif /* CONFIG_FEATURE_VI_WIN_RESIZE */ | ||
2147 | |||
2148 | //----- Come here when we get a window resize signal --------- | 2130 | //----- Come here when we get a window resize signal --------- |
2149 | #ifdef CONFIG_FEATURE_VI_USE_SIGNALS | 2131 | #ifdef CONFIG_FEATURE_VI_USE_SIGNALS |
2150 | static void winch_sig(int sig) | 2132 | static void winch_sig(int sig) |