Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[f4750c]: joe / logbuf.c Maximize Restore History

Download this file

logbuf.c    86 lines (69 with data), 1.4 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* Log buffer functions */
#include "types.h"
/* Setup log buffer if it isn't already */
void u_log_setup(BW *bw)
{
B *b = bw->b;
if (!b->hist) {
b->hist = bmk(NULL);
b->hist_p = pdup(b->hist->bof);
}
}
/* Get previous history line */
int u_log_uparw(BW *bw)
{
u_log_setup(bw);
}
/* Get next history line */
int u_log_dnarw(BW *bw)
{
}
/* User hit return */
int u_log_rtn(BW *bw)
{
W *w = bw->parent;
PW *pw = (PW *) bw->object;
unsigned char *s;
W *win;
int *notify;
int (*pfunc) ();
void *object;
long byte;
/* Extract entered text from buffer */
p_goto_eol(bw->cursor);
byte = bw->cursor->byte;
p_goto_bol(bw->cursor);
s = brvs(bw->cursor, (int) (byte - bw->cursor->byte));
/* Save text into history buffer */
if (pw->hist) {
if (bw->b->changed) {
append_history(pw->hist, sv(s));
} else {
promote_history(pw->hist, bw->cursor->line);
}
}
/* Do ~ expansion and set new current directory */
if (pw->file_prompt&2) {
set_current_dir(s,1);
}
if (pw->file_prompt) {
s = canonical(s);
}
win = w->win;
pfunc = pw->pfunc;
object = pw->object;
bwrm(bw);
joe_free(pw->prompt);
joe_free(pw);
w->object = NULL;
notify = w->notify;
w->notify = 0;
wabort(w);
dostaupd = 1;
/* Call callback function */
if (pfunc) {
return pfunc(win->object, s, object, notify);
} else {
return -1;
}
}