various fixes

This commit is contained in:
Alexander S. Aganichev 2001-02-01 11:29:10 +00:00
parent 9f70f9735c
commit 741bd5e38b
3 changed files with 24 additions and 8 deletions

View File

@ -236,6 +236,7 @@ void w_infof(const char* format, ...) {
void w_progress(int mode, int attr, long pos, long size, const char* title) {
static int wh = -1;
static long prev_pos = 0;
int prev_wh = whandle();
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);
set_title(title, TCENTER, C_INFOT);
title_shadow();
goto force_update;
}
case MODE_UPDATE:
if(wh == -1)
goto oops; // Oops, someone forgot to open the window..
wpropbar(PROP_BARGRAPH, 1, 0, -59, 1, attr, pos, size);
if((pos*58/size) != (prev_pos*58/size)) {
force_update:
wpropbar(PROP_BARGRAPH, 1, 0, -59, 1, attr, pos, size);
}
prev_pos = pos;
break;
case MODE_QUIT:
if(wh != -1) {
wclose();
wunlink(wh);
wh = -1;
prev_pos = 0;
}
break;
}

View File

@ -1189,7 +1189,7 @@ gkey kbxget_raw(int mode) {
if(alt_pressed)
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
if(special_key) {
ReadConsole(gkbd_hin, &ascii, 1, &nread, NULL);

View File

@ -118,17 +118,26 @@ bool gclipbrd::writeclipbrd(const char* buf) {
char* gclipbrd::read(char* buffer, int maxlen) {
if(len>0) {
int i = MinV(len, maxlen);
int i = MinV(len, maxlen-1);
char* p = strpbrk(clipdata, "\r\n");
if(p and (p-clipdata < i)) {
i = p - clipdata;
if(len > i and strchr("\r\n", *(p+1)) and (*p != *(p+1)))
++i;
if(p) {
if(p-clipdata < i) {
i = p - clipdata;
if((len > i) and strchr("\r\n", *(p+1)) and (*p != *(p+1)))
++i;
}
else
p = NULL;
}
else
p = NULL;
strxcpy(buffer, clipdata, i+1);
char* p2 = strpbrk(buffer, "\r\n");
if(p2) *p2 = 0;
if(p) strcat(buffer, "\n");
if(p) {
strcat(buffer, "\n");
++i;
}
len -= MinV(len, i);
clipdata += i;
return buffer;