1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | # |
3 | # |
4 | # problems with this implementation include |
4 | # problems with this implementation include |
5 | # |
5 | # |
6 | # - primary, secondary, teriary is NOT different to other hilighting |
6 | # - primary, secondary, tertiary are NO different to other highlighting styles |
7 | # - if rend values are missing, they are not interpolated |
7 | # - if rend values are missing, they are not being interpolated |
8 | # |
8 | # |
9 | |
9 | |
10 | my $SIZEOF_LONG = length pack "l!", 0; |
10 | my $SIZEOF_LONG = length pack "l!", 0; |
11 | |
11 | |
12 | sub refresh { |
12 | sub refresh { |
… | |
… | |
25 | my @rend = map { |
25 | my @rend = map { |
26 | my $rstyle = $self->{caret} == $idx ? urxvt::OVERLAY_RSTYLE : $self->rstyle; |
26 | my $rstyle = $self->{caret} == $idx ? urxvt::OVERLAY_RSTYLE : $self->rstyle; |
27 | |
27 | |
28 | $rstyle |= urxvt::RS_Uline if $_ & (urxvt::XIMUnderline | urxvt::XIMPrimary); |
28 | $rstyle |= urxvt::RS_Uline if $_ & (urxvt::XIMUnderline | urxvt::XIMPrimary); |
29 | $rstyle |= urxvt::RS_RVid if $_ & (urxvt::XIMReverse | urxvt::XIMSecondary); |
29 | $rstyle |= urxvt::RS_RVid if $_ & (urxvt::XIMReverse | urxvt::XIMSecondary); |
30 | $rstyle |= urxvt::RS_Blink if $_ & (urxvt::XIMHighlight | urxvt::XIMTertiary); |
30 | $rstyle |= urxvt::RS_Italic if $_ & (urxvt::XIMHighlight | urxvt::XIMTertiary); |
31 | |
31 | |
32 | ($rstyle) x ($self->strwidth (substr $text, $idx++, 1)) |
32 | ($rstyle) x ($self->strwidth (substr $text, $idx++, 1)) |
33 | } unpack "l!*", $self->{rend}; |
33 | } unpack "l!*", $self->{rend}; |
34 | |
34 | |
35 | if ($self->{caret} >= length $text) { |
35 | if ($self->{caret} >= length $text) { |
… | |
… | |
55 | delete $self->{rend}; |
55 | delete $self->{rend}; |
56 | |
56 | |
57 | () |
57 | () |
58 | } |
58 | } |
59 | |
59 | |
60 | sub on_xim_preedit_caret { |
|
|
61 | my ($self, $pos, $dir, $style) = @_; |
|
|
62 | warn "preedit_caret(@_)\n"; |
|
|
63 | () |
|
|
64 | } |
|
|
65 | |
|
|
66 | sub on_xim_preedit_draw { |
60 | sub on_xim_preedit_draw { |
67 | my ($self, $caret, $pos, $len, $feedback, $chars) = @_; |
61 | my ($self, $caret, $pos, $len, $feedback, $chars) = @_; |
68 | |
62 | |
69 | $self->{caret} = $caret; |
63 | $self->{caret} = $caret; |
70 | |
64 | |