rgieseke / textredux

Text-based interfaces for Textadept
http://rgieseke.github.io/textredux/
Other
58 stars 11 forks source link

Error with latest Textadept version #81

Closed snoopy closed 1 year ago

snoopy commented 2 years ago

Can you confirm this error on the latest version of Textadept? textadept_nightly_2022-10-10/init.lua:283: bad argument #2 to 'connect' (function expected, got nil) Happens with the latest alpha as well.

init.lua used for testing:

local textredux = require('textredux')
textredux.hijack()
rgieseke commented 2 years ago

I haven't yet had a chance to try but thanks for the report!

rgieseke commented 2 years ago

I can reproduce it even with require('textredux'), so hijack is not related to this.

The error message comes from here I think: https://github.com/orbitalquark/textadept/blob/11d0399dd2a8719e002db3e8e16522cf994dee6a/init.lua#L283

If I do a

print(load(table.concat(settings, '\n')))

near that line I get

nil [string "buffer["additional_selection_typing"]=true..."]:64: '(' expected near ':'
rgieseke commented 1 year ago

You can avoid the error message by commenting out this line here:

https://github.com/rgieseke/textredux/blob/5abf1ac4e69119ab74247186d7ed4bbfbc6bf50b/core/style.lua#L199

This still needs a proper fix on initialising the styles.

There have been quite a few changes in the first alpha: https://github.com/orbitalquark/textadept/releases/tag/textadept_11.5_alpha

rgieseke commented 1 year ago

Do you still get this with the latest Qt-based Nightly, @snoopy ? Seems to have fixed this.

https://github.com/orbitalquark/textadept/discussions/300

snoopy commented 1 year ago

Can confirm the issue no longer happens with latest nightly.

rgieseke commented 1 year ago

Thanks for confirming!

snoopy commented 1 year ago

I'm afraid I forgot to remove the fix you proposed before testing with the Qt version. For me the error does indeed persist (your fix still works though), sorry about that.

Did you actually manage to have it work without the fix in the latest Qt-based nightly?

rgieseke commented 1 year ago

Unfortunately, I get the error with the latest Nightly. :-/

rgieseke commented 1 year ago

Removed the code in https://github.com/rgieseke/textredux/commit/2a7acfcc2e36fd1ad9c2629d58b2e2c210432973

It seems to work without that so I hope that's no problem!

snoopy commented 1 year ago

As far as I can tell this change only breaks the highlighting in lists. Everything else is a total mess right now though.

Simply starting TA with the TR hijack enabled results in this error for me: ~/.textadept/modules/textredux/init.lua:115: attempt to index a nil value (field '?'). With line 115 being local goto_mark = m_bookmark[_L['Goto Bookmark...']][2]

I can't get the the wrapped lists to show up reliably anymore either. When they do show up they have the same problem as before where they always return the first entry regardless of user choice.

Thanks for your efforts and I'm sorry I can't offer anything more substantial.

rgieseke commented 1 year ago

Sorry about that. Did you fetch the latest changes from GitHub?

I just tried with a clean .textadept directory (like textadept -u ta-test)

and only

local textredux = require('textredux')

textredux.hijack()

in it. I don't get an error and open file, open recent, select lexer seem to work.

(There is no keyboard shortcut for "Go to Bookmark", so it can't really be hijacked I think, but that's probably a separate issue anyways.)

Please reopen this or a separate issue if you still encounter a problem!