示例#1
0
TerminalLine*
HistoryBuffer::GetTerminalLineAt(int32 index, TerminalLine* buffer) const
{
	HistoryLine* line = LineAt(index);
	if (line == NULL)
		return NULL;

	int32 charCount = 0;
	const char* chars = line->Chars();
	buffer->length = 0;
	uint32 attributes = 0;
	AttributesRun* attributesRun = line->AttributesRuns();
	int32 attributesRunCount = line->attributesRunCount;
	int32 nextAttributesAt = attributesRunCount > 0
		? attributesRun->offset : INT_MAX;

	for (int32 i = 0; i < line->byteLength;) {
		// get attributes
		if (charCount == nextAttributesAt) {
			if (charCount < attributesRun->offset) {
				// the "hole" in attributes run
				attributes = 0;
				nextAttributesAt = attributesRun->offset;
			} else if (attributesRunCount > 0) {
				attributes = attributesRun->attributes;
				nextAttributesAt = attributesRun->offset
					+ attributesRun->length;
				attributesRun++;
				attributesRunCount--;
			} else {
				attributes = 0;
				nextAttributesAt = INT_MAX;
			}
		}

		// copy character
		TerminalCell& cell = buffer->cells[charCount++];
		int32 charLength = UTF8Char::ByteCount(chars[i]);
		cell.character.SetTo(chars + i, charLength);
		i += charLength;

		// set attributes
		cell.attributes = attributes;

		// full width char?
		if (cell.character.IsFullWidth()) {
			cell.attributes |= A_WIDTH;
			// attributes of the second, "invisible" cell must be
			// cleared to let full-width chars detection work properly
			buffer->cells[charCount++].attributes = 0;
		}
	}

	buffer->length = charCount;
	buffer->softBreak = line->softBreak;
	buffer->attributes = line->attributes;

	return buffer;
}
示例#2
0
void KouhoView::MouseDown( BPoint point )
{
	KouhoIndexView *iview;
	iview = (KouhoIndexView *)(Window()->FindView( "index" ));
	if ( iview->IsNumberDisplayHidden() )
		return;

	int32 number;
	number = LineAt( point );
	BMessage msg( NUM_SELECTED_FROM_KOUHO_WIN );
	msg.AddInt32( "modifiers", 0 );
	msg.AddInt8( "byte", (int8)number + '1' );
	Window()->PostMessage( &msg );
}
示例#3
0
void DCPUToolchain::PostBatchHook()
{
    Line line = LineAt(debuggingSession, vm->pc);
    if(line.LineNumber != 0) {
        DebuggingMessage m;
        LineHitMessage payload;

        payload.line = line;

        m.type = LineHitType;
        m.value = (MessageValue&) payload;

        debuggingSession->AddMessage(m);
    }
}