<commit_before>#include "NotifyingTextView.h"

/*
 * Copyright 2003-2009, IM Kit Team.
 * Distributed under the terms of the MIT License.
 *
 * Authors:
 *	<NAME> <<EMAIL>>
 */

#include <app/Messenger.h>

//#pragma mark Constructor

NotifyingTextView::NotifyingTextView(BRect frame, const char *name, BRect textRect, uint32 resizingMode, uint32 flags)
	: BTextView(frame, name, textRect, resizingMode, flags),
	fMessenger(NULL) {
};

NotifyingTextView::~NotifyingTextView(void) {
	if (fMessenger != NULL) delete fMessenger;
};

//#pragma mark Public

void NotifyingTextView::SetHandler(BHandler *handler) {
	if (fMessenger != NULL) delete fMessenger;
	
	fMessenger = new BMessenger(handler);
};

BMessage NotifyingTextView::NotificationMessage(void) const {
	return fMessage;
};

void NotifyingTextView::SetNotificationMessage(BMessage msg) {
	fMessage = msg;
}
		
//#pragma mark BTextView Hooks

void NotifyingTextView::InsertText(const char *text, int32 length, int32 offset, const text_run_array *runs = NULL) {
	if ((fMessenger != NULL) && (fMessenger->IsValid() == true)) {
		BMessage msg(fMessage);
		msg.AddPointer("source", this);
		
		fMessenger->SendMessage(&msg);
	};
};

void NotifyingTextView::DeleteText(int32 start, int32 finish) {
	if ((fMessenger != NULL) && (fMessenger->IsValid() == true)) {
		BMessage msg(fMessage);
		msg.AddPointer("source", this);
		
		fMessenger->SendMessage(&msg);
	};
};

<commit_msg>Common: Fixed the NotifyingTextView - I was not calling the base methods for InsertText and DeleteText. This will not fix the issue on Haiku though<commit_after>#include "NotifyingTextView.h"

/*
 * Copyright 2003-2009, IM Kit Team.
 * Distributed under the terms of the MIT License.
 *
 * Authors:
 *	<NAME> <<EMAIL>>
 */

#include <app/Messenger.h>

//#pragma mark Constructor

NotifyingTextView::NotifyingTextView(BRect frame, const char *name, BRect textRect, uint32 resizingMode, uint32 flags)
	: BTextView(frame, name, textRect, resizingMode, flags),
	fMessenger(NULL) {
};

NotifyingTextView::~NotifyingTextView(void) {
	if (fMessenger != NULL) delete fMessenger;
};

//#pragma mark Public

void NotifyingTextView::SetHandler(BHandler *handler) {
	if (fMessenger != NULL) delete fMessenger;
	
	fMessenger = new BMessenger(handler);
};

BMessage NotifyingTextView::NotificationMessage(void) const {
	return fMessage;
};

void NotifyingTextView::SetNotificationMessage(BMessage msg) {
	fMessage = msg;
}
		
//#pragma mark BTextView Hooks

void NotifyingTextView::InsertText(const char *text, int32 length, int32 offset, const text_run_array *runs = NULL) {
	if ((fMessenger != NULL) && (fMessenger->IsValid() == true)) {
		BMessage msg(fMessage);
		msg.AddPointer("source", this);
		
		fMessenger->SendMessage(&msg);
	};
	
	BTextView::InsertText(text, length, offset, runs);
};

void NotifyingTextView::DeleteText(int32 start, int32 finish) {
	if ((fMessenger != NULL) && (fMessenger->IsValid() == true)) {
		BMessage msg(fMessage);
		msg.AddPointer("source", this);
		
		fMessenger->SendMessage(&msg);
	};
	
	BTextView::DeleteText(start, finish);
};


{'fraction_non_alphanumeric': 0.13517017828200972, 'fraction_numerical': 0.012965964343598054, 'mean_word_length': 5.44258872651357, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5601874', 'n_tokens_mistral': 1071, 'n_tokens_neox': 980, 'n_words': 251}