Closing Unused Buffers When Disabling Tabs #264
eric-hemasystems
started this conversation in
Show and tell
Replies: 3 comments 2 replies
-
Thanks for sharing! It's funny you bring it up because for the longest time Textadept did not have tabs (I never needed them). When I finally got around to adding them, it naturally had to be configurable :)
You are correct that Lua does not have a `table.find()` or similar method.
|
Beta Was this translation helpful? Give feedback.
1 reply
-
It's because of this line: https://github.com/orbitalquark/textadept/blob/f6ed0a601b10981c6f0bca0c61fc3155a5cb2ed0/src/textadept.c#L1022
If you change "focused_view" to "dummy_view", then the focused view's buffer does not change. I am not completely sure if there would be any undesirable side effects for making this change. I'll have to experiment. My initial test worked without issue though.
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Hmm, after further investigation, the culprit is actually here: https://github.com/orbitalquark/textadept/blob/f6ed0a601b10981c6f0bca0c61fc3155a5cb2ed0/core/ui.lua#L403
Long ago it was the case that you couldn't call `buffer:close()` on a hidden buffer, so that function to restore the previous buffer always assumed the current view just closed the closed/deleted buffer. I don't really know the best way to handle this, so I've just committed an expected failing test case for my TODO list: 4e032ed. Fortunately you have a workaround for yourself, as this is not high on my priority list.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was glad to see Textadept had the
ui.tabs = false
configuration. I never find tabs useful. If I want to re-visit a file I previous had open I generally use the quick open dialog as I can just type a few characters of the filename and hit enter vs trying to figure out if it's an already open tab and where it is in the tab list.But just disabling the tabs left the buffers open. Some might find this useful as they want to use the open buffer dialog or something. But again I tend to prefer to just hit the quick open dialog so I would rather the new buffer replace the old buffer not add it to a stack.
Luckily Textadept is so customizable I was able to make this happen with:
Thought I would share it in case anybody else has the same desire to disable tabs and have new buffers replace the old buffer vs add the new buffer on top of the old buffer.
Side question, I'm new to Lua. Does it seriously not have a function to test if an item is in an list? Seems like something that should just be part of the stdlib. It was easy to implement but still....
Beta Was this translation helpful? Give feedback.
All reactions