|
1
|
|
|
"""API for working with Nvim windows.""" |
|
2
|
6 |
|
from .common import Remote |
|
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
|
|
5
|
6 |
|
__all__ = ('Window') |
|
6
|
|
|
|
|
7
|
|
|
|
|
8
|
6 |
|
class Window(Remote): |
|
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
"""A remote Nvim window.""" |
|
11
|
|
|
|
|
12
|
6 |
|
_api_prefix = "window_" |
|
13
|
|
|
|
|
14
|
|
|
@property |
|
15
|
|
|
def buffer(self): |
|
16
|
|
|
"""Get the `Buffer` currently being displayed by the window.""" |
|
17
|
|
|
return self._session.request('window_get_buffer', self) |
|
|
|
|
|
|
18
|
6 |
|
|
|
19
|
6 |
|
@property |
|
20
|
6 |
|
def cursor(self): |
|
21
|
|
|
"""Get the (row, col) tuple with the current cursor position.""" |
|
22
|
6 |
|
return self._session.request('window_get_cursor', self) |
|
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
@cursor.setter |
|
25
|
6 |
|
def cursor(self, pos): |
|
26
|
|
|
"""Set the (row, col) tuple as the new cursor position.""" |
|
27
|
|
|
return self._session.request('window_set_cursor', self, pos) |
|
|
|
|
|
|
28
|
6 |
|
|
|
29
|
|
|
@property |
|
30
|
6 |
|
def height(self): |
|
31
|
|
|
"""Get the window height in rows.""" |
|
32
|
|
|
return self._session.request('window_get_height', self) |
|
|
|
|
|
|
33
|
6 |
|
|
|
34
|
|
|
@height.setter |
|
35
|
6 |
|
def height(self, height): |
|
36
|
|
|
"""Set the window height in rows.""" |
|
37
|
|
|
return self._session.request('window_set_height', self, height) |
|
|
|
|
|
|
38
|
6 |
|
|
|
39
|
|
|
@property |
|
40
|
6 |
|
def width(self): |
|
41
|
|
|
"""Get the window width in rows.""" |
|
42
|
|
|
return self._session.request('window_get_width', self) |
|
|
|
|
|
|
43
|
6 |
|
|
|
44
|
|
|
@width.setter |
|
45
|
6 |
|
def width(self, width): |
|
46
|
|
|
"""Set the window height in rows.""" |
|
47
|
|
|
return self._session.request('window_set_width', self, width) |
|
|
|
|
|
|
48
|
6 |
|
|
|
49
|
|
|
@property |
|
50
|
6 |
|
def row(self): |
|
51
|
|
|
"""0-indexed, on-screen window position(row) in display cells.""" |
|
52
|
|
|
return self._session.request('window_get_position', self)[0] |
|
|
|
|
|
|
53
|
6 |
|
|
|
54
|
|
|
@property |
|
55
|
6 |
|
def col(self): |
|
56
|
|
|
"""0-indexed, on-screen window position(col) in display cells.""" |
|
57
|
|
|
return self._session.request('window_get_position', self)[1] |
|
|
|
|
|
|
58
|
6 |
|
|
|
59
|
|
|
@property |
|
60
|
6 |
|
def tabpage(self): |
|
61
|
|
|
"""Get the `Tabpage` that contains the window.""" |
|
62
|
|
|
return self._session.request('window_get_tabpage', self) |
|
|
|
|
|
|
63
|
6 |
|
|
|
64
|
|
|
@property |
|
65
|
6 |
|
def valid(self): |
|
66
|
|
|
"""Return True if the window still exists.""" |
|
67
|
|
|
return self._session.request('window_is_valid', self) |
|
|
|
|
|
|
68
|
|
|
|
This can be caused by one of the following:
1. Missing Dependencies
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
2. Missing __init__.py files
This error could also result from missing
__init__.pyfiles in your module folders. Make sure that you place one file in each sub-folder.