Esempio n. 1
0
bool GUI_TextField::HandleEvent(const char *action)
{
    if (!strcmp(action, "accept")) {
        GUI_Page *page = GetPage();
        if (page) {
            page->UpdateFocusWidget(1);
            page->DecRef();
        }
        return true;
    } else
    if (!strcmp(action, "prev")) {
        SetCursorPos(GetCursorPos() - 1);
        InputDigit(-1);
        return true;
    } else
    if (!strcmp(action, "next")) {
        SetCursorPos(GetCursorPos() + 1);
        InputDigit(-1);
        return true;
    } else
    if ((GetFlags() & WIDGET_FOCUSED &&
         (!strcmp(action, "stop") ||
          !strcmp(action, "cancel"))) ||
        !strcmp(action, "clear") ||
        !strcmp(action, "backspace")) {
        Backspace();
        InputDigit(-1);
        return true;
    } else
    if (!strcmp(action, "delete")) {
        DeleteCurrChar();
        InputDigit(-1);
        return true;
    } else
    if (!strcmp(action, "home") ||
        !strcmp(action, "first")) {
        SetCursorPos(0);
        InputDigit(-1);
        return true;
    } else
    if (!strcmp(action, "end") ||
        !strcmp(action, "last")) {
        SetCursorPos(GetTextLength());
        InputDigit(-1);
        return true;
    } else
    if (!strncmp(action, "key", 3) &&
        strlen(action) == 4) {
        SendChar(action[3], true);
        InputDigit(-1);
        return true;
    } else
    if (!strncmp(action, "number", 6) &&
        strlen(action) == 7 &&
        isdigit(action[6])) {
        InputDigit(atoi(action + 6));
        return true;
    }
    return GUI_Widget::HandleEvent(action);
}
Esempio n. 2
0
	//----------------------------------------------------------------------------
	void Write(Real x, Real y, Real z, unsigned int color,
		const char *text, int count, FONT_ALIGN mode)
	{
		if (!mInitialized)
			return;
		auto& renderer = Renderer::GetInstance();
		if (renderer.GetRendererOptions()->r_noText)
			return;

		//
		if (count < 0)
			count = GetTextLength(text);

		if (mode == FONT_ALIGN_CENTER)
		{
			Real w = GetTextWidth(text, count);
			x -= w / 2;
		}
		else if (mode == FONT_ALIGN_RIGHT)
		{
			Real w = GetTextWidth(text, count);
			x -= w;
		}

		mColor = color;

		renderer.UpdateObjectConstantsBuffer(&mObjectConstants);

		InternalWrite(Round(x), Round(y), z, text, count);
	}
/*
================
CSyntaxRichEditCtrl::BracedSectionEnd
================
*/
bool CSyntaxRichEditCtrl::BracedSectionEnd(char braceStartChar, char braceEndChar)
{
	long selStart, selEnd;
	int brace, i;
	idStr text;

	GetSel(selStart, selEnd);
	GetText(text, 0, GetTextLength());

	for (brace = 1, i = Min(selStart-2, (long)text.Length()-1); i >= 0; i--) {
		if (text[i] == braceStartChar) {
			brace--;

			if (brace == 0) {
				break;
			}
		} else if (text[i] == braceEndChar) {
			brace++;
		}
	}

	if (brace == 0) {
		bracedSection[0] = i;
		bracedSection[1] = selStart - 1;
		BracedSectionAdjustEndTabs();
		BracedSectionShow();
	}

	return (brace == 0);
}
/*
================
CSyntaxRichEditCtrl::BracedSectionStart
================
*/
bool CSyntaxRichEditCtrl::BracedSectionStart(char braceStartChar, char braceEndChar)
{
	long selStart, selEnd;
	int brace, i;
	idStr text;

	GetSel(selStart, selEnd);
	GetText(text, 0, GetTextLength());

	for (brace = 1, i = selStart; i < text.Length(); i++) {
		if (text[i] == braceStartChar) {
			brace++;
		} else if (text[i] == braceEndChar) {
			brace--;

			if (brace == 0) {
				break;
			}
		}
	}

	if (brace == 0) {
		bracedSection[0] = selStart - 1;
		bracedSection[1] = i;
		BracedSectionShow();
	}

	return (brace == 0);
}
Esempio n. 5
0
void Key_GetWord(uint8 KeyValue,char *D,uint8 InType)
{
  uint8 Index,Length;
	char CodeBuf[200],*Data=D;
	BufferFill(&CodeBuf[0],0,sizeof(CodeBuf));
	if(InType&IT_Dot)StringEndingAppend(".",&CodeBuf[0]);
	if(InType&IT_Minus)StringEndingAppend("-",&CodeBuf[0]);
	if(InType&IT_Num)StringEndingAppend("0123456789",&CodeBuf[0]);
	if(InType&IT_ASCIIS)StringEndingAppend("abcdefghijklmnopqrstuvwxyz",&CodeBuf[0]);
	if(InType&IT_ASCIIB)StringEndingAppend("ABCDEFGHIJKLMNOPQRSTUVWXYZ",&CodeBuf[0]);
	if(InType&IT_CurCLiB)StringEndingAppend((void *)(Tos_GetFontHandle()->P_CIndex),&CodeBuf[0]);
	Length=GetTextLength(&CodeBuf[0]);
	Length++;
	Index=Index_Word(CodeBuf,Data,Length);
	if(Index==0xff)Index=0;
	 if(KeyValue==Key_Up)
   {
		  if(CodeBuf[Index]<0x80)Index++;else Index+=2;if(Index>=Length)Index=0;
       if(CodeBuf[Index]<0x80){*Data=CodeBuf[Index];}else {*(uint16 *)Data=*(uint16 *)&CodeBuf[Index];}
	 }
	  if(KeyValue==Key_Down)
   {
		   if(CodeBuf[Index-2]<0x80)Index--;else Index-=2;if(Index==0xff)Index=(Length);
       if(CodeBuf[Index]<0x80){*Data=CodeBuf[Index];}else {*(uint16 *)Data=*(uint16 *)&CodeBuf[Index];} 
	 }
	 Index=Index_Word(CodeBuf,Data,Length);
	 if(Index==0xff)Index=0;
}
Esempio n. 6
0
void Key_GetASCII(uint8 KeyValue,uint8 *Data,uint8 InType)
{
  uint8 Index,Length;
	char CodeBuf[200];
	BufferFill(&CodeBuf[0],0,sizeof(CodeBuf));
	if(InType&IT_Dot)StringEndingAppend(".",&CodeBuf[0]);
	if(InType&IT_Minus)StringEndingAppend("-",&CodeBuf[0]);
	if(InType&IT_Num)StringEndingAppend("0123456789",&CodeBuf[0]);
	if(InType&IT_ASCIIS)StringEndingAppend("abcdefghijklmnopqrstuvwxyz",&CodeBuf[0]);
	if(InType&IT_ASCIIB)StringEndingAppend("ABCDEFGHIJKLMNOPQRSTUVWXYZ",&CodeBuf[0]);
	if(InType&IT_CurCLiB)StringEndingAppend((void *)(Tos_GetFontHandle()->P_CIndex),&CodeBuf[0]);
	if(InType&IT_End)StringEndingAppend("\r\n",&CodeBuf[0]);
	StringEndingAppend("\n",&CodeBuf[0]);
	Length=GetTextLength(&CodeBuf[0]);
   if(KeyValue==Key_Up)
   {
       Index=Index_Uchar(CodeBuf,*Data);
				Index++;
       if(Index>=(Length-1))Index=0;       
       *Data=CodeBuf[Index];
	 }
	  if(KeyValue==Key_Down)
   {
       Index=Index_Uchar(CodeBuf,*Data);
		   if(Index==0)Index=(Length-1);
       Index--;
       *Data=CodeBuf[Index];
	 }
}
/*
================
CSyntaxRichEditCtrl::GetNameForMousePosition
================
*/
bool CSyntaxRichEditCtrl::GetNameForMousePosition(idStr &name) const
{
	int charIndex, startCharIndex, endCharIndex, type;
	idStr text;

	charIndex = CharFromPos(mousePoint);

	for (startCharIndex = charIndex; startCharIndex > 0; startCharIndex--) {
		GetText(text, startCharIndex - 1, startCharIndex);
		type = charType[text[0]];

		if (type != CT_NAME && type != CT_NUMBER) {
			break;
		}
	}

	for (endCharIndex = charIndex; endCharIndex < GetTextLength(); endCharIndex++) {
		GetText(text, endCharIndex, endCharIndex + 1);
		type = charType[text[0]];

		if (type != CT_NAME && type != CT_NUMBER) {
			break;
		}
	}

	GetText(name, startCharIndex, endCharIndex);

	return (endCharIndex > startCharIndex);
}
Esempio n. 8
0
LONG CRchTxtPtr::GetCchLeftRunPF() 
{
	TRACEBEGIN(TRCSUBSYSBACK, TRCSCOPEINTERN, "CRchTxtPtr::GetCchLeftRunPF");

	return _rpPF.IsValid()
		? _rpPF.GetCchLeft() : GetTextLength() - GetCp();
}
Esempio n. 9
0
LONG AwtTextComponent::getWin32SelPos(LONG orgPos)
{
    long wlen;
    long pos = 0;
    long cur = 0;
    LPTSTR wbuf;

    if ((wlen = GetTextLength()) == 0)
       return 0;
    wbuf = new TCHAR[wlen + 1];
    GetText(wbuf, wlen + 1);
    if (m_isLFonly == TRUE) {
        RemoveCR(wbuf);
    }

    while (cur < orgPos && pos < wlen) {
        if (wbuf[pos] == _T('\r') && wbuf[pos + 1] == _T('\n')) {
            pos++;
        }
        pos++;
        cur++;
    }
    delete[] wbuf;
    return pos;
}
Esempio n. 10
0
void AwtTextComponent::CheckLineSeparator(WCHAR *pStr)
{
    if (pStr == NULL) {
        return;
    }

    if (GetTextLength() == 0) {
        m_EOLchecked = FALSE;
    }

    // check to see if there are any LF's
    if (m_EOLchecked == TRUE || wcschr(pStr, L'\n') == NULL) {
        return;
    }

    for (int i=0; pStr[i] != 0; i++) {
        if (pStr[i] == L'\n') {
            if (i > 0 && pStr[i-1] == L'\r') {
                m_isLFonly = FALSE;
            } else {
                m_isLFonly = TRUE;
            }
            m_EOLchecked = TRUE;
            return;
        }
    }
}
Esempio n. 11
0
void GUITextBox::OnKeyDown(UCHAR key)
{
	SetShift(keys[VK_SHIFT]);

	if(GetText())
	{
		if((IsAlpabetic(key) || key == VK_SPACE) &&
			GetTextLength() < GetMaxTextLength())
		{
			char* new_text = new char[strlen(GetText())+2];
			if(GetShift())
				sprintf(new_text, "%s%c\0", GetText(), key);
			else
				sprintf(new_text, "%s%c\0", GetText(), tolower(key));

			try
			{
				delete[] GetText();
			}
			catch(...)
			{
				WriteToLog("Exception in GUITextBox::OnKeyDown()");
			}
			SetText(new_text);
			SetTextLength(strlen(GetText()));
		}
		else if(key == VK_BACK)
		{
			UINT len = strlen(GetText());
			if(len > 0)
			{
				string s = string(GetText());
				char* new_text = new char[len];

				sprintf(new_text, "%s\0", s.substr(0, s.length()-1).c_str());
				

				try
				{
					delete[] GetText();
				}
				catch(...)
				{
					WriteToLog("Exception in GUITextBox::OnKeyDown()");
				}
				SetText(new_text);
				SetTextLength(strlen(GetText()));
			}
		}
	}
	else
	{
		char* new_text = new char[1];
		if(GetShift())
			new_text[0] = key;
		else
			new_text[0] = tolower(key);
		SetText(new_text);
	}
}
void CTextEditor::Render(HDC hdc, const LOGFONT *plf)
{
    HFONT hFont = CreateFontIndirect(plf);

    if (hFont)
    {
        HFONT hFontOrg = (HFONT)SelectObject(hdc, hFont);

        _layout.Layout(hdc, GetTextBuffer(), GetTextLength());
        _layout.Render(hdc, GetTextBuffer(), GetTextLength(), _nSelStart, _nSelEnd,
                       _nCompStart, _nCompEnd,
                       _prgAttr, _lAttr, _prgClauseInfo, _lClauseInfo);

        SelectObject(hdc, hFontOrg);
        DeleteObject(hFont);
    }
}
Esempio n. 13
0
/*******************************************************************************
Func:菜单项回传
Date:2016-3-25
Note:
*******************************************************************************/
uint8 COM_Menu_Load(uint8 Index,uint8 *Menu)
{
	uint8 Length;
	if(Index>=Menu_OptionLength(MenuList))return 0;
	MUI_GetOptionString((char *)Menu,&MenuList[Index]);
	Length=GetTextLength(Menu);
	return Length;
}
Esempio n. 14
0
int GUI_TextField::OnGotFocus(void)
{
    if (!GUI_Widget::OnGotFocus()) {
        return 0;
    }
    SetCursorPos(GetTextLength());
    return 1;
}
Esempio n. 15
0
NS_IMETHODIMP
HTMLTextAreaElement::GetTextLength(int32_t *aTextLength)
{
  NS_ENSURE_ARG_POINTER(aTextLength);
  *aTextLength = GetTextLength();

  return NS_OK;
}
Esempio n. 16
0
bool wxTextDataObject::GetDataHere(void *buf) const
{
    // NOTE: use wxTmemcpy() instead of wxStrncpy() to allow
    //       retrieval of strings with embedded NULLs
    wxTmemcpy( (wxChar*)buf, GetText().c_str(), GetTextLength() );

    return true;
}
Esempio n. 17
0
//右键消息
VOID CRichEditTrace::OnRButtonDown(UINT nFlags, CPoint point)
{
	CMenu menu;
	ClientToScreen(&point);

	menu.CreatePopupMenu();

	CHARRANGE sl;
	GetSel(sl);
	menu.AppendMenu(MF_STRING | (sl.cpMax != sl.cpMin) ? 0 : MF_DISABLED | MF_GRAYED, IDM_MENU0, "复制(&C)\tCtrl+C");
	menu.AppendMenu(MF_STRING | (GetTextLength() > 0 && sl.cpMax - sl.cpMin < GetTextLength()) ? 0 : MF_DISABLED | MF_GRAYED, IDM_MENU1, "全选(&A)\tCtrl+A");
	menu.AppendMenu(MF_STRING | (false) ? 0 : MF_DISABLED | MF_GRAYED, IDM_MENU2, "删除(&D)");
	menu.AppendMenu(MF_STRING | (GetTextLength() > 0) ? 0 : MF_DISABLED | MF_GRAYED, IDM_MENU3, "清除信息");
	menu.AppendMenu(MF_SEPARATOR, 0);
	menu.AppendMenu(MF_STRING | (GetTextLength() > 0) ? 0 : MF_DISABLED | MF_GRAYED, IDM_MENU4, "保存信息...");

	TrackPopupMenu(menu.m_hMenu, nFlags, point.x, point.y, 0, m_hWnd, NULL);
}
Esempio n. 18
0
int SciEdit::GetText(LPTSTR szText)
{
	if (szText == NULL)
		return 0;
	*szText = '\0';
	long lLen = GetTextLength();
	Call(SCI_GETTEXT, lLen+1, (LPARAM)szText);
	return lLen;
}
Esempio n. 19
0
bool SearchableEditor::find(bool newSearch)
{
    if (!fd)
        fd = new FindDialog(this, ::wxGetTopLevelParent(this));
    if (newSearch || findTextM.empty())
    {
        if (newSearch)
        {
            // find selected text
            wxString findText(GetSelectedText());
            // failing that initialize with the word at the caret
            if (findText.empty())
            {
                int pos = GetCurrentPos();
                int start = WordStartPosition(pos, true);
                int end = WordEndPosition(pos, true);
                if (end > start)
                    findText = GetTextRange(start, end);
            }
            fd->SetFindText(findText);
        }

        // do not re-center dialog if it is already visible
        if (!fd->IsShown())
            fd->Show();
        fd->SetFocus();
        return false;    // <- caller shouldn't care about this
    }

    int start = GetSelectionEnd();
    if (findFlagsM.has(se::FROM_TOP))
    {
        start = 0;
        findFlagsM.remove(se::ALERT);    // remove flag after first find
    }

    int end = GetTextLength();
    int p = FindText(start, end, findTextM, findFlagsM.asStc());
    if (p == -1)
    {
        if (findFlagsM.has(se::WRAP))
            p = FindText(0, end, findTextM, findFlagsM.asStc());
        if (p == -1)
        {
            if (findFlagsM.has(se::ALERT))
                wxMessageBox(_("No more matches"), _("Search complete"), wxICON_INFORMATION|wxOK);
            return false;
        }
    }
    centerCaret(true);
    GotoPos(p);
    GotoPos(p + findTextM.Length());
    SetSelectionStart(p);
    SetSelectionEnd(p + findTextM.Length());
    centerCaret(false);
    return true;
}
/*
================
CSyntaxRichEditCtrl::FindNext
================
*/
bool CSyntaxRichEditCtrl::FindNext(const char *find, bool matchCase, bool matchWholeWords, bool searchForward)
{
	long selStart, selEnd, flags, search, length, start;
	tom::ITextRange *range;

	if (find[0] == '\0') {
		return false;
	}

	GetSel(selStart, selEnd);

	flags = 0;
	flags |= matchCase ? tom::tomMatchCase : 0;
	flags |= matchWholeWords ? tom::tomMatchWord : 0;

	if (searchForward) {
		m_TextDoc->Range(selEnd, GetTextLength(), &range);
		search = GetTextLength() - selEnd;
	} else {
		m_TextDoc->Range(0, selStart, &range);
		search = -selStart;
	}

	if (range->FindShit(A2BSTR(find), search, flags, &length) == S_OK) {

		m_TextDoc->Freeze(NULL);

		range->get_Start(&start);
		range->Release();

		SetSel(start, start + length);

		int line = Max((int) LineFromChar(start) - 5, 0);
		LineScroll(line - GetFirstVisibleLine(), 0);

		UpdateVisibleRange();

		m_TextDoc->Unfreeze(NULL);
		return true;
	} else {
		range->Release();
		return false;
	}
}
Esempio n. 21
0
/*
 *	CTxtEdit::GetClipboardData
 *
 *	@mfunc	return an data transfer object for the indicated
 *	range
 *
 *	@rdesc
 *		HRESULT				Success code.
 */
