Commit 2ecf199c authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

Horizontally scroll in larger increments when on the

Linux console because of slow update of unaccelerated fb
parent eb2803ce
...@@ -106,6 +106,8 @@ int CRT_colorScheme = 0; ...@@ -106,6 +106,8 @@ int CRT_colorScheme = 0;
int CRT_colors[LAST_COLORELEMENT] = { 0 }; int CRT_colors[LAST_COLORELEMENT] = { 0 };
char* CRT_termType;
// TODO: pass an instance of Settings instead. // TODO: pass an instance of Settings instead.
void CRT_init(int delay, int colorScheme) { void CRT_init(int delay, int colorScheme) {
...@@ -124,8 +126,8 @@ void CRT_init(int delay, int colorScheme) { ...@@ -124,8 +126,8 @@ void CRT_init(int delay, int colorScheme) {
} else { } else {
CRT_hasColors = false; CRT_hasColors = false;
} }
char* termType = getenv("TERM"); CRT_termType = getenv("TERM");
if (String_eq(termType, "xterm") || String_eq(termType, "xterm-color") || String_eq(termType, "vt220")) { if (String_eq(CRT_termType, "xterm") || String_eq(CRT_termType, "xterm-color") || String_eq(CRT_termType, "vt220")) {
define_key("\033[H", KEY_HOME); define_key("\033[H", KEY_HOME);
define_key("\033[F", KEY_END); define_key("\033[F", KEY_END);
define_key("\033OP", KEY_F(1)); define_key("\033OP", KEY_F(1));
......
...@@ -107,6 +107,8 @@ extern int CRT_colorScheme; ...@@ -107,6 +107,8 @@ extern int CRT_colorScheme;
extern int CRT_colors[LAST_COLORELEMENT]; extern int CRT_colors[LAST_COLORELEMENT];
char* CRT_termType;
// TODO: pass an instance of Settings instead. // TODO: pass an instance of Settings instead.
void CRT_init(int delay, int colorScheme); void CRT_init(int delay, int colorScheme);
......
...@@ -11,6 +11,8 @@ What's new in version 0.6.3 ...@@ -11,6 +11,8 @@ What's new in version 0.6.3
ListBox (and related classes) to Panel. ListBox (and related classes) to Panel.
* Have configure actually fail when needed libraries or * Have configure actually fail when needed libraries or
headers are not found. headers are not found.
* Horizontally scroll in larger increments when on the
Linux console because of slow update of unaccelerated fb
What's new in version 0.6.2 What's new in version 0.6.2
......
...@@ -40,6 +40,7 @@ struct Panel_ { ...@@ -40,6 +40,7 @@ struct Panel_ {
Vector* items; Vector* items;
int selected; int selected;
int scrollV, scrollH; int scrollV, scrollH;
int scrollHAmount;
int oldSelected; int oldSelected;
bool needsRedraw; bool needsRedraw;
RichString header; RichString header;
...@@ -92,6 +93,10 @@ void Panel_init(Panel* this, int x, int y, int w, int h, char* type, bool owner) ...@@ -92,6 +93,10 @@ void Panel_init(Panel* this, int x, int y, int w, int h, char* type, bool owner)
this->oldSelected = 0; this->oldSelected = 0;
this->needsRedraw = true; this->needsRedraw = true;
this->header.len = 0; this->header.len = 0;
if (String_eq(CRT_termType, "linux"))
this->scrollHAmount = 40;
else
this->scrollHAmount = 5;
} }
void Panel_done(Panel* this) { void Panel_done(Panel* this) {
...@@ -327,12 +332,12 @@ void Panel_onKey(Panel* this, int key) { ...@@ -327,12 +332,12 @@ void Panel_onKey(Panel* this, int key) {
break; break;
case KEY_LEFT: case KEY_LEFT:
if (this->scrollH > 0) { if (this->scrollH > 0) {
this->scrollH -= 5; this->scrollH -= this->scrollHAmount;
this->needsRedraw = true; this->needsRedraw = true;
} }
break; break;
case KEY_RIGHT: case KEY_RIGHT:
this->scrollH += 5; this->scrollH += this->scrollHAmount;
this->needsRedraw = true; this->needsRedraw = true;
break; break;
case KEY_PPAGE: case KEY_PPAGE:
......
...@@ -13,6 +13,7 @@ in the source distribution for its full text. ...@@ -13,6 +13,7 @@ in the source distribution for its full text.
#include "Vector.h" #include "Vector.h"
#include "CRT.h" #include "CRT.h"
#include "RichString.h" #include "RichString.h"
#include "ListItem.h"
#include <math.h> #include <math.h>
#include <stdbool.h> #include <stdbool.h>
...@@ -41,6 +42,7 @@ struct Panel_ { ...@@ -41,6 +42,7 @@ struct Panel_ {
Vector* items; Vector* items;
int selected; int selected;
int scrollV, scrollH; int scrollV, scrollH;
int scrollHAmount;
int oldSelected; int oldSelected;
bool needsRedraw; bool needsRedraw;
RichString header; RichString header;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment