txl_console 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: txl_console
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: TXL plugin for a Jupyter console
5
5
  Project-URL: Source, https://github.com/davidbrochart/jpterm/plugins/console
6
6
  Author-email: David Brochart <david.brochart@gmail.com>
@@ -0,0 +1 @@
1
+ __version__ = "0.2.2"
@@ -67,34 +67,35 @@ class _Console(Console, VerticalScroll, metaclass=ConsoleMeta):
67
67
  if target == "cells":
68
68
  for event in events:
69
69
  if isinstance(event, ArrayEvent):
70
- insert = None
71
- retain = None
72
- for d in event.delta:
73
- if "insert" in d:
74
- insert = d["insert"]
75
- elif "retain" in d:
76
- retain = d["retain"]
77
- i = 0 if retain is None else retain
78
- if insert is not None:
79
- for c in insert:
80
- cell = self.cell_factory(
81
- ycell=c,
82
- language=self.language,
83
- kernel=self.kernel,
84
- show_execution_count=False,
85
- show_border=False,
86
- )
87
- if not self.cells:
88
- self.mount(cell)
89
- else:
90
- if i < len(self.cells):
91
- self.mount(cell, before=self.cells[i])
70
+ if len(event.path) < 2:
71
+ insert = None
72
+ retain = None
73
+ for d in event.delta:
74
+ if "insert" in d:
75
+ insert = d["insert"]
76
+ elif "retain" in d:
77
+ retain = d["retain"]
78
+ i = 0 if retain is None else retain
79
+ if insert is not None:
80
+ for c in insert:
81
+ cell = self.cell_factory(
82
+ ycell=c,
83
+ language=self.language,
84
+ kernel=self.kernel,
85
+ show_execution_count=False,
86
+ show_border=False,
87
+ )
88
+ if not self.cells:
89
+ self.mount(cell)
92
90
  else:
93
- self.mount(cell, after=self.cells[i - 1])
94
- if i <= self.cell_i:
95
- self.cell_i += 1
96
- self.cells.insert(i, cell)
97
- i += 1
91
+ if i < len(self.cells):
92
+ self.mount(cell, before=self.cells[i])
93
+ else:
94
+ self.mount(cell, after=self.cells[i - 1])
95
+ if i <= self.cell_i:
96
+ self.cell_i += 1
97
+ self.cells.insert(i, cell)
98
+ i += 1
98
99
  if self.cells:
99
100
  self.cells[self.cell_i].select()
100
101
 
@@ -1 +0,0 @@
1
- __version__ = "0.2.0"
File without changes
File without changes
File without changes
File without changes