ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/xim-onthespot
(Generate patch)

Comparing rxvt-unicode/src/perl/xim-onthespot (file contents):
Revision 1.1 by root, Wed Jan 25 00:42:21 2006 UTC vs.
Revision 1.7 by root, Tue Sep 4 22:41:12 2012 UTC

1#! perl 1#! perl
2
3=head1 NAME
4
5xim-onthespot - implement XIM "on-the-spot" behaviour
6
7=head1 DESCRIPTION
8
9This perl extension implements OnTheSpot editing. It does not work
10perfectly, and some input methods don't seem to work well with OnTheSpot
11editing in general, but it seems to work at least for SCIM and kinput2.
12
13You enable it by specifying this extension and a preedit style of
14C<OnTheSpot>, i.e.:
15
16 urxvt -pt OnTheSpot -pe xim-onthespot
17
18=cut
2 19
3# 20#
4# problems with this implementation include 21# problems with this implementation include
5# 22#
6# - primary, secondary, teriary is NOT different to other hilighting 23# - primary, secondary, tertiary are NO different to other highlighting styles
7# - if rend values are missing, they are not interpolated 24# - if rend values are missing, they are not being interpolated
8# 25#
9 26
10my $SIZEOF_LONG = length pack "l!", 0; 27my $SIZEOF_LONG = length pack "l!", 0;
11 28
12sub refresh { 29sub refresh {
25 my @rend = map { 42 my @rend = map {
26 my $rstyle = $self->{caret} == $idx ? urxvt::OVERLAY_RSTYLE : $self->rstyle; 43 my $rstyle = $self->{caret} == $idx ? urxvt::OVERLAY_RSTYLE : $self->rstyle;
27 44
28 $rstyle |= urxvt::RS_Uline if $_ & (urxvt::XIMUnderline | urxvt::XIMPrimary); 45 $rstyle |= urxvt::RS_Uline if $_ & (urxvt::XIMUnderline | urxvt::XIMPrimary);
29 $rstyle |= urxvt::RS_RVid if $_ & (urxvt::XIMReverse | urxvt::XIMSecondary); 46 $rstyle |= urxvt::RS_RVid if $_ & (urxvt::XIMReverse | urxvt::XIMSecondary);
30 $rstyle |= urxvt::RS_Blink if $_ & (urxvt::XIMHighlight | urxvt::XIMTertiary); 47 $rstyle |= urxvt::RS_Italic if $_ & (urxvt::XIMHighlight | urxvt::XIMTertiary);
31 48
32 ($rstyle) x ($self->strwidth (substr $text, $idx++, 1)) 49 ($rstyle) x ($self->strwidth (substr $text, $idx++, 1))
33 } unpack "l!*", $self->{rend}; 50 } unpack "l!*", $self->{rend};
34 51
35 if ($self->{caret} >= length $text) { 52 if ($self->{caret} >= length $text) {
55 delete $self->{rend}; 72 delete $self->{rend};
56 73
57 () 74 ()
58} 75}
59 76
60sub on_xim_preedit_caret {
61 my ($self, $pos, $dir, $style) = @_;
62 warn "preedit_caret(@_)\n";
63 ()
64}
65
66sub on_xim_preedit_draw { 77sub on_xim_preedit_draw {
67 my ($self, $caret, $pos, $len, $feedback, $chars) = @_; 78 my ($self, $caret, $pos, $len, $feedback, $chars) = @_;
68 79
69 $self->{caret} = $caret; 80 $self->{caret} = $caret;
70 81

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines