mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-24 16:21:04 +00:00
fix: allow access to the current tab via tabs for consistency
This commit is contained in:
parent
22ecad47ab
commit
8bf0d6428f
1 changed files with 1 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use mlua::{AnyUserData, ExternalError, Lua, MetaMethod, UserDataFields, UserDataMethods};
|
use mlua::{AnyUserData, Lua, MetaMethod, UserDataFields, UserDataMethods};
|
||||||
|
|
||||||
use super::{Tab, SCOPE};
|
use super::{Tab, SCOPE};
|
||||||
|
|
||||||
|
|
@ -29,8 +29,6 @@ impl Tabs {
|
||||||
reg.add_meta_method(MetaMethod::Index, |_, me, idx: usize| {
|
reg.add_meta_method(MetaMethod::Index, |_, me, idx: usize| {
|
||||||
if idx > me.len() || idx == 0 {
|
if idx > me.len() || idx == 0 {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
} else if idx - 1 == me.idx {
|
|
||||||
Err("Use `active` instead of `tabs` to access the current tab".into_lua_err())
|
|
||||||
} else {
|
} else {
|
||||||
Some(Tab::make(&me[idx - 1])).transpose()
|
Some(Tab::make(&me[idx - 1])).transpose()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue