pagin fixed

This commit is contained in:
anon 2023-08-11 23:31:25 +02:00
parent 3c2fd1c829
commit ad71c1f4cd
6 changed files with 20 additions and 34 deletions

View File

@ -84,6 +84,7 @@ fixing it would have been a lost cause, if not for Cscope itself. Well, Csope no
+ library.h...; "private library", in a program using 90 globals; ffs + library.h...; "private library", in a program using 90 globals; ffs
+ sort out the global hell + sort out the global hell
+ was there really ever a scrollbar? + was there really ever a scrollbar?
+ handle resizing
## Original ## Original
+ Same capabilities as interactive in non interactive (one shot) mode + Same capabilities as interactive in non interactive (one shot) mode
+ Provide some how-do-I-use-this-thing doc. + Provide some how-do-I-use-this-thing doc.

View File

@ -207,9 +207,7 @@ extern char* rl_line_buffer;
extern char input_line[PATLEN + 1]; extern char input_line[PATLEN + 1];
extern int rl_point; extern int rl_point;
#if UNIXPC //extern bool unixpcmouse; /* UNIX PC mouse interface */
extern bool unixpcmouse; /* UNIX PC mouse interface */
#endif
/* cscope functions called from more than one function or between files */ /* cscope functions called from more than one function or between files */
@ -249,7 +247,7 @@ int process_mouse();
extern int input_mode; extern int input_mode;
int changestring(const char* from, const char* to, const bool *const change, const int change_len); int changestring(const char* from, const char* to, const bool *const change, const int change_len);
long seekpage(size_t i); long seekpage(const size_t i);
long seekrelline(unsigned i); long seekrelline(unsigned i);
void PCS_reset(void); void PCS_reset(void);

View File

@ -114,22 +114,14 @@ mygetline(char p[], char s[], unsigned size, int firstchar, bool iscaseless){
s[i++] = sright[--ri]; s[i++] = sright[--ri];
addch(s[i-1]); addch(s[i-1]);
} }
} else if ( } else if (c == KEY_HOME || c == ctrl('A') ) {
#ifdef KEY_HOME
c == KEY_HOME ||
#endif
c == ctrl('A') ) {
while (i > 0) { while (i > 0) {
sright[ri++] = s[--i]; sright[ri++] = s[--i];
addch('\b'); addch('\b');
addch(s[i]); addch(s[i]);
addch('\b'); addch('\b');
} }
} else if ( } else if (c == KEY_END || c == ctrl('E') ) {
#ifdef KEY_END
c == KEY_END ||
#endif
c == ctrl('E') ) {
while (ri > 0) { while (ri > 0) {
s[i++] = sright[--ri]; s[i++] = sright[--ri];
addch(s[i-1]); addch(s[i-1]);
@ -174,10 +166,8 @@ mygetline(char p[], char s[], unsigned size, int firstchar, bool iscaseless){
addch(c); /* advance cursor */ addch(c); /* advance cursor */
} }
} }
#if UNIXPC } else if (/*unixpcmouse == true && */c == ESC) { /* mouse */
} else if (unixpcmouse == true && c == ESC) { /* mouse */
getmouseaction(ESC); /* ignore it */ getmouseaction(ESC); /* ignore it */
#endif
} else if (mouse == true && c == ctrl('X')) { } else if (mouse == true && c == ctrl('X')) {
getmouseaction(ctrl('X')); /* ignore it */ getmouseaction(ctrl('X')); /* ignore it */
} else if (c == EOF) { /* end-of-file */ } else if (c == EOF) { /* end-of-file */
@ -392,21 +382,10 @@ global_input(const int c){
case KEY_PPAGE: case KEY_PPAGE:
if (totallines == 0) { return 0; } /* don't redisplay if there are no lines */ if (totallines == 0) { return 0; } /* don't redisplay if there are no lines */
curdispline = 0; curdispline = 0;
--current_page; if(current_page > 0){
///* if on first page but not at beginning, go to beginning */ --current_page;
//nextline -= mdisprefs; /* already at next page */ window_change |= CH_RESULT;
//if (nextline > 1 && nextline <= mdisprefs) { }
// nextline = 1;
//} else {
// nextline -= mdisprefs;
// if (nextline < 1) {
// nextline = totallines - mdisprefs + 1;
// if (nextline < 1) {
// nextline = 1;
// }
// }
//}
//seekline(nextline);
break; break;
case '>': /* write or append the lines to a file */ case '>': /* write or append the lines to a file */
break; // XXX break; // XXX

View File

@ -44,6 +44,9 @@
#ifndef KEY_RESIZE #ifndef KEY_RESIZE
# define KEY_RESIZE KEY_UNDEF_BASE-11 # define KEY_RESIZE KEY_UNDEF_BASE-11
#endif #endif
#ifndef KEY_END
# define KEY_END KEY_UNDEF_BASE-12
#endif
/* Always define these keys */ /* Always define these keys */
#ifndef ESC #ifndef ESC

View File

@ -9,9 +9,14 @@ static FILE** hto_page = &refsfound;
static size_t PCS_pos[PCS_MAXPAGE] = {0}; static size_t PCS_pos[PCS_MAXPAGE] = {0};
static size_t PCS_top = 0; static size_t PCS_top = 0;
long seekpage(size_t i){ long seekpage(const size_t i){
if(i > PCS_MAXPAGE-1){ return -1; } if(i > PCS_MAXPAGE-1){ return -1; }
if(i < PCS_top){
fseek(*hto_page, PCS_pos[i], SEEK_SET);
return PCS_pos[i];
}
fseek(*hto_page, PCS_pos[PCS_top], SEEK_SET); fseek(*hto_page, PCS_pos[PCS_top], SEEK_SET);
size_t lc = 0; size_t lc = 0;

View File

@ -81,7 +81,7 @@ vpinit(char *current_dir)
} }
/* if not given, get the current directory name */ /* if not given, get the current directory name */
if (current_dir == NULL && (current_dir = getcwd(buf, MAXPATH)) == NULL) { if (current_dir == NULL && (current_dir = getcwd(buf, MAXPATH)) == NULL) {
(void) fprintf(stderr, PROGRAM_NAME ": cannot get current directory name\n"); fprintf(stderr, PROGRAM_NAME ": cannot get current directory name\n");
return; return;
} }
/* see if this directory is in the first view path node */ /* see if this directory is in the first view path node */