- Add a macro which specifies how much space chars a TAB is.
- Implement BELL ANSI character handling (basic) and add temporary DPRINTs to see who is called (by the way, Beep() functions seems not to work correctly).

svn path=/branches/ros-csrss/; revision=58253
This commit is contained in:
Hermès Bélusca-Maïto 2013-01-30 22:59:47 +00:00
parent bb519801e2
commit 03d1c009f0
4 changed files with 44 additions and 28 deletions

View file

@ -9,6 +9,16 @@
#pragma once
#define CSR_DEFAULT_CURSOR_SIZE 25
#define CURSOR_BLINK_TIME 500
#define DEFAULT_ATTRIB (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
#ifndef WM_APP
#define WM_APP 0x8000
#endif
#define PM_CREATE_CONSOLE (WM_APP + 1)
#define PM_DESTROY_CONSOLE (WM_APP + 2)
#define PM_CONSOLE_BEEP (WM_APP + 3)
/************************************************************************
* Screen buffer structure represents the win32 screen buffer object. *

View file

@ -17,6 +17,8 @@
/* GLOBALS ********************************************************************/
#define TAB_WIDTH 8
#define ConioInitRect(Rect, top, left, bottom, right) \
do { \
((Rect)->Top) = top; \
@ -131,10 +133,22 @@ ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
for (i = 0; i < Length; i++)
{
/*
* If we are in processed mode, interpret special characters and
* display them correctly. Otherwise, just put them into the buffer.
*/
if (Buff->Mode & ENABLE_PROCESSED_OUTPUT)
{
/* --- CR --- */
if (Buffer[i] == '\r')
{
Buff->CurrentX = 0;
UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CurrentX);
UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CurrentX);
continue;
}
/* --- LF --- */
if (Buffer[i] == '\n')
else if (Buffer[i] == '\n')
{
Buff->CurrentX = 0;
ConioNextLine(Buff, &UpdateRect, &ScrolledLines);
@ -160,30 +174,19 @@ ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
Ptr = ConioCoordToPointer(Buff, Buff->CurrentX, Buff->CurrentY);
Ptr[0] = ' ';
Ptr[1] = Buff->DefaultAttrib;
UpdateRect.Left = min(UpdateRect.Left, (LONG) Buff->CurrentX);
UpdateRect.Right = max(UpdateRect.Right, (LONG) Buff->CurrentX);
UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CurrentX);
UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CurrentX);
}
continue;
}
/* --- CR --- */
else if (Buffer[i] == '\r')
{
Buff->CurrentX = 0;
UpdateRect.Left = min(UpdateRect.Left, (LONG) Buff->CurrentX);
UpdateRect.Right = max(UpdateRect.Right, (LONG) Buff->CurrentX);
continue;
}
/* --- TAB --- */
else if (Buffer[i] == '\t')
{
UINT EndX;
UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CurrentX);
EndX = (Buff->CurrentX + 8) & ~7;
if (EndX > Buff->MaxX)
{
EndX = Buff->MaxX;
}
EndX = (Buff->CurrentX + TAB_WIDTH) & ~(TAB_WIDTH - 1);
EndX = min(EndX, Buff->MaxX);
Ptr = ConioCoordToPointer(Buff, Buff->CurrentX, Buff->CurrentY);
while (Buff->CurrentX < EndX)
{
@ -191,7 +194,7 @@ ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
*Ptr++ = Buff->DefaultAttrib;
Buff->CurrentX++;
}
UpdateRect.Right = max(UpdateRect.Right, (LONG) Buff->CurrentX - 1);
UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CurrentX - 1);
if (Buff->CurrentX == Buff->MaxX)
{
if (Buff->Mode & ENABLE_WRAP_AT_EOL_OUTPUT)
@ -206,9 +209,16 @@ ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
}
continue;
}
/* --- BEL ---*/
else if (Buffer[i] == '\a')
{
DPRINT1("Bell\n");
SendNotifyMessage(Console->hWindow, PM_CONSOLE_BEEP, 0, 0);
continue;
}
}
UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CurrentX);
UpdateRect.Right = max(UpdateRect.Right, (LONG) Buff->CurrentX);
UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CurrentX);
Ptr = ConioCoordToPointer(Buff, Buff->CurrentX, Buff->CurrentY);
Ptr[0] = Buffer[i];
if (Attrib)

View file

@ -65,15 +65,6 @@ typedef struct _GUI_CONSOLE_DATA
POINT OldCursor;
} GUI_CONSOLE_DATA, *PGUI_CONSOLE_DATA;
#ifndef WM_APP
#define WM_APP 0x8000
#endif
#define PM_CREATE_CONSOLE (WM_APP + 1)
#define PM_DESTROY_CONSOLE (WM_APP + 2)
#define CURSOR_BLINK_TIME 500
#define DEFAULT_ATTRIB (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
static BOOL ConsInitialized = FALSE;
static HWND NotifyWnd;
@ -2065,6 +2056,11 @@ GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
break;
case PM_CONSOLE_BEEP:
DPRINT1("Beep !!\n");
Beep(800, 200);
break;
default:
Result = DefWindowProcW(hWnd, msg, wParam, lParam);
break;

View file

@ -296,7 +296,7 @@ TuiWriteStream(PCONSOLE Console, SMALL_RECT* Region, LONG CursorStartX, LONG Cur
return;
}
if (! WriteFile(ConsoleDeviceHandle, Buffer, Length, &BytesWritten, NULL))
if (!WriteFile(ConsoleDeviceHandle, Buffer, Length, &BytesWritten, NULL))
{
DPRINT1("Error writing to BlueScreen\n");
}