Skip to content
Snippets Groups Projects
Commit 93debbd1 authored by deuce's avatar deuce
Browse files

Alt-S scancode actives backscroll (if available)

Copy current screen to end of scrollback.
Reactive scrollback feature.
parent dad57367
No related branches found
No related tags found
No related merge requests found
...@@ -2,30 +2,35 @@ ...@@ -2,30 +2,35 @@
#include <ciolib.h> #include <ciolib.h>
#include <keys.h> #include <keys.h>
#include "cterm.h"
#include "term.h" #include "term.h"
#include "uifcinit.h" #include "uifcinit.h"
void viewscroll(void) void viewscroll(void)
{ {
#if 0
int top; int top;
int key; int key;
int i; int i;
char *buf; char *scrollback;
struct text_info txtinfo; struct text_info txtinfo;
int x,y;
x=wherex();
y=wherey();
uifcbail(); uifcbail();
gettextinfo(&txtinfo); gettextinfo(&txtinfo);
buf=(char *)malloc(txtinfo.screenheight*txtinfo.screenwidth*2); scrollback=(char *)malloc((term.width*2*backlines)+(txtinfo.screenheight*txtinfo.screenwidth*2));
gettext(1,1,txtinfo.screenwidth,txtinfo.screenheight,buf); memcpy(scrollback,cterm.scrollback,term.width*2*backlines);
gettext(1,1,txtinfo.screenwidth,txtinfo.screenheight,scrollback+(cterm.backpos)*cterm.width*2);
drawwin(); drawwin();
top=term.backpos-term.height; top=cterm.backpos;
gotoxy(1,1);
for(i=0;!i;) { for(i=0;!i;) {
if(top<1) if(top<1)
top=1; top=1;
if(top>term.backpos-term.height) if(top>cterm.backpos)
top=term.backpos-term.height; top=cterm.backpos;
puttext(term.x+1,term.y+1,term.x+term.width,term.y+term.height,term.scrollback+(term.width*2*top)); puttext(term.x-1,term.y-1,term.x+term.width-2,term.y+term.height-2,scrollback+(term.width*2*top));
key=getch(); key=getch();
switch(key) { switch(key) {
case 0: case 0:
...@@ -57,21 +62,29 @@ void viewscroll(void) ...@@ -57,21 +62,29 @@ void viewscroll(void)
break; break;
case 'j': case 'j':
case 'J': case 'J':
top--;
break;
case 'k': case 'k':
case 'K': case 'K':
top++;
break;
case 'h': case 'h':
case 'H': case 'H':
top-=term.height;
break;
case 'l': case 'l':
case 'L': case 'L':
top+=term.height;
break;
case ESC: case ESC:
i=1; i=1;
break; break;
} }
} }
puttext(1,1,txtinfo.screenwidth,txtinfo.screenheight,buf); puttext(1,1,txtinfo.screenwidth,txtinfo.screenheight,scrollback+(cterm.backpos)*cterm.width*2);
free(buf); free(scrollback);
gotoxy(x,y);
return; return;
#endif
} }
int syncmenu(void) int syncmenu(void)
......
...@@ -54,7 +54,8 @@ void doterm(void) ...@@ -54,7 +54,8 @@ void doterm(void)
switch(key) { switch(key) {
case 0xff: case 0xff:
case 0: case 0:
switch(key|(getch()<<8)) { key|=getch()<<8;
switch(key) {
case CIO_KEY_MOUSE: case CIO_KEY_MOUSE:
getmouse(&mevent); getmouse(&mevent);
break; break;
...@@ -92,12 +93,9 @@ void doterm(void) ...@@ -92,12 +93,9 @@ void doterm(void)
case CIO_KEY_F(4): case CIO_KEY_F(4):
rlogin_send("\033Ox",3,100); rlogin_send("\033Ox",3,100);
break; break;
#ifdef __unix__ case 0x1f00: /* ALT-S */
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(); viewscroll();
break; break;
#endif
} }
break; break;
case 17: /* CTRL-Q */ case 17: /* CTRL-Q */
......
...@@ -9,6 +9,7 @@ struct terminal { ...@@ -9,6 +9,7 @@ struct terminal {
}; };
extern struct terminal term; extern struct terminal term;
extern int backlines;
void doterm(void); void doterm(void);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment