Beispiel #1
0
void android_clip_request_selection (VimClipboard *cbd)
{
    jstring text = (jstring) global_env->CallStaticObjectMethod(class_Exec, method_Exec_getClipText);
    char* clip_text = text?(char*)global_env->GetStringUTFChars(text, NULL):NULL;
    int clip_length = clip_text?strlen(clip_text):0;
    if(clip_text && clip_length > 0)clip_yank_selection( MLINE, (char_u*)clip_text, clip_length, cbd );
}
Beispiel #2
0
/**
 * Get selection from clipboard
 *
 */
void
clip_mch_request_selection(VimClipboard *cbd)
{
	QClipboard *clip = QApplication::clipboard();
	if ( clip->text((QClipboard::Mode)cbd->clipboardMode).size() == 0 ) {
		return;
	}

	QByteArray text = VimWrapper::convertTo(clip->text( (QClipboard::Mode)cbd->clipboardMode));

	if ( text.isEmpty() ) {
		// This should not happen, but if it does vim
		// behaves badly so lets be extra carefull
		return;
	}

	char_u	*buffer;
	buffer = lalloc( text.size(), TRUE);
	if (buffer == NULL)
		return;

	for (int i = 0; i < text.size(); ++i) {
		buffer[i] = text[i];
	}

	clip_yank_selection(MAUTO, buffer, text.size(), cbd);
	vim_free(buffer);
}
Beispiel #3
0
void
clip_mch_request_selection(VimClipboard *cbd)
{
    int		    type = MLINE, clip_length = 0, is_type_set = FALSE;
    void	    *cbdata;
    PhClipHeader    *clip_header;
    char_u	    *clip_text = NULL;

    cbdata = PhClipboardPasteStart(PhInputGroup(NULL));
    if (cbdata != NULL)
    {
	/* Look for the vim specific clip first */
	clip_header = PhClipboardPasteType(cbdata, CLIP_TYPE_VIM);
	if (clip_header != NULL && clip_header->data != NULL)
	{
	    switch(*(char *) clip_header->data)
	    {
		default: /* fallthrough to line type */
		case 'L': type = MLINE; break;
		case 'C': type = MCHAR; break;
		case 'B': type = MBLOCK; break;
	    }
	    is_type_set = TRUE;
	}

	/* Try for just normal text */
	clip_header = PhClipboardPasteType(cbdata, CLIP_TYPE_TEXT);
	if (clip_header != NULL)
	{
	    clip_text = clip_header->data;
	    clip_length  = clip_header->length - 1;

	    if (clip_text != NULL && is_type_set == FALSE)
		type = MAUTO;
	}

	if ((clip_text != NULL) && (clip_length > 0))
	{
	    clip_yank_selection(type, clip_text, clip_length, cbd);
	}

	PhClipboardPasteFinish(cbdata);
    }
}
Beispiel #4
0
/**
 * Get selection from clipboard
 *
 */
void
clip_mch_request_selection(VimClipboard *cbd)
{

	QClipboard *clip = QApplication::clipboard();
	QByteArray text = VimWrapper::convertTo(clip->text( (QClipboard::Mode)cbd->clipboardMode));

	char_u	*buffer;
	buffer = lalloc( text.size(), TRUE);
	if (buffer == NULL)
		return;

	for (int i = 0; i < text.size(); ++i) {
		buffer[i] = text[i];
	}

	clip_yank_selection(MCHAR, buffer, text.size(), cbd);
	vim_free(buffer);
}