view fix-casts.sh @ 28987:ed0c4defd3dd

Fix scrolling bug for very busy chat rooms. The bug shows up only when smooth-scrolling is enabled. When the imhtml widget is still scrolling (such that an entire line still needs to be scrolled), and a new message comes in, it thinks the user isn't looking at the end of the buffer, so it doesn't scroll for the new message. The fix is to detect that and not disable the scrolling in such cases.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 21 Nov 2009 19:40:03 +0000
parents c3ca613ab550
children
line wrap: on
line source

#!/bin/sh

if [ $# -eq 0 ]; then
	echo "Usage: `basename "$0"` PurpleFoo..."
	echo
	echo "This script searches the *current working directory* and replaces casts"
	echo "with GObject-style type checking and casting macros."
	echo 'For example, "(PurpleBuddy *)b" becomes "PURPLE_BUDDY(b)".'
	exit 0
fi

for struct in $* ; do
	cast=`echo $struct | sed "s|[A-Z]|_\0|g" | tr "a-z" "A-Z" | sed "s|^_||"`
	for file in `grep -rl "([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)" . --include=*.c --exclude=purple-client-bindings.c` ; do
		sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*(|$cast(|g" $file
		sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*\([^(][^,);]*\)|$cast(\1)|g" $file
	done
done