Total Complexity | 5 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | """API for working with Nvim tabpages.""" |
||
8 | 5 | class Tabpage(Remote): |
|
9 | """A remote Nvim tabpage.""" |
||
10 | |||
11 | 5 | _api_prefix = "nvim_tabpage_" |
|
12 | |||
13 | 5 | def __init__(self, *args): |
|
14 | """Initialize from session and code_data immutable object. |
||
15 | |||
16 | The `code_data` contains serialization information required for |
||
17 | msgpack-rpc calls. It must be immutable for Buffer equality to work. |
||
18 | """ |
||
19 | 5 | super(Tabpage, self).__init__(*args) |
|
20 | 5 | self.windows = RemoteSequence(self, 'nvim_tabpage_list_wins') |
|
21 | |||
22 | 5 | def __repr__(self): |
|
23 | """Get text representation of the tabpage.""" |
||
24 | return 'Tabpage(number=%r, window=%r, handle=%r)' % ( |
||
25 | 5 | self.number, |
|
26 | self.window, |
||
27 | 5 | self.handle, |
|
28 | ) |
||
29 | |||
30 | 5 | @property |
|
31 | def window(self): |
||
32 | 5 | """Get the `Window` currently focused on the tabpage.""" |
|
33 | return self.request('nvim_tabpage_get_win') |
||
34 | |||
35 | 5 | @property |
|
36 | def valid(self): |
||
37 | """Return True if the tabpage still exists.""" |
||
38 | return self.request('nvim_tabpage_is_valid') |
||
39 | |||
40 | @property |
||
41 | def number(self): |
||
42 | """Get the tabpage number.""" |
||
43 | return self.request('nvim_tabpage_get_number') |
||
44 |