`
shappy1978
  • 浏览: 705557 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Add Sequansal Paste Plugin to CLCL

    博客分类:
  • Win8
 
阅读更多
static int past_last(DATA_INFO *di, const TCHAR *q_char)
{
	HANDLE ret;
	BYTE *from_mem, *to_mem;
	TCHAR *p, *r;
	int size;

	// ƒRƒs[Œ³ƒƒbƒN
	if ((from_mem = GlobalLock(di->data)) == NULL) {
		return TOOL_ERROR;
	}

	// ˆø—p•„‚ðœ‹Ž‚µ‚½ƒTƒCƒY‚ðŽæ“¾
	p = (TCHAR *)from_mem;
	if (lstrcmpn(p, q_char, lstrlen(q_char)) == 0) {
		p += lstrlen(q_char);
	}
	size = 0;
	while (*p != TEXT('\0')) {
#ifndef UNICODE
		if (IsDBCSLeadByte((BYTE)*p) == TRUE) {
			p += 2;
			size += 2;
			continue;
		}
#endif
		size++;
		if (*p == TEXT('\n') && *(p + 1) != TEXT('\0')) {
			p++;
			if (lstrcmpn(p, q_char, lstrlen(q_char)) == 0) {
				p += lstrlen(q_char);
			}
		} else {
			p++;
		}
	}
	size++;

	// ƒRƒs[æŠm•Û
	if ((ret = GlobalAlloc(GHND, sizeof(TCHAR) * size)) == NULL) {
		GlobalUnlock(di->data);
		return TOOL_ERROR;
	}
	// ƒRƒs[æƒƒbƒN
	if ((to_mem = GlobalLock(ret)) == NULL) {
		GlobalFree(ret);
		GlobalUnlock(di->data);
		return TOOL_ERROR;
	}

	// ˆø—p•„‚̏œ‹Ž
	p = (TCHAR *)from_mem;
	if (lstrcmpn(p, q_char, lstrlen(q_char)) == 0) {
		p += lstrlen(q_char);
	}
	r = (TCHAR *)to_mem;
	while (*p != TEXT('\0')) {
#ifndef UNICODE
		if (IsDBCSLeadByte((BYTE)*p) == TRUE) {
			*(r++) = *(p++);
			*(r++) = *(p++);
			continue;
		}
#endif
		*(r++) = *p;
		if (*p == TEXT('\n') && *(p + 1) != TEXT('\0')) {
			p++;
			if (lstrcmpn(p, q_char, lstrlen(q_char)) == 0) {
				p += lstrlen(q_char);
			}
		} else {
			p++;
		}
	}
	*r = TEXT('\0');

	GlobalUnlock(ret);
	GlobalUnlock(di->data);

	GlobalFree(di->data);
	di->data = ret;
	di->size = sizeof(TCHAR) * size;
	return TOOL_DATA_MODIFIED;
}

 

1 Add hot key to clear history and remove confirmation

 

2 Add post last item function and set hot key.

 

3 Clear history > ^c > past last

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics