rime / home

Rime::Home is home to Rime users and developers
https://rime.im
4.31k stars 233 forks source link

如何设置使输出的字符&nbsp 替换为空格? #921

Closed Nonenever closed 3 years ago

Nonenever commented 3 years ago

在rime中候选项中的&nbsp 替换为空格后输出

Nonenever commented 3 years ago

图像 4

Nonenever commented 3 years ago

local function filter(input) for cand in input:iter() do if string.find(cand.text, "&nbsp") then -- cand.text=string.gsub(cand.text,"&nbsp"," ") yield(string.gsub(cand.text,"&nbsp"," ")) --- 如何写 才对 ,替换显示 end yield(cand) end end return filter

Nonenever commented 3 years ago

在 schema文件的 filters: 下添加 - lua_filter@zhuanyi_filter zhuanyi_filter.lua 为 `local function xform_th(inp) if inp == "" then return "" end inpx = string.gsub(inp, "&nbsp", " ") return inpx .. ")" --加右括号 测试 end

local function filter(input) for cand in input:iter() do cand:get_genuine().text = xform_th((cand.text)) yield(cand)
end
end return filter
` 显示 只有部分为 满足要求,不是全部的,不知道是什么原因?) 1