rgieseke / textredux

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

Line number margin does not get reset #66

Closed snoopy closed 3 years ago

snoopy commented 3 years ago

When switching to a TR buffer the line number margin gets removed. Closing the buffer resets the line number margin.
In some cases the line number margin does not get reset. I haven't been able to ascertain why and when. This will only happen in exactly one normal buffer.

Removing the following lines from bufer.lua will "fix" the problem by never removing the line number margin in TR buffers.

target.margin_width_n[1] = not CURSES and target.margin_width_n[0] + 4 or 1
target.margin_width_n[0] = 0

Obviously there must be a better solution but I don't know what causes this. Maybe something that was overlooked with the switch from 0 to 1 based counting? Seems to be a fairly recent bug anyways.

Can usually be reproduced by selecting a buffer through the buffer list and then cycling through your buffers until you find one without line numbers.

rgieseke commented 3 years ago

Thanks for digging in, fixing the off-by-one (which appears indeed to have been overlooked) seems to work!

snoopy commented 3 years ago

Your patch only fixes half of the problem for me.
Now the margin width gets reset to the correct width but the line numbers are still missing. Did it work for you? Might be some of my settings then.

rgieseke commented 3 years ago

You mean when resetting? For Textredux buffers the margin should appear "empty", by hiding the number view (as one usually doesn't need one for a list of buffers). For curses it's 1 char wide. There seems to be a problem when a message buffer is open, as these have no line numbers any more.

snoopy commented 3 years ago

Still happens with normal buffers just slightly different than before.

  1. Open TA
  2. Open buffer list
  3. Select and switch to a buffer that is not the current buffer
  4. Open the buffer list again
  5. Select and switch back to your previous buffer
  6. No more line numbers

Here is a video using the latest master: https://streamable.com/oqn0v1

rgieseke commented 3 years ago

Thanks for the reproducible bug report and video! I think this might be due to Textadept saving margin width in core/ui.lua

rgieseke commented 3 years ago

Discussion and fix in https://github.com/orbitalquark/textadept/issues/33