STDMETHODIMP CTxtEdit::GetClipboardData( 
	CHARRANGE *lpchrg, 			//@parm the range of text to use
	DWORD reco,					//@parm operation the data is for
	LPDATAOBJECT *lplpdataobj)	//@parm where to put the data object
{
	TRACEBEGIN(TRCSUBSYSOLE, TRCSCOPEEXTERN, "CTxtEdit::GetClipboardData");

	CCallMgr callmgr(this);
	HRESULT hr;
	LONG cpMin, cpMost;
	CLightDTEngine * pldte = GetDTE();

	//Make sure cpMin and cpMost are within the current text limits.
	//Interpret neg. value for cpMin as the beginning of the text,
	//and neg. value for cpMax as the end of the text.  If a char range
	//is not given use the current selection.
	if(lpchrg)
	{
		LONG cchText;

		cchText = (LONG)GetTextLength();

		cpMin = max(0, lpchrg->cpMin);
		cpMin = min(cchText, lpchrg->cpMin);
		cpMost = lpchrg->cpMost;
		if(lpchrg->cpMost < 0 || lpchrg->cpMost > cchText)
			cpMost = cchText;
	}
	else
	{
		CTxtSelection * psel = GetSel();

		psel->GetRange(cpMin, cpMost);
	}

	//Make sure this is a valid range.
	if(cpMin >= cpMost)
	{
		*lplpdataobj = NULL;
		return cpMin == cpMost
					? NOERROR
					: ResultFromScode(E_INVALIDARG);
	}

	CTxtRange rg(this, cpMin, cpMin-cpMost);

	//We don't use reco for anything.
	hr = pldte->RangeToDataObject(&rg, SF_RTF, lplpdataobj);

#ifdef DEBUG
	if(hr != NOERROR)
		TRACEERRSZSC("GetClipboardData", E_OUTOFMEMORY);
#endif

	return hr;
}
Esempio n. 22
0
void DaCai_TextBox(uint16 ScreenID,uint16 ControlID,char *fmt,...)
{
  va_list ap;
	char String[256];
	va_start(ap,fmt);
	vsprintf(String,fmt,ap);
	DaCai_SetTextBox(ScreenID,ControlID,(uint8 *)String,GetTextLength(String));
	va_end(ap);
	
}
Esempio n. 23
0
void DaCai_Printf(char *fmt,...)
{
  va_list ap;
	char String[256];
	va_start(ap,fmt);
	vsprintf(String,fmt,ap);
	DaCai_SetTextBox(0x00,0x11,(uint8 *)String,GetTextLength(String));
	va_end(ap);
	
}
Esempio n. 24
0
/*
 * CRchTxtPtr::ValidateCp(&cp)
 *
 *	@mfunc
 *		If <p cp> <lt> 0, set it to 0; if it's <gt> text length, set it to
 *		text length.
 */
void CRchTxtPtr::ValidateCp(
	LONG &cp) const			// @parm new cp for this text ptr
{
	TRACEBEGIN(TRCSUBSYSBACK, TRCSCOPEINTERN, "CRchTxtPtr::ValidateCp");

	LONG cchT = GetTextLength();

	cp = min(cp, cchT);				// Be sure cp is valid
	cp = max(cp, 0);
}
void CTextEditor::MoveSelectionNext()
{
    UINT nTextLength = GetTextLength();
    if (_nSelEnd < nTextLength)
       _nSelEnd++;

    _nSelStart = _nSelEnd;
    _pTextStore->OnSelectionChange();

}
Esempio n. 26
0
void CFulEditCtrl::ScrollToEnd() {
	SetRedraw(FALSE);
	SetSel(0, 0);
	ScrollCaret();
	int l = GetTextLength();
	SetSel(l, l);
	SendMessage(EM_SCROLLCARET, 0, 0);
	SetRedraw(TRUE);
	Invalidate();
}
Esempio n. 27
0
	//----------------------------------------------------------------------------
	Real GetTextWidth(const char *text, int count = -1, Real *outMinY = 0, Real *outMaxY = 0)
	{
		if (count < 0)
			count = GetTextLength(text);

		Real x = 0;
		Real minY = 10000;
		Real maxY = -10000;

		for (int n = 0; n < count;)
		{
			TextTags::Enum tag;
			int imgLen;
			int skiplen = SkipTags(&text[n], &tag, &imgLen);
			if (skiplen>0)
			{
				if (tag == TextTags::Img)
				{
					x += imgLen;
				}
				do
				{
					n += skiplen;
					skiplen = SkipTags(&text[n], &tag, &imgLen);
					if (tag == TextTags::Img)
					{
						x += imgLen;
					}
				} while (skiplen > 0);
			}
			if (n >= count)
				break;

			int charId = GetTextChar(text, n, &n);

			SCharDescr *ch = GetChar(charId);
			if (ch == 0) ch = &mDefChar;

			x += mScale * (ch->xAdv);
			Real h = mScale * Real(ch->srcH);
			Real y = mScale * (Real(mBase) - Real(ch->yOff));
			if (minY > y - h)
				minY = y - h;
			if (maxY < y)
				maxY = y;

			if (n < count)
				x += AdjustForKerningPairs(charId, GetTextChar(text, n));
		}

		if (outMinY) *outMinY = minY;
		if (outMaxY) *outMaxY = maxY;

		return x;
	}
 void NativeTextfieldWin::OnMouseMove(UINT keys, const gfx::Point& point)
 {
     SetContainsMouse(true);
     // Clamp the selection to the visible text so the user can't drag to select
     // the "phantom newline".  In theory we could achieve this by clipping the X
     // coordinate, but in practice the edit seems to behave nondeterministically
     // with similar sequences of clipped input coordinates fed to it.  Maybe it's
     // reading the mouse cursor position directly?
     //
     // This solution has a minor visual flaw, however: if there's a visible
     // cursor at the edge of the text (only true when there's no selection),
     // dragging the mouse around outside that edge repaints the cursor on every
     // WM_MOUSEMOVE instead of allowing it to blink normally.  To fix this, we
     // special-case this exact case and discard the WM_MOUSEMOVE messages instead
     // of passing them along.
     //
     // But even this solution has a flaw!  (Argh.)  In the case where the user
     // has a selection that starts at the edge of the edit, and proceeds to the
     // middle of the edit, and the user is dragging back past the start edge to
     // remove the selection, there's a redraw problem where the change between
     // having the last few bits of text still selected and having nothing
     // selected can be slow to repaint (which feels noticeably strange).  This
     // occurs if you only let the edit receive a single WM_MOUSEMOVE past the
     // edge of the text.  I think on each WM_MOUSEMOVE the edit is repainting its
     // previous state, then updating its internal variables to the new state but
     // not repainting.  To fix this, we allow one more WM_MOUSEMOVE through after
     // the selection has supposedly been shrunk to nothing; this makes the edit
     // redraw the selection quickly so it feels smooth.
     CHARRANGE selection;
     GetSel(selection);
     const bool possibly_can_discard_mousemove =
         (selection.cpMin==selection.cpMax) &&
         (((selection.cpMin==0) &&
         (ClipXCoordToVisibleText(point.x(), false)>point.x())) ||
         ((selection.cpMin==GetTextLength()) &&
         (ClipXCoordToVisibleText(point.x(), false)<point.x())));
     if(!can_discard_mousemove_ || !possibly_can_discard_mousemove)
     {
         can_discard_mousemove_ = possibly_can_discard_mousemove;
         ScopedFreeze freeze(this, GetTextObjectModel());
         OnBeforePossibleChange();
         // Force the Y coordinate to the center of the clip rect.  The edit
         // behaves strangely when the cursor is dragged vertically: if the cursor
         // is in the middle of the text, drags inside the clip rect do nothing,
         // and drags outside the clip rect act as if the cursor jumped to the
         // left edge of the text.  When the cursor is at the right edge, drags of
         // just a few pixels vertically end up selecting the "phantom newline"...
         // sometimes.
         RECT r;
         GetRect(&r);
         DefWindowProc(WM_MOUSEMOVE, keys, MAKELPARAM(point.x(), (r.bottom-r.top)/2));
         OnAfterPossibleChange(true);
     }
 }
void CTextEditor::MoveSelectionNext()
{
    UINT nTextLength = GetTextLength();
    if (_nSelEnd < nTextLength)
       _nSelEnd++;

    _nSelStart = _nSelEnd;

    SetCompositionForm();
    FlushCompositionString();
}
HRESULT touchmind::control::DWriteEditControlTextStoreACP::MoveACPToEnd() {
  if (_IsLocked(TS_LF_READ)) {
    return S_OK;
  }
  _LockDocument(TS_LF_READWRITE);
  LONG textLength = static_cast<LONG>(GetTextLength());
  HRESULT hr = ChangeACPWithoutLock(textLength, textLength, TS_AE_START);
  _UnlockDocument();
  m_AdviseSink.pTextStoreACPSink->OnLayoutChange(TS_LC_CHANGE, EDIT_VIEW_COOKIE);
  return hr;
}