Skip to content
Snippets Groups Projects
Commit 39f9858a authored by deuce's avatar deuce
Browse files

Stop using *nix-only KEY_* macros... use CIO_KEY_* macros from uifc instead.

parent 75e75225
No related branches found
No related tags found
No related merge requests found
#include <uifc.h>
#include <conio.h>
#include <keys.h>
#include "term.h"
#include "uifcinit.h"
......@@ -26,40 +27,44 @@ void viewscroll(void)
puttext(term.x+1,term.y+1,term.x+term.width,term.y+term.height,term.scrollback+(term.width*2*top));
key=getch();
switch(key) {
case 0:
switch(getch()<<8) {
case CIO_KEY_UP:
top--;
break;
case CIO_KEY_DOWN:
top++;
break;
case CIO_KEY_PPAGE:
top-=term.height;
break;
case CIO_KEY_NPAGE:
top+=term.height;
break;
case CIO_KEY_F(1):
init_uifc();
uifc.helpbuf= "`Scrollback Buffer`\n\n"
"~ J ~ or ~ Up Arrow ~ Scrolls up one line\n"
"~ K ~ or ~ Down Arrow ~ Scrolls down one line\n"
"~ H ~ or ~ Page Up ~ Scrolls up one screen\n"
"~ L ~ or ~ Page Down ~ Scrolls down one screen\n";
uifc.showhelp();
uifcbail();
drawwin();
break;
}
break;
case 'j':
case 'J':
case KEY_UP:
top--;
break;
case 'k':
case 'K':
case KEY_DOWN:
top++;
break;
case 'h':
case 'H':
case KEY_PPAGE:
top-=term.height;
break;
case 'l':
case 'L':
case KEY_NPAGE:
top+=term.height;
break;
case ESC:
i=1;
break;
case KEY_F(1):
init_uifc();
uifc.helpbuf= "`Scrollback Buffer`\n\n"
"~ J ~ or ~ Up Arrow ~ Scrolls up one line\n"
"~ K ~ or ~ Down Arrow ~ Scrolls down one line\n"
"~ H ~ or ~ Page Up ~ Scrolls up one screen\n"
"~ L ~ or ~ Page Down ~ Scrolls down one screen\n";
uifc.showhelp();
uifcbail();
drawwin();
break;
}
}
puttext(1,1,txtinfo.screenwidth,txtinfo.screenheight,buf);
......
#include <genwrap.h>
#include <conio.h>
#include <keys.h>
#include "term.h"
#include "uifcinit.h"
......@@ -576,6 +577,49 @@ void doterm(void)
while(kbhit()) {
key=getch();
switch(key) {
case 0:
switch(getch()<<8) {
case CIO_KEY_LEFT:
rlogin_send("\033[D",3,100);
break;
case CIO_KEY_RIGHT:
rlogin_send("\033[C",3,100);
break;
case CIO_KEY_UP:
rlogin_send("\033[A",3,100);
break;
case CIO_KEY_DOWN:
rlogin_send("\033[B",3,100);
break;
case CIO_KEY_HOME:
rlogin_send("\033[H",3,100);
break;
case CIO_KEY_END:
#ifdef CIO_KEY_SELECT
case CIO_KEY_SELECT: /* Some terminfo/termcap entries use KEY_SELECT as the END key! */
#endif
rlogin_send("\033[K",3,100);
break;
case CIO_KEY_F(1):
rlogin_send("\033OP",3,100);
break;
case CIO_KEY_F(2):
rlogin_send("\033OQ",3,100);
break;
case CIO_KEY_F(3):
rlogin_send("\033Ow",3,100);
break;
case CIO_KEY_F(4):
rlogin_send("\033Ox",3,100);
break;
#ifdef __unix__
case 128|'S': /* Under curses, ALT sets the high bit of the char */
case 128|'s': /* Under curses, ALT sets the high bit of the char */
viewscroll();
break;
#endif
}
break;
case 17: /* CTRL-Q */
free(term.scrollback);
return;
......@@ -589,46 +633,6 @@ void doterm(void)
}
gotoxy(i,j);
break;
case KEY_LEFT:
rlogin_send("\033[D",3,100);
break;
case KEY_RIGHT:
rlogin_send("\033[C",3,100);
break;
case KEY_UP:
rlogin_send("\033[A",3,100);
break;
case KEY_DOWN:
rlogin_send("\033[B",3,100);
break;
case KEY_HOME:
rlogin_send("\033[H",3,100);
break;
case KEY_END:
#ifdef KEY_SELECT
case KEY_SELECT: /* Some terminfo/termcap entries use KEY_SELECT as the END key! */
#endif
rlogin_send("\033[K",3,100);
break;
case KEY_F(1):
rlogin_send("\033OP",3,100);
break;
case KEY_F(2):
rlogin_send("\033OQ",3,100);
break;
case KEY_F(3):
rlogin_send("\033Ow",3,100);
break;
case KEY_F(4):
rlogin_send("\033Ox",3,100);
break;
#ifdef __unix__
case 128|'S': /* Under curses, ALT sets the high bit of the char */
case 128|'s': /* Under curses, ALT sets the high bit of the char */
viewscroll();
break;
#endif
case KEY_BACKSPACE:
case '\b':
key='\b';
/* FALLTHROUGH to default */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment