Example #1
0
CHEWING_API int chewing_handle_Esc( ChewingContext *ctx )
{
	ChewingData *pgdata = ctx->data;
	ChewingOutput *pgo = ctx->output;
	int keystrokeRtn = KEYSTROKE_ABSORB;

	CheckAndResetRange( pgdata );

	if ( ! ChewingIsEntering( pgdata ) ) {
		keystrokeRtn = KEYSTROKE_IGNORE;
	}
	else if ( pgdata->bSelect ) {
		ChoiceEndChoice( pgdata );
	}
	else if ( ZuinIsEntering( &( pgdata->zuinData ) ) ) {
		ZuinRemoveAll( &( pgdata->zuinData ) );
	}
	else if ( pgdata->config.bEscCleanAllBuf ) {
		CleanAllBuf( pgdata );
		pgo->nCommitStr = pgdata->chiSymbolBufLen;
	}

	MakeOutputWithRtn( pgo, pgdata, keystrokeRtn );
	return 0;
}
Example #2
0
File: zuin.c Project: descent/jmcce
int EndKeyProcess(ZuinData *pZuin, int key, int searchTimes)
{
  uint16 u16Pho ;
  Word tempword ;

  if(pZuin->pho_inx[0]==0 && pZuin->pho_inx[1]==0 && pZuin->pho_inx[2]==0)
    return ZUIN_KEY_ERROR ;

  pZuin->pho_inx[3] = Key2PhoneInx(key, 3, pZuin->kbtype, searchTimes) ;
  u16Pho = PhoneInx2Uint(pZuin->pho_inx) ;
  if( GetCharFirst(&tempword, u16Pho)==0 ) {
    ZuinRemoveAll(pZuin);
    return ZUIN_NO_WORD;
  }
  else {
    pZuin->phone = u16Pho;
    memset(pZuin->pho_inx, 0, sizeof(pZuin->pho_inx)) ;
    return ZUIN_COMMIT;
  }
}