|
楼主 |
发表于 2024-4-29 22:38:44
|
显示全部楼层
本帖最后由 jarlyyn 于 2024-4-29 10:54 PM 编辑
大概处理的代码,给需要的人,我是响应所有的行,自己按自己格式存一份了。- createBuffer('hclua_line')
- local function online()
- local all = getCurrentLine()
- selectCurrentLine()
- copy()
- clearWindow('hclua_line')
- paste('hclua_line')
- moveCursor('hclua_line',utf8.len(all), 0)
- insertText('hclua_line',' ')
-
- local newline = line.Line:new()
- if all == '' then
- return
- end
- local last = ''
- local text = ''
- local lastresult
- for i = 0, utf8.len(all)-1, 1 do
- moveCursor('hclua_line',i, 0)
- selectSection('hclua_line',i, 1)
- local result = getTextFormat('hclua_line')
- local format = hashformat(result)
- if format ~= last then
- if text ~= '' then
- local word = newword(lastresult)
- word.Text = text
- newline:appendWord(word)
- end
- text=''
- last = format
- lastresult=result
- end
- text = text .. getSelection('hclua_line')
- end
- if text ~= '' then
- local word = newword(lastresult)
- word.Text = text
- newline:appendWord(word)
- end
- print(newline:toShort())
- end
复制代码
|
|