Replies: 4 comments 7 replies
-
This looks like a similar question to yours: jacobslusser/ScintillaNET#149 (Textadept uses Scintilla.) |
Beta Was this translation helpful? Give feedback.
-
Something like this might work in your ~/.textadept/init.lua: table.insert(textadept.menu.context_menu, {
'Translate', function() ui.print('translate ', buffer:get_sel_text()) end
})
events.connect(events.UPDATE_UI, function(updated)
if updated & buffer.UPDATE_SELECTION == 0 or buffer.selection_empty then return end
ui.popup_menu(ui.context_menu)
end) |
Beta Was this translation helpful? Give feedback.
-
If you want to use a user list, then you'll want to connect to |
Beta Was this translation helpful? Give feedback.
-
Many thanks.
view.auto_c_max_width = 4
events.connect(events.UPDATE_UI, function(updated)
if updated & buffer.UPDATE_SELECTION == 0 or buffer.selection_empty then return end
-- TODO: popup user list when the selection stop, not at the beginning
if not buffer:auto_c_active() then buffer:user_list_show(10000, 'translate search') end
end)
events.connect(events.USER_LIST_SELECTION, function(id, text, pos)
if id == 10000 then
if text == 'search' then ui.dialogs.message{title = text} end
end
buffer:cancel()
end) |
Beta Was this translation helpful? Give feedback.
-
Just like the kindle reading app, I want to select the text, then popup a menu to action further, like search, translate, etc. More handy than keyboard shortcuts.
The user list seems doable, but I can't find the event for selection-complete.
Is there a way to do this?
Beta Was this translation helpful? Give feedback.
All reactions