various fixes
This commit is contained in:
parent
9f70f9735c
commit
741bd5e38b
@ -236,6 +236,7 @@ void w_infof(const char* format, ...) {
|
|||||||
void w_progress(int mode, int attr, long pos, long size, const char* title) {
|
void w_progress(int mode, int attr, long pos, long size, const char* title) {
|
||||||
|
|
||||||
static int wh = -1;
|
static int wh = -1;
|
||||||
|
static long prev_pos = 0;
|
||||||
|
|
||||||
int prev_wh = whandle();
|
int prev_wh = whandle();
|
||||||
if(wh != -1)
|
if(wh != -1)
|
||||||
@ -248,17 +249,23 @@ void w_progress(int mode, int attr, long pos, long size, const char* title) {
|
|||||||
wh = wopen_(inforow, ((MAXCOL-63)/2)-1, 3, 63, W_BINFO, C_INFOB, C_INFOW);
|
wh = wopen_(inforow, ((MAXCOL-63)/2)-1, 3, 63, W_BINFO, C_INFOB, C_INFOW);
|
||||||
set_title(title, TCENTER, C_INFOT);
|
set_title(title, TCENTER, C_INFOT);
|
||||||
title_shadow();
|
title_shadow();
|
||||||
|
goto force_update;
|
||||||
}
|
}
|
||||||
case MODE_UPDATE:
|
case MODE_UPDATE:
|
||||||
if(wh == -1)
|
if(wh == -1)
|
||||||
goto oops; // Oops, someone forgot to open the window..
|
goto oops; // Oops, someone forgot to open the window..
|
||||||
|
if((pos*58/size) != (prev_pos*58/size)) {
|
||||||
|
force_update:
|
||||||
wpropbar(PROP_BARGRAPH, 1, 0, -59, 1, attr, pos, size);
|
wpropbar(PROP_BARGRAPH, 1, 0, -59, 1, attr, pos, size);
|
||||||
|
}
|
||||||
|
prev_pos = pos;
|
||||||
break;
|
break;
|
||||||
case MODE_QUIT:
|
case MODE_QUIT:
|
||||||
if(wh != -1) {
|
if(wh != -1) {
|
||||||
wclose();
|
wclose();
|
||||||
wunlink(wh);
|
wunlink(wh);
|
||||||
wh = -1;
|
wh = -1;
|
||||||
|
prev_pos = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1189,7 +1189,7 @@ gkey kbxget_raw(int mode) {
|
|||||||
|
|
||||||
if(alt_pressed)
|
if(alt_pressed)
|
||||||
special_key = is_numpad_key(inp); // Alt-<numpad key>
|
special_key = is_numpad_key(inp); // Alt-<numpad key>
|
||||||
else if(not gkbd_nt and (ascii and not ctrl_pressed) and not (iscntrl(ascii) and shift_pressed))
|
else if(not gkbd_nt and (ascii and not ctrl_pressed) and not (iscntrl(ascii) and shift_pressed) and not (CKS & ENHANCED_KEY))
|
||||||
special_key = true; // It is alphanumeric key under Win9x
|
special_key = true; // It is alphanumeric key under Win9x
|
||||||
if(special_key) {
|
if(special_key) {
|
||||||
ReadConsole(gkbd_hin, &ascii, 1, &nread, NULL);
|
ReadConsole(gkbd_hin, &ascii, 1, &nread, NULL);
|
||||||
|
@ -118,17 +118,26 @@ bool gclipbrd::writeclipbrd(const char* buf) {
|
|||||||
char* gclipbrd::read(char* buffer, int maxlen) {
|
char* gclipbrd::read(char* buffer, int maxlen) {
|
||||||
|
|
||||||
if(len>0) {
|
if(len>0) {
|
||||||
int i = MinV(len, maxlen);
|
int i = MinV(len, maxlen-1);
|
||||||
char* p = strpbrk(clipdata, "\r\n");
|
char* p = strpbrk(clipdata, "\r\n");
|
||||||
if(p and (p-clipdata < i)) {
|
if(p) {
|
||||||
|
if(p-clipdata < i) {
|
||||||
i = p - clipdata;
|
i = p - clipdata;
|
||||||
if(len > i and strchr("\r\n", *(p+1)) and (*p != *(p+1)))
|
if((len > i) and strchr("\r\n", *(p+1)) and (*p != *(p+1)))
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
p = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
p = NULL;
|
||||||
strxcpy(buffer, clipdata, i+1);
|
strxcpy(buffer, clipdata, i+1);
|
||||||
char* p2 = strpbrk(buffer, "\r\n");
|
char* p2 = strpbrk(buffer, "\r\n");
|
||||||
if(p2) *p2 = 0;
|
if(p2) *p2 = 0;
|
||||||
if(p) strcat(buffer, "\n");
|
if(p) {
|
||||||
|
strcat(buffer, "\n");
|
||||||
|
++i;
|
||||||
|
}
|
||||||
len -= MinV(len, i);
|
len -= MinV(len, i);
|
||||||
clipdata += i;
|
clipdata += i;
|
||||||
return buffer;
|
return buffer;
|
||||||
|
Reference in New Issue
Block a user