Skip to content

Commit 2a11afc

Browse files
committed
Fix an issue where it crashes when converting with IME. (#526)
1 parent b022384 commit 2a11afc

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

editor/imetooltip.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,22 +173,21 @@ func (i *IMETooltip) parsePreeditString(preeditStr string) {
173173
currConvHl := i.s.getHighlightByHlname("GuiImeCurrentConversionText")
174174

175175
if preeditHl == nil {
176+
preeditHl = &Highlight{}
176177
if i.s.ws.foreground == nil || i.s.ws.background == nil {
177178
return
178179
}
179180

180-
preeditHl = &Highlight{}
181181
preeditHl.foreground = i.s.ws.foreground
182182
preeditHl.background = i.s.ws.background
183183
}
184184

185185
if currConvHl == nil {
186+
currConvHl = &Highlight{}
186187
if i.s.ws.foreground == nil || i.s.ws.background == nil {
187188
return
188189
}
189190

190-
currConvHl = &Highlight{}
191-
192191
if i.s.ws.screenbg == "light" {
193192
currConvHl.foreground = warpColor(i.s.ws.background, -30)
194193
currConvHl.background = warpColor(i.s.ws.foreground, -30)

editor/tooltip.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ func (t *Tooltip) drawContent(p *gui.QPainter, getFont func() *Font) {
6464
fg := chunk.hl.fg()
6565
bg := chunk.hl.bg()
6666
sp := chunk.hl.special
67-
67+
if sp == nil {
68+
sp = fg
69+
}
6870

6971
bold := chunk.hl.bold
7072
italic := chunk.hl.italic

0 commit comments

Comments
 (0)