mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-06-26 16:29:30 +00:00
Sync to master
This commit is contained in:
commit
d2aeb96653
|
@ -7163,6 +7163,9 @@ void WindowUpdateConsoleDisplayedSize ()
|
||||||
g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1;
|
g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1;
|
||||||
g_bConsoleFullWidth = true;
|
g_bConsoleFullWidth = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_nConsoleInputMaxLen = g_nConsoleDisplayWidth-1; // -1 prompt at Start-of-Line, -1 for cursor at End-of-Line
|
||||||
|
g_nConsoleInputScrollWidth = g_nConsoleDisplayWidth-1; // Maximum number of characters for the horizontol scrolling window on the input line
|
||||||
#else
|
#else
|
||||||
g_nConsoleDisplayWidth = (CONSOLE_WIDTH / 2) + 10;
|
g_nConsoleDisplayWidth = (CONSOLE_WIDTH / 2) + 10;
|
||||||
g_bConsoleFullWidth = false;
|
g_bConsoleFullWidth = false;
|
||||||
|
@ -9049,7 +9052,7 @@ void DebuggerInputConsoleChar ( TCHAR ch )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_nConsoleInputChars > (g_nConsoleDisplayWidth-1))
|
if (g_nConsoleInputChars > g_nConsoleInputMaxLen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((ch >= CHAR_SPACE) && (ch <= 126)) // HACK MAGIC # 32 -> ' ', # 126
|
if ((ch >= CHAR_SPACE) && (ch <= 126)) // HACK MAGIC # 32 -> ' ', # 126
|
||||||
|
|
|
@ -80,11 +80,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
char g_aConsoleInput[ CONSOLE_WIDTH ]; // = g_aConsoleDisplay[0];
|
char g_aConsoleInput[ CONSOLE_WIDTH ]; // = g_aConsoleDisplay[0];
|
||||||
|
|
||||||
// Cooked input line (no prompt)
|
// Cooked input line (no prompt)
|
||||||
int g_nConsoleInputChars = 0;
|
int g_nConsoleInputChars = 0;
|
||||||
char * g_pConsoleInput = 0; // points to past prompt
|
char * g_pConsoleInput = 0; // points to past prompt
|
||||||
const char * g_pConsoleFirstArg = 0; // points to first arg
|
int g_nConsoleInputMaxLen = 0;
|
||||||
bool g_bConsoleInputQuoted = false; // Allows lower-case to be entered
|
int g_nConsoleInputScrollWidth = 0;
|
||||||
char g_nConsoleInputSkip = '~';
|
const char * g_pConsoleFirstArg = 0; // points to first arg
|
||||||
|
bool g_bConsoleInputQuoted = false; // Allows lower-case to be entered
|
||||||
|
char g_nConsoleInputSkip = '~';
|
||||||
|
|
||||||
// Prototypes _______________________________________________________________
|
// Prototypes _______________________________________________________________
|
||||||
|
|
||||||
|
@ -354,7 +356,7 @@ void ConsoleConvertFromText ( conchar_t * sText, const char * pText )
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
Update_t ConsoleDisplayError ( const char * pText )
|
Update_t ConsoleDisplayError ( const char * pText )
|
||||||
{
|
{
|
||||||
ConsoleBufferPush( pText );
|
ConsolePrintFormat( CHC_ERROR "%s", pText );
|
||||||
return ConsoleUpdate();
|
return ConsoleUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,7 +432,7 @@ bool ConsoleInputBackSpace ()
|
||||||
{
|
{
|
||||||
if (g_nConsoleInputChars)
|
if (g_nConsoleInputChars)
|
||||||
{
|
{
|
||||||
g_pConsoleInput[ g_nConsoleInputChars ] = CHAR_SPACE;
|
g_pConsoleInput[ g_nConsoleInputChars ] = 0;
|
||||||
|
|
||||||
g_nConsoleInputChars--;
|
g_nConsoleInputChars--;
|
||||||
|
|
||||||
|
@ -461,7 +463,7 @@ bool ConsoleInputClear ()
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
bool ConsoleInputChar ( char ch )
|
bool ConsoleInputChar ( char ch )
|
||||||
{
|
{
|
||||||
if (g_nConsoleInputChars < g_nConsoleDisplayWidth) // bug? include prompt?
|
if (g_nConsoleInputChars < g_nConsoleInputMaxLen) // GH #1204 Need to count the space at EOL for the cursor
|
||||||
{
|
{
|
||||||
g_pConsoleInput[ g_nConsoleInputChars ] = ch;
|
g_pConsoleInput[ g_nConsoleInputChars ] = ch;
|
||||||
g_nConsoleInputChars++;
|
g_nConsoleInputChars++;
|
||||||
|
|
|
@ -245,11 +245,12 @@
|
||||||
extern char g_aConsoleInput[ CONSOLE_WIDTH ];
|
extern char g_aConsoleInput[ CONSOLE_WIDTH ];
|
||||||
|
|
||||||
// Cooked input line (no prompt)
|
// Cooked input line (no prompt)
|
||||||
extern int g_nConsoleInputChars ;
|
extern int g_nConsoleInputChars ;
|
||||||
extern char * g_pConsoleInput ; // points to past prompt
|
extern char * g_pConsoleInput ; // points to past prompt
|
||||||
extern const char * g_pConsoleFirstArg ; // points to first arg
|
extern int g_nConsoleInputMaxLen ; // = g_nConsoleDisplayWidth-1 = 78 // Maximum number of characters allowed on input line
|
||||||
extern bool g_bConsoleInputQuoted ;
|
extern int g_nConsoleInputScrollWidth; // = g_nConsoleDisplayWidth-1 = 78 // Maximum number of characters for the horizontol scrolling window on the input line
|
||||||
|
extern const char * g_pConsoleFirstArg ; // points to first arg
|
||||||
|
extern bool g_bConsoleInputQuoted ;
|
||||||
extern char g_nConsoleInputSkip ;
|
extern char g_nConsoleInputSkip ;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1246,8 +1246,10 @@ void DrawConsoleCursor ()
|
||||||
int nLineHeight = GetConsoleLineHeightPixels();
|
int nLineHeight = GetConsoleLineHeightPixels();
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
|
||||||
|
const int nInputWidth = min( g_nConsoleInputChars, g_nConsoleInputScrollWidth ); // NOTE: Keep in Sync! DrawConsoleInput() and DrawConsoleCursor()
|
||||||
|
|
||||||
RECT rect;
|
RECT rect;
|
||||||
rect.left = (g_nConsoleInputChars + g_nConsolePromptLen) * nWidth;
|
rect.left = (nInputWidth + g_nConsolePromptLen) * nWidth;
|
||||||
rect.top = GetConsoleTopPixels( y );
|
rect.top = GetConsoleTopPixels( y );
|
||||||
rect.bottom = rect.top + nLineHeight; //g_nFontHeight;
|
rect.bottom = rect.top + nLineHeight; //g_nFontHeight;
|
||||||
rect.right = rect.left + nWidth;
|
rect.right = rect.left + nWidth;
|
||||||
|
@ -1295,9 +1297,31 @@ void DrawConsoleInput ()
|
||||||
RECT rect;
|
RECT rect;
|
||||||
GetConsoleRect( 0, rect );
|
GetConsoleRect( 0, rect );
|
||||||
|
|
||||||
// Console background is drawn in DrawWindowBackground_Info
|
// For long input only show last g_nConsoleInputScrollWidth characters
|
||||||
// DrawConsoleLine( g_aConsoleInput, 0 );
|
if (g_nConsoleInputChars > g_nConsoleInputScrollWidth)
|
||||||
PrintText( g_aConsoleInput, rect );
|
{
|
||||||
|
assert(g_nConsoleInputScrollWidth <= CONSOLE_WIDTH); // NOTE: To support a wider input line the size of g_aConsoleInput[] must be increased
|
||||||
|
|
||||||
|
// g_nConsoleInputMaxLen = 16;
|
||||||
|
// g_nConsoleInputScrollWidth = 10;
|
||||||
|
//
|
||||||
|
// 123456789ABCDEF g_aConsoleInput[]
|
||||||
|
// ^ g_nConsoleInputChars = 15
|
||||||
|
// [--------] g_nConsoleInputScrollWidth = 10
|
||||||
|
// >6789ABCDEF_ g_nConsoleInputMaxLen = 16
|
||||||
|
static char aScrollingInput[ CONSOLE_WIDTH+1 ];
|
||||||
|
aScrollingInput[0] = g_aConsoleInput[0]; // 1. Start-of-Line
|
||||||
|
|
||||||
|
const int nInputOffset = g_nConsoleInputChars - g_nConsoleInputScrollWidth ; // 2. Middle
|
||||||
|
const int nInputWidth = min( g_nConsoleInputChars, g_nConsoleInputScrollWidth ); // NOTE: Keep in Sync! DrawConsoleInput() and DrawConsoleCursor()
|
||||||
|
strncpy( aScrollingInput+1, g_aConsoleInput + 1 + nInputOffset, nInputWidth ); // +1 to skip prompt
|
||||||
|
|
||||||
|
aScrollingInput[ g_nConsoleInputScrollWidth+1 ] = 0; // 3. End-of-Line leave room for cursor
|
||||||
|
|
||||||
|
PrintText( aScrollingInput, rect );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PrintText( g_aConsoleInput, rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
static HANDLE g_hRiffFile = INVALID_HANDLE_VALUE;
|
static HANDLE g_hRiffFile = INVALID_HANDLE_VALUE;
|
||||||
static DWORD dwTotalOffset;
|
static DWORD dwTotalOffset;
|
||||||
static DWORD dwDataOffset;
|
static DWORD dwDataOffset;
|
||||||
static DWORD g_dwTotalNumberOfBytesWritten = 0;
|
|
||||||
static unsigned int g_NumChannels = 2;
|
static unsigned int g_NumChannels = 2;
|
||||||
|
|
||||||
bool RiffInitWriteFile(const char* pszFile, unsigned int sample_rate, unsigned int NumChannels)
|
bool RiffInitWriteFile(const char* pszFile, unsigned int sample_rate, unsigned int NumChannels)
|
||||||
|
@ -106,11 +105,13 @@ bool RiffFinishWriteFile()
|
||||||
|
|
||||||
DWORD dwNumberOfBytesWritten;
|
DWORD dwNumberOfBytesWritten;
|
||||||
|
|
||||||
temp32 = g_dwTotalNumberOfBytesWritten - (dwTotalOffset + 4);
|
DWORD fileSize = SetFilePointer(g_hRiffFile, 0, NULL, FILE_END);
|
||||||
|
|
||||||
|
temp32 = fileSize - (dwTotalOffset + 4);
|
||||||
SetFilePointer(g_hRiffFile, dwTotalOffset, NULL, FILE_BEGIN);
|
SetFilePointer(g_hRiffFile, dwTotalOffset, NULL, FILE_BEGIN);
|
||||||
WriteFile(g_hRiffFile, &temp32, 4, &dwNumberOfBytesWritten, NULL);
|
WriteFile(g_hRiffFile, &temp32, 4, &dwNumberOfBytesWritten, NULL);
|
||||||
|
|
||||||
temp32 = g_dwTotalNumberOfBytesWritten - (dwDataOffset + 4);
|
temp32 = fileSize - (dwDataOffset + 4);
|
||||||
SetFilePointer(g_hRiffFile, dwDataOffset, NULL, FILE_BEGIN);
|
SetFilePointer(g_hRiffFile, dwDataOffset, NULL, FILE_BEGIN);
|
||||||
WriteFile(g_hRiffFile, &temp32, 4, &dwNumberOfBytesWritten, NULL);
|
WriteFile(g_hRiffFile, &temp32, 4, &dwNumberOfBytesWritten, NULL);
|
||||||
|
|
||||||
|
@ -133,7 +134,5 @@ bool RiffPutSamples(const short* buf, unsigned int uSamples)
|
||||||
&dwNumberOfBytesWritten,
|
&dwNumberOfBytesWritten,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_dwTotalNumberOfBytesWritten += dwNumberOfBytesWritten;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user