From 8822d2cd2a6de9b5e04da3b47622996e8bc9f435 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 5 Oct 2011 12:13:07 +0000 Subject: [PATCH] =?UTF-8?q?2011-10-05=2014:12=20UTC+0200=20Viktor=20Szakat?= =?UTF-8?q?s=20(harbour.01=20syenar.hu)=20=20=20*=20src/rtl/tget.prg=20=20?= =?UTF-8?q?=20=20=20!=20If=20the=20cursor=20is=20located=20in=20the=20midd?= =?UTF-8?q?le=20of=20a=20word,=20::wordLeft()=20no=20=20=20=20=20=20=20pla?= =?UTF-8?q?ces=20it=20at=20the=20beginning=20of=20this=20word,=20the=20cur?= =?UTF-8?q?sor=20jumps=20to=20the=20=20=20=20=20=20=20previous=20one.=20?= =?UTF-8?q?=20=20=20=20!=20If=20the=20cursor=20is=20located=20at=20the=20e?= =?UTF-8?q?nd=20of=20a=20word=20::wordRight()=20no=20places=20=20=20=20=20?= =?UTF-8?q?=20=20it=20at=20the=20beginning=20of=20the=20next=20word=20skip?= =?UTF-8?q?ping=20only=20the=20spaces=20between=20=20=20=20=20=20=20them,?= =?UTF-8?q?=20the=20next=20word=20is=20skipped=20entirely.=20=20=20=20=20;?= =?UTF-8?q?=20Patch=20and=20description=20by=20Juan=20G=C3=A1lvez?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- harbour/ChangeLog | 10 +++++++++ harbour/src/rtl/tget.prg | 48 ++++++++++------------------------------ 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6bd4eb2105..8724c067ba 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,16 @@ The license applies to all entries newer than 2009-04-28. */ +2011-10-05 14:12 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * src/rtl/tget.prg + ! If the cursor is located in the middle of a word, ::wordLeft() no + places it at the beginning of this word, the cursor jumps to the + previous one. + ! If the cursor is located at the end of a word ::wordRight() no places + it at the beginning of the next word skipping only the spaces between + them, the next word is skipped entirely. + ; Patch and description by Juan Gálvez + 2011-10-04 23:59 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * include/hbthread.h * include/hbsetup.h diff --git a/harbour/src/rtl/tget.prg b/harbour/src/rtl/tget.prg index 5913af38f2..6af85253cd 100644 --- a/harbour/src/rtl/tget.prg +++ b/harbour/src/rtl/tget.prg @@ -713,31 +713,16 @@ METHOD wordLeft() CLASS GET ELSE ::typeOut := .F. - nPos := ::nPos - 1 + nPos := iif( SubStr( ::cBuffer, ::nPos, 1 ) == " ", ::nPos, ::nPos - 1 ) - DO WHILE nPos > 0 - IF SubStr( ::cBuffer, nPos, 1 ) == " " - DO WHILE nPos > 0 .AND. SubStr( ::cBuffer, nPos, 1 ) == " " - nPos-- - ENDDO - DO WHILE nPos > 0 .AND. !( SubStr( ::cBuffer, nPos, 1 ) == " " ) - nPos-- - ENDDO - IF nPos > 0 - nPos++ - ENDIF - EXIT - ENDIF + DO WHILE nPos > 1 .AND. SubStr( ::cBuffer, nPos, 1 ) == " " + nPos-- + ENDDO + DO WHILE nPos > 1 .AND. ! ( SubStr( ::cBuffer, nPos, 1 ) == " " ) nPos-- ENDDO - IF nPos < 1 - nPos := 1 - ENDIF - - IF nPos > 0 - ::pos := nPos - ENDIF + ::pos := iif( nPos > 1, nPos + 1, 1 ) ::lSuppDisplay := .T. ::display() @@ -759,25 +744,16 @@ METHOD wordRight() CLASS GET ELSE ::typeOut := .F. - nPos := ::nPos + 1 + nPos := ::nPos - DO WHILE nPos <= ::nMaxEdit - IF SubStr( ::cBuffer, nPos, 1 ) == " " - DO WHILE nPos <= ::nMaxEdit .AND. SubStr( ::cBuffer, nPos, 1 ) == " " - nPos++ - ENDDO - EXIT - ENDIF + DO WHILE nPos < ::nMaxEdit .AND. ! ( SubStr( ::cBuffer, nPos, 1 ) == " " ) + nPos++ + ENDDO + DO WHILE nPos < ::nMaxEdit .AND. SubStr( ::cBuffer, nPos, 1 ) == " " nPos++ ENDDO - IF nPos > ::nMaxEdit - nPos := ::nMaxEdit - ENDIF - - IF nPos <= ::nMaxEdit - ::pos := nPos - ENDIF + ::pos := nPos ::lSuppDisplay := .T. ::display()