On Fri, 22 Feb 2019, David Tamar wrote:
> Thanks, Mitchell!
> I adjusted the width to 36px and it looks amazing and so clickable!
> I've removed the horizontal line and I think it's nearly perfect at this point, so I'm content with the current solution, but I didn't manage to get the event handler work properly.
> The function `toggle_fold_show_text` didn't work for some reason, and it also doesn't seem to appear in the autocomplete options nor in the API docs. There's a similar function called `toggle_fold_display_text` which I tried to use instead, but Textadept's Lua interpreter says it's just `nil` as if this function doesn't exist. I guess the function was renamed just recently? (my Textadept version is 10.2)
The API documentation has a typo. It should be `toggle_fold_show_text()`.
> I then tried to test the event with the basic function `toggle_fold` to merely figure out if the event is being invoked at all. I found out that the event is invoked only if I press on either margin  or the empty margin  which is between the folding markers and the text itself. However, the event won't trigger at all if I'm pressing on the folding margin  itself or on the line numbers' margin .
Hmm, it looks like Scintilla (Textadept's editing component) is automatically handling folding margin clicks and not forwarding them to Textadept. There may be a workaround, but I do not know it off the top of my head.
> When the event is invoked at margins  and , it prints correct 0-based line number & margin index, but neither of the functions `toggle_fold`, `toggle_fold_show_text` or `toggle_fold_display_text` manage to fold the clause starting at this line. I tried to use a 1-based line index as well by sending `line + 1` to each of these functions, it didn't work either.
> Here's the event that I've placed in my init.lua:
> `buffer.fold_display_text_style = buffer.FOLDDISPLAYTEXT_BOXED
> function(margin, position)
> --if margin ~= 2 then return end
> local line = buffer:line_from_position(position)
> ui.print("Line: " .. tostring(line) .. ", margin: " .. tostring(margin)) -- debug
> --buffer:toggle_fold_show_text(line, '[...]')
> --buffer:toggle_fold_display_text(line, '[...]')
The `ui.print()` call is changing the current buffer, so the `buffer:toggle_fold()` is operating on the message buffer, not your previous code buffer.
-- You are subscribed to code.att.foicica.com. To change subscription settings, send an e-mail to code+help.att.foicica.com. To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.Received on Fri 22 Feb 2019 - 15:40:56 EST
This archive was generated by hypermail 2.2.0 : Sat 23 Feb 2019 - 06:40:17 EST