From 0eeb528a56168913e791d136b05047fd1c332a37 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 18 Jan 2013 23:02:57 +0000 Subject: [PATCH] 2013-01-19 00:01 UTC+0100 Viktor Szakats (harbour syenar.net) * src/rtl/tget.prg ! fixed RTE in ::OverStrike()/::Insert() when a non-string parameter was passed ! fixed Clipper incompatibility when passing certain multichar strings to ::OverStrike()/::Insert(). (f.e. "12", "23") Clipper always uses the first char only. ! fixed ::unTransform() missing the leading decimal point in number picture masks (f.e. ".9", "-.9", ".-9") * tests/rto_get.prg + added regression tests for cases fixed above * tests/rto_get.prg * tests/rto_tb.prg * minor modification to make them work as hbrun scripts --- harbour/ChangeLog.txt | 17 ++++++++++++ harbour/src/rtl/tget.prg | 13 ++++++--- harbour/tests/rto_get.prg | 56 +++++++++++++++++++++++++++++++++++++++ harbour/tests/rto_tb.prg | 1 + 4 files changed, 83 insertions(+), 4 deletions(-) diff --git a/harbour/ChangeLog.txt b/harbour/ChangeLog.txt index d9b6803c55..3138e9dc75 100644 --- a/harbour/ChangeLog.txt +++ b/harbour/ChangeLog.txt @@ -10,6 +10,23 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-01-19 00:01 UTC+0100 Viktor Szakats (harbour syenar.net) + * src/rtl/tget.prg + ! fixed RTE in ::OverStrike()/::Insert() when a non-string + parameter was passed + ! fixed Clipper incompatibility when passing certain + multichar strings to ::OverStrike()/::Insert(). (f.e. "12", "23") + Clipper always uses the first char only. + ! fixed ::unTransform() missing the leading decimal + point in number picture masks (f.e. ".9", "-.9", ".-9") + + * tests/rto_get.prg + + added regression tests for cases fixed above + + * tests/rto_get.prg + * tests/rto_tb.prg + * minor modification to make them work as hbrun scripts + 2013-01-18 04:31 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/hbmzip/3rd/minizip/minizip.dif * contrib/hbmzip/3rd/minizip/zip.c diff --git a/harbour/src/rtl/tget.prg b/harbour/src/rtl/tget.prg index 5ef57a59c2..96b1fd1176 100644 --- a/harbour/src/rtl/tget.prg +++ b/harbour/src/rtl/tget.prg @@ -565,7 +565,7 @@ METHOD varGet() CLASS Get METHOD overStrike( cChar ) CLASS Get - IF ::hasFocus + IF ::hasFocus .AND. HB_ISSTRING( cChar ) IF ::cType == "N" .AND. ! ::lEdit .AND. ::lClear ::pos := ::FirstEditable() @@ -573,7 +573,7 @@ METHOD overStrike( cChar ) CLASS Get IF ::pos <= ::nMaxEdit - cChar := ::Input( cChar ) + cChar := ::Input( Left( cChar, 1 ) ) IF cChar == "" ::rejected := .T. @@ -619,7 +619,7 @@ METHOD insert( cChar ) CLASS Get LOCAL nFor LOCAL nMaxEdit - IF ::hasFocus + IF ::hasFocus .AND. HB_ISSTRING( cChar ) nMaxEdit := ::nMaxEdit @@ -629,7 +629,7 @@ METHOD insert( cChar ) CLASS Get IF ::nPos <= ::nMaxEdit - cChar := ::Input( cChar ) + cChar := ::Input( Left( cChar, 1 ) ) IF cChar == "" ::rejected := .T. @@ -1285,6 +1285,11 @@ METHOD unTransform() CLASS Get ENDIF cBuffer := Space( ::FirstEditable() - 1 ) + SubStr( cBuffer, ::FirstEditable(), ::LastEditable() - ::FirstEditable() + 1 ) + /* Readd leading decimal point, if any */ + IF ::decPos <= ::FirstEditable() - 1 + cBuffer := Left( cBuffer, ::decPos - 1 ) + "." + SubStr( cBuffer, ::decPos + 1 ) + ENDIF + IF "D" $ ::cPicFunc .OR. ; "T" $ ::cPicFunc FOR nFor := ::FirstEditable() TO ::LastEditable() diff --git a/harbour/tests/rto_get.prg b/harbour/tests/rto_get.prg index dc2a6fc52c..5a5789a911 100644 --- a/harbour/tests/rto_get.prg +++ b/harbour/tests/rto_get.prg @@ -105,6 +105,7 @@ PROCEDURE Main( cArg01, cArg02, cArg03, cArg04 ) ENDIF SET DATE ANSI + SET CENTURY OFF // ; @@ -420,6 +421,61 @@ PROCEDURE Main( cArg01, cArg02, cArg03, cArg04 ) TEST_LINE( o:setFocus() ) TEST_LINE( o:display() ) + // ; Mauricio and variations + + nInt02 := 0 + SetPos( 14, 16 ) ; o := _GET_( nInt02, "nInt02", ".99",, ) + o:display() + o:setFocus() + TGetTOVS( o, { "12" } ) + TEST_LINE( o:Assign() ) + + nInt02 := 0 + SetPos( 14, 16 ) ; o := _GET_( nInt02, "nInt02", "-.99",, ) + o:display() + o:setFocus() + TGetTOVS( o, { "12" } ) + TEST_LINE( o:Assign() ) + + nInt02 := 0 + SetPos( 14, 16 ) ; o := _GET_( nInt02, "nInt02", ".-99",, ) + o:display() + o:setFocus() + TGetTOVS( o, { "12" } ) + TEST_LINE( o:Assign() ) + + // ; Overstrike/Insert + + nInt02 := 0 + SetPos( 14, 16 ) ; o := _GET_( nInt02, "nInt02", "9999999999",, ) + o:display() + o:setFocus() + TEST_LINE( o:OverStrike( "12" ) ) + TEST_LINE( o:OverStrike( "9" ) ) + TEST_LINE( o:OverStrike( "13" ) ) + TEST_LINE( o:OverStrike( "9" ) ) + TEST_LINE( o:OverStrike( NIL ) ) + TEST_LINE( o:OverStrike( "9" ) ) + TEST_LINE( o:OverStrike( 1 ) ) + TEST_LINE( o:OverStrike( "9" ) ) + TEST_LINE( o:OverStrike( "" ) ) + TEST_LINE( o:Assign() ) + + nInt02 := 0 + SetPos( 14, 16 ) ; o := _GET_( nInt02, "nInt02", "9999999999",, ) + o:display() + o:setFocus() + TEST_LINE( o:Insert( "12" ) ) + TEST_LINE( o:Insert( "9" ) ) + TEST_LINE( o:Insert( "13" ) ) + TEST_LINE( o:Insert( "9" ) ) + TEST_LINE( o:Insert( NIL ) ) + TEST_LINE( o:Insert( "9" ) ) + TEST_LINE( o:Insert( 1 ) ) + TEST_LINE( o:Insert( "9" ) ) + TEST_LINE( o:Insert( "" ) ) + TEST_LINE( o:Assign() ) + // ; Buffer s_xVar := "abcdefg" diff --git a/harbour/tests/rto_tb.prg b/harbour/tests/rto_tb.prg index f45e195e7b..6bbb40e779 100644 --- a/harbour/tests/rto_tb.prg +++ b/harbour/tests/rto_tb.prg @@ -111,6 +111,7 @@ PROCEDURE Main( cArg01, cArg02, cArg03, cArg04 ) ENDIF SET DATE ANSI + SET CENTURY OFF // ;