summaryrefslogtreecommitdiff
path: root/editors/vi.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-11-17 07:15:43 +0000
committerEric Andersen <andersen@codepoet.org>2001-11-17 07:15:43 +0000
commitbff7a60f6378f37d6543e60bee52746c82511d70 (patch)
treedefdfae9107c186f79f0191805b0eaedcdb927fb /editors/vi.c
parent80f5ac7016e966c87333c9a776989600313e7e4e (diff)
downloadbusybox-w32-bff7a60f6378f37d6543e60bee52746c82511d70.tar.gz
busybox-w32-bff7a60f6378f37d6543e60bee52746c82511d70.tar.bz2
busybox-w32-bff7a60f6378f37d6543e60bee52746c82511d70.zip
Patch from "Andrew Tipton" <andrew@cadre5.com> to enable vi cursor
keys while editing.
Diffstat (limited to 'editors/vi.c')
-rw-r--r--editors/vi.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/editors/vi.c b/editors/vi.c
index b1c957def..852e16340 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -19,7 +19,7 @@
19 */ 19 */
20 20
21static const char vi_Version[] = 21static const char vi_Version[] =
22 "$Id: vi.c,v 1.18 2001/11/17 06:57:42 andersen Exp $"; 22 "$Id: vi.c,v 1.19 2001/11/17 07:14:06 andersen Exp $";
23 23
24/* 24/*
25 * To compile for standalone use: 25 * To compile for standalone use:
@@ -242,7 +242,7 @@ static int file_size(Byte *); // what is the byte size of "fn"
242static int file_insert(Byte *, Byte *, int); 242static int file_insert(Byte *, Byte *, int);
243static int file_write(Byte *, Byte *, Byte *); 243static int file_write(Byte *, Byte *, Byte *);
244static void place_cursor(int, int, int); 244static void place_cursor(int, int, int);
245static void screen_erase(); 245static void screen_erase(void);
246static void clear_to_eol(void); 246static void clear_to_eol(void);
247static void clear_to_eos(void); 247static void clear_to_eos(void);
248static void standout_start(void); // send "start reverse video" sequence 248static void standout_start(void); // send "start reverse video" sequence
@@ -279,7 +279,7 @@ static void core_sig(int); // catch a core dump signal
279#endif /* CONFIG_FEATURE_VI_USE_SIGNALS */ 279#endif /* CONFIG_FEATURE_VI_USE_SIGNALS */
280#ifdef CONFIG_FEATURE_VI_DOT_CMD 280#ifdef CONFIG_FEATURE_VI_DOT_CMD
281static void start_new_cmd_q(Byte); // new queue for command 281static void start_new_cmd_q(Byte); // new queue for command
282static void end_cmd_q(); // stop saving input chars 282static void end_cmd_q(void); // stop saving input chars
283#else /* CONFIG_FEATURE_VI_DOT_CMD */ 283#else /* CONFIG_FEATURE_VI_DOT_CMD */
284#define end_cmd_q() 284#define end_cmd_q()
285#endif /* CONFIG_FEATURE_VI_DOT_CMD */ 285#endif /* CONFIG_FEATURE_VI_DOT_CMD */
@@ -789,6 +789,20 @@ static void do_cmd(Byte c)
789 cnt = yf = dir = 0; // quiet the compiler 789 cnt = yf = dir = 0; // quiet the compiler
790 p = q = save_dot = msg = buf; // quiet the compiler 790 p = q = save_dot = msg = buf; // quiet the compiler
791 memset(buf, '\0', 9); // clear buf 791 memset(buf, '\0', 9); // clear buf
792
793 /* if this is a cursor key, skip these checks */
794 switch (c) {
795 case VI_K_UP:
796 case VI_K_DOWN:
797 case VI_K_LEFT:
798 case VI_K_RIGHT:
799 case VI_K_HOME:
800 case VI_K_END:
801 case VI_K_PAGEUP:
802 case VI_K_PAGEDOWN:
803 goto key_cmd_mode;
804 }
805
792 if (cmd_mode == 2) { 806 if (cmd_mode == 2) {
793 // we are 'R'eplacing the current *dot with new char 807 // we are 'R'eplacing the current *dot with new char
794 if (*dot == '\n') { 808 if (*dot == '\n') {
@@ -813,6 +827,7 @@ static void do_cmd(Byte c)
813 goto dc1; 827 goto dc1;
814 } 828 }
815 829
830key_cmd_mode:
816 switch (c) { 831 switch (c) {
817 //case 0x01: // soh 832 //case 0x01: // soh
818 //case 0x09: // ht 833 //case 0x09: // ht
@@ -3039,7 +3054,7 @@ static void start_new_cmd_q(Byte c)
3039 return; 3054 return;
3040} 3055}
3041 3056
3042static void end_cmd_q() 3057static void end_cmd_q(void)
3043{ 3058{
3044#ifdef CONFIG_FEATURE_VI_YANKMARK 3059#ifdef CONFIG_FEATURE_VI_YANKMARK
3045 YDreg = 26; // go back to default Yank/Delete reg 3060 YDreg = 26; // go back to default Yank/Delete reg