Adding scrollback patch
This commit is contained in:
parent
4bd0ed3327
commit
d52c5e4ce8
9 changed files with 302 additions and 3 deletions
38
patch/scrollback.c
Normal file
38
patch/scrollback.c
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
void
|
||||
kscrolldown(const Arg* a)
|
||||
{
|
||||
int n = a->i;
|
||||
|
||||
if (n < 0)
|
||||
n = term.row + n;
|
||||
|
||||
if (n > term.scr)
|
||||
n = term.scr;
|
||||
|
||||
if (term.scr > 0) {
|
||||
term.scr -= n;
|
||||
selscroll(0, -n);
|
||||
tfulldirt();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
kscrollup(const Arg* a)
|
||||
{
|
||||
int n = a->i;
|
||||
if (n < 0)
|
||||
n = term.row + n;
|
||||
|
||||
if (term.scr <= HISTSIZE-n) {
|
||||
term.scr += n;
|
||||
selscroll(0, n);
|
||||
tfulldirt();
|
||||
}
|
||||
}
|
||||
|
||||
#if SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
int tisaltscr(void)
|
||||
{
|
||||
return IS_SET(MODE_ALTSCREEN);
|
||||
}
|
||||
#endif // SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
21
patch/scrollback.h
Normal file
21
patch/scrollback.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - \
|
||||
term.scr + HISTSIZE + 1) % HISTSIZE] : \
|
||||
term.line[(y) - term.scr])
|
||||
|
||||
void kscrolldown(const Arg *);
|
||||
void kscrollup(const Arg *);
|
||||
|
||||
#if SCROLLBACK_MOUSE_PATCH || SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
typedef struct {
|
||||
uint b;
|
||||
uint mask;
|
||||
void (*func)(const Arg *);
|
||||
const Arg arg;
|
||||
} MouseKey;
|
||||
|
||||
extern MouseKey mkeys[];
|
||||
#endif // SCROLLBACK_MOUSE_PATCH / SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
|
||||
#if SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
int tisaltscr(void);
|
||||
#endif // SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
|
|
@ -6,4 +6,8 @@
|
|||
|
||||
#if NEWTERM_PATCH
|
||||
#include "newterm.c"
|
||||
#endif
|
||||
|
||||
#if SCROLLBACK_PATCH || SCROLLBACK_MOUSE_PATCH || SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
#include "scrollback.c"
|
||||
#endif
|
||||
|
|
@ -10,4 +10,8 @@ void xximspot(int, int);
|
|||
|
||||
#if NEWTERM_PATCH
|
||||
#include "newterm.h"
|
||||
#endif
|
||||
|
||||
#if SCROLLBACK_PATCH || SCROLLBACK_MOUSE_PATCH || SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
#include "scrollback.h"
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue