2000-11-23 13:32 GMT+1 Maurilio Longo <maurilio.longo@libero.it>

This commit is contained in:
Maurilio Longo
2000-11-23 13:40:03 +00:00
parent 1083b8810f
commit bd390ae537
3 changed files with 44 additions and 5 deletions

View File

@@ -1,3 +1,15 @@
2000-11-23 13:32 GMT+1 Maurilio Longo <maurilio.longo@libero.it>
* source/rtl/teditor.prg
! fixed K_DEL handling
* source/rtl/idle.c
! fixed / changed to release cpu only if there are no pending keys. Works ok
under OS/2. Please test under win32 (linux still lacks system call to release cpu).
Note: since I can enter hb_IdleState() while waiting a certain amount of time to
elapse (ie. Inkey(.1)) I cannot keep calling idle tasks but I have to exit
hb_IdleState() every time an idle task has ended its execution. If I have
time left to wait I'll reenter hb_IdleState() immediatly (executing next
idle task).
2000-11-21 18:35 UTC+0800 Ron Pinkas <ron@profit-master.com>
* source/pp/ppcomp.c
* Corrected 1 compiler warning.

View File

@@ -63,6 +63,10 @@ static USHORT s_uiIdleMaxTask = 0;
/* flag to prevent recursive calls of hb_idleState() */
static BOOL s_bIamIdle = FALSE;
int hb_inkeyNext( void ); /* Return the next key without extracting it */
static void hb_releaseCPU( void )
{
HB_TRACE(HB_TR_DEBUG, ("releaseCPU()"));
@@ -72,8 +76,16 @@ static void hb_releaseCPU( void )
#if defined(HB_OS_WIN_32)
/* Forfeit the remainder of the current time slice. */
Sleep( 0 );
#elif defined(HB_OS_OS2)
DosSleep( 25 ); /* Duration is in milliseconds */
/* 23/nov/2000 - maurilio.longo@libero.it
Minimum time slice under OS/2 is 32 milliseconds, passed 1 will be rounded to 32 and
will give a chance to threads of lower priority to get executed.
Passing 0 causes current thread to give up its time slice only if there are threads of
equal priority waiting to be dispatched. Note: certain versions of OS/2 kernel have a
bug which causes DosSleep(0) not to work as expected. */
DosSleep( 1 ); /* Duration is in milliseconds */
#elif defined(HB_OS_DOS)
/* NOTE: there is a bug under NT 4 and 2000 - if the app is running
@@ -109,14 +121,19 @@ void hb_idleState( void )
{
s_bIamIdle = TRUE;
hb_gcCollectAll();
hb_releaseCPU();
if( s_pIdleTasks )
{
hb_vmEvalBlock( s_pIdleTasks + s_uiIdleTask );
if( ++s_uiIdleTask == s_uiIdleMaxTask )
s_uiIdleTask = 0;
}
if (hb_inkeyNext() == 0) {
hb_releaseCPU();
}
s_bIamIdle = FALSE;
}
}

View File

@@ -795,6 +795,7 @@ METHOD Edit(nPassedKey) CLASS TEditor
LOCAL nKey
LOCAL lOldInsert
LOCAL lKeepGoing := .T.
LOCAL lDelAppend
if ! ::lEditAllow
BrowseText(Self)
@@ -850,10 +851,19 @@ METHOD Edit(nPassedKey) CLASS TEditor
::InsertState(!::lInsert)
case nKey == K_DEL
// If I'm on last char of a line and there are more lines, append next line to current one
lDelAppend := ::nCol > ::LineLen(::nRow)
::aText[::nRow]:cText := Stuff(::aText[::nRow]:cText, ::nCol, 1, "")
::RefreshLine()
if ::LineLen(::nRow) == 0
::Edit(K_CTRL_Y)
if lDelAppend
if ::nRow < ::naTextLen
::aText[::nRow]:cText += ::GetLine(::nRow + 1)
::RemoveLine(::nRow + 1)
::RefreshWindow()
else
::RefreshLine()
endif
else
::RefreshLine()
endif
case nKey == K_TAB