proper resizing

This commit is contained in:
anon 2023-08-27 18:59:47 +02:00
parent cad9125837
commit faec45bcfa
6 changed files with 84 additions and 15 deletions

View File

@ -135,3 +135,55 @@ frame 1
p wtooltip p wtooltip
r r
p tooltip_width p tooltip_width
b redisplay
where
l
s
where
s
n
c
c
b redisplay
c
n
where
l
c
b redisplay
c
n
n
where
finish
finish
finish
s
p c
n
b redisplay
c
n
finish
finish
finish
s
n
s
n
p EOF
c
where
frame 11
until
where
frame 9
n
frame 9
finish
where
n
s
n
s
n

View File

@ -106,12 +106,11 @@ All can be configured sucklessly under "config/colors.h". Hopefully the comments
| int window_change | Bit mask type of the CH_\* macros. Keeps track of the windows to be refresed on the next run of display(). Could be better utalized. | int window_change | Bit mask type of the CH_\* macros. Keeps track of the windows to be refresed on the next run of display(). Could be better utalized.
# TODO /*move soon*/ # TODO /*move soon*/
1. create a step in the mean loop where the cursor us forced into the right window based on mode + sort out the global hell
+ sort out constants.h + sort out constants.h
+ scrollbar() uses magic int literals?
+ lineflagafterfile is stupid + lineflagafterfile is stupid
+ 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 + scrollbar() uses magic int literals?
+ was there really ever a scrollbar? + was there really ever a scrollbar?
+ handle resizing + handle resizing
+ a search struct could be great for caching and could ease the global situation + a search struct could be great for caching and could ease the global situation

View File

@ -854,3 +854,20 @@ void display(void) {
window_change = CH_NONE; window_change = CH_NONE;
} }
void redisplay(void) {
delwin(winput);
delwin(wmode);
delwin(wresult);
delwin(whelp );
delwin(wtooltip);
delwin(wcase);
endwin();
dispinit();
window_change = CH_ALL;
display();
}

View File

@ -265,6 +265,7 @@ void countrefs(void);
void crossref(char *srcfile); void crossref(char *srcfile);
void dispinit(void); void dispinit(void);
void display(void); void display(void);
void redisplay(void);
void drawscrollbar(int top, int bot); void drawscrollbar(int top, int bot);
void edit(char *file, const char *const linenum); void edit(char *file, const char *const linenum);
void editall(void); void editall(void);

View File

@ -328,9 +328,6 @@ static int global_input(const int c) {
execute(shell, shell, NULL); execute(shell, shell, NULL);
current_page = 0; current_page = 0;
break; break;
case KEY_RESIZE:
/* XXX: fill in*/
break;
case ctrl('U'): /* redraw screen */ case ctrl('U'): /* redraw screen */
case KEY_CLEAR: case KEY_CLEAR:
window_change = CH_ALL; window_change = CH_ALL;
@ -505,6 +502,17 @@ int handle_input(const int c) {
do_press_any_key = false; do_press_any_key = false;
return 0; return 0;
} }
/* - Resize - */
/* it's treated specially because curses treat it specially.
as far as i can tell this is the only key that does not
flush after itself.
*/
if(c == KEY_RESIZE) {
redisplay();
flushinp();
return 0;
}
/* --- global --- */ /* --- global --- */
const int r = global_input(c); const int r = global_input(c);
if(r) { return 0; } if(r) { return 0; }

View File

@ -105,15 +105,7 @@ static inline void readenv(void);
static inline void linemode_event_loop(void); static inline void linemode_event_loop(void);
static inline void screenmode_event_loop(void); static inline void screenmode_event_loop(void);
#if defined(KEY_RESIZE) && !defined(__DJGPP__)
void sigwinch_handler(int sig, siginfo_t *info, void *unused) {
UNUSED(sig);
UNUSED(info);
UNUSED(unused);
if(incurses == true) { ungetch(KEY_RESIZE); }
}
#endif
static inline void siginit(void) { static inline void siginit(void) {
/* if running in the foreground */ /* if running in the foreground */
@ -134,7 +126,7 @@ static inline void siginit(void) {
*/ */
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
if(linemode == false) { signal(SIGWINCH, sigwinch_handler); } //if(linemode == false) { signal(SIGWINCH, redisplay); }
} }
void cannotopen(const char *const file) { void cannotopen(const char *const file) {