@trendr/core 0.4.10 → 0.4.11
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.
- package/package.json +1 -1
- package/src/ansi.js +3 -0
- package/src/diff-view.js +1 -1
- package/src/dropdown.js +1 -1
- package/src/list.js +1 -1
- package/src/renderer.js +1 -0
- package/src/scroll-box.js +1 -1
- package/src/scrollable-text.js +1 -1
- package/src/selection.js +5 -3
- package/src/text-area.js +1 -1
package/package.json
CHANGED
package/src/ansi.js
CHANGED
|
@@ -28,6 +28,9 @@ export const ITALIC = 4
|
|
|
28
28
|
export const UNDERLINE = 8
|
|
29
29
|
export const INVERSE = 16
|
|
30
30
|
export const STRIKETHROUGH = 32
|
|
31
|
+
// never emitted as sgr: marks ui chrome cells (scrollbars, counters) that
|
|
32
|
+
// text selection should skip when extracting copy text
|
|
33
|
+
export const COPY_IGNORE = 64
|
|
31
34
|
|
|
32
35
|
const ATTR_CODES = [
|
|
33
36
|
[BOLD, '1'],
|
package/src/diff-view.js
CHANGED
|
@@ -236,7 +236,7 @@ export function Diff({
|
|
|
236
236
|
const isThumb = i >= thumbStart && i < thumbStart + thumbH
|
|
237
237
|
bar.push(jsx('text', {
|
|
238
238
|
key: i,
|
|
239
|
-
style: { color:
|
|
239
|
+
style: { color: palette.lineNo, dim: !isThumb, copyIgnore: true },
|
|
240
240
|
children: isThumb ? '█' : '│',
|
|
241
241
|
}))
|
|
242
242
|
}
|
package/src/dropdown.js
CHANGED
|
@@ -126,7 +126,7 @@ export function Dropdown({ items, cursor, scroll, visibleCount, width, onSubmit,
|
|
|
126
126
|
children: [
|
|
127
127
|
content,
|
|
128
128
|
jsx('text', {
|
|
129
|
-
style: { color: barIsThumb ? s.accent : muted, dim: !barIsThumb },
|
|
129
|
+
style: { color: barIsThumb ? s.accent : muted, dim: !barIsThumb, copyIgnore: true },
|
|
130
130
|
children: ' ' + (barIsThumb ? '█' : '│'),
|
|
131
131
|
}),
|
|
132
132
|
],
|
package/src/list.js
CHANGED
|
@@ -190,7 +190,7 @@ export function List({ items = [], selected: selectedProp, onSelect, onCursorCha
|
|
|
190
190
|
barChildren.push(
|
|
191
191
|
jsx('text', {
|
|
192
192
|
key: i,
|
|
193
|
-
style: { color: isThumb ? (focused ? accent : muted) : muted, dim: !isThumb },
|
|
193
|
+
style: { color: isThumb ? (focused ? accent : muted) : muted, dim: !isThumb, copyIgnore: true },
|
|
194
194
|
children: isThumb ? '\u2588' : '\u2502',
|
|
195
195
|
})
|
|
196
196
|
)
|
package/src/renderer.js
CHANGED
|
@@ -98,6 +98,7 @@ function resolveAttrs(style) {
|
|
|
98
98
|
if (style.underline) attrs |= ansi.UNDERLINE
|
|
99
99
|
if (style.inverse) attrs |= ansi.INVERSE
|
|
100
100
|
if (style.strikethrough) attrs |= ansi.STRIKETHROUGH
|
|
101
|
+
if (style.copyIgnore) attrs |= ansi.COPY_IGNORE
|
|
101
102
|
return attrs
|
|
102
103
|
}
|
|
103
104
|
|
package/src/scroll-box.js
CHANGED
|
@@ -93,7 +93,7 @@ export function ScrollBox({ children, focused = true, scrollOffset: offsetProp,
|
|
|
93
93
|
barChildren.push(
|
|
94
94
|
jsx('text', {
|
|
95
95
|
key: i,
|
|
96
|
-
style: { color: isThumb ? (focused ? accent : muted) : muted, dim: !isThumb },
|
|
96
|
+
style: { color: isThumb ? (focused ? accent : muted) : muted, dim: !isThumb, copyIgnore: true },
|
|
97
97
|
children: isThumb ? thumbChar : trackChar,
|
|
98
98
|
})
|
|
99
99
|
)
|
package/src/scrollable-text.js
CHANGED
|
@@ -89,7 +89,7 @@ export function ScrollableText({ content = '', focused = true, scrollOffset: off
|
|
|
89
89
|
style: { flexDirection: 'row', height: 1 },
|
|
90
90
|
children: [
|
|
91
91
|
jsx('text', { style: { flexGrow: 1, ...textStyle }, children: line || ' ' }),
|
|
92
|
-
jsx('text', { style: { color: barColor, dim: !isThumb }, children: ' ' + barChar }),
|
|
92
|
+
jsx('text', { style: { color: barColor, dim: !isThumb, copyIgnore: true }, children: ' ' + barChar }),
|
|
93
93
|
],
|
|
94
94
|
})
|
|
95
95
|
})
|
package/src/selection.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMouse } from './hooks.js'
|
|
2
2
|
import { getContext, registerHook } from './renderer.js'
|
|
3
|
-
import { osc52Copy } from './ansi.js'
|
|
3
|
+
import { osc52Copy, COPY_IGNORE } from './ansi.js'
|
|
4
4
|
|
|
5
5
|
function normalize(a, b) {
|
|
6
6
|
const forward = a.y < b.y || (a.y === b.y && a.x <= b.x)
|
|
@@ -22,8 +22,10 @@ export function extractSelectionText(buf, sel) {
|
|
|
22
22
|
const to = y === sel.ey ? Math.min(sel.ex, buf.width - 1) : buf.width - 1
|
|
23
23
|
let text = ''
|
|
24
24
|
for (let x = 0; x <= to; x++) {
|
|
25
|
-
const
|
|
26
|
-
if (ch === '') continue
|
|
25
|
+
const cell = buf.cells[y * buf.width + x]
|
|
26
|
+
if (cell.ch === '') continue
|
|
27
|
+
// chrome cells (scrollbars, counters) never belong in copied text
|
|
28
|
+
const ch = cell.attrs & COPY_IGNORE ? ' ' : cell.ch
|
|
27
29
|
text += y === sel.sy && x < sel.sx ? ' ' : ch
|
|
28
30
|
}
|
|
29
31
|
rows.push({ text: text.replace(/\s+$/, ''), soft: !!buf.softWrap[y] })
|
package/src/text-area.js
CHANGED
|
@@ -372,7 +372,7 @@ export function TextArea({ onSubmit, onCancel, onChange, onKeyDown, placeholder,
|
|
|
372
372
|
const counter = counterActive
|
|
373
373
|
? jsx('box', {
|
|
374
374
|
style: { flexDirection: 'row', height: 1 },
|
|
375
|
-
children: jsx('text', { style: { color: muted, dim: true }, children: `${displayPos.row + 1}/${lineMap.length}` }),
|
|
375
|
+
children: jsx('text', { style: { color: muted, dim: true, copyIgnore: true }, children: `${displayPos.row + 1}/${lineMap.length}` }),
|
|
376
376
|
})
|
|
377
377
|
: null
|
|
378
378
|
|