Skip to content

Commit 066db54

Browse files
committed
[aggregators- join- go_col-] replace len() by dispwidth()
1 parent 1c707a1 commit 066db54

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

visidata/aggregators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from copy import copy
77

88
from visidata import Progress, Sheet, Column, ColumnsSheet, VisiData
9-
from visidata import vd, anytype, vlen, asyncthread, wrapply, AttrDict, date, INPROGRESS
9+
from visidata import vd, anytype, vlen, asyncthread, wrapply, AttrDict, date, INPROGRESS, dispwidth
1010

1111
vd.help_aggregators = '''# Choose Aggregators
1212
Start typing an aggregator name or description.
@@ -264,7 +264,7 @@ def chooseAggregators(vd):
264264
prompt = 'choose aggregators: '
265265
def _fmt_aggr_summary(match, row, trigger_key):
266266
formatted_aggrname = match.formatted.get('key', row.key) if match else row.key
267-
r = ' '*(len(prompt)-3)
267+
r = ' '*(dispwidth(prompt)-3)
268268
r += f'[:keystrokes]{trigger_key}[/] '
269269
r += formatted_aggrname
270270
if row.desc:

visidata/features/go_col.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def nextColName(sheet, show_cells=True):
3232

3333
def _fmt_colname(match, row, trigger_key):
3434
name = match.formatted.get('name', row.name) if match else row.name
35-
r = ' '*(len(prompt)-3)
35+
r = ' '*(dispwidth(prompt)-3)
3636
r += f'[:keystrokes]{trigger_key}[/] '
3737
if show_cells and len(sheet.rows) > 0:
3838
# pad the right side with spaces
@@ -46,6 +46,7 @@ def _fmt_colname(match, row, trigger_key):
4646
else:
4747
r += name
4848
return r
49+
4950
name = vd.activeSheet.inputPalette(prompt,
5051
colnames,
5152
value_key='name',

visidata/features/join.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import functools
44
from copy import copy
55

6-
from visidata import vd, VisiData, asyncthread, Sheet, Progress, IndexSheet, Column, CellColorizer, ColumnItem, SubColumnItem, TypedWrapper, ColumnsSheet, AttrDict
6+
from visidata import vd, VisiData, asyncthread, Sheet, Progress, IndexSheet, Column, CellColorizer, ColumnItem, SubColumnItem, TypedWrapper, ColumnsSheet, AttrDict, dispwidth
77

88
vd.help_join = '# Join Help\nHELPTODO'
99

@@ -367,7 +367,7 @@ def chooseJointype(vd):
367367
prompt = 'choose jointype: '
368368
def _fmt_aggr_summary(match, row, trigger_key):
369369
formatted_jointype = match.formatted.get('key', row.key) if match else row.key
370-
r = ' '*(len(prompt)-3)
370+
r = ' '*(dispwidth(prompt)-3)
371371
r += f'[:keystrokes]{trigger_key}[/] '
372372
r += formatted_jointype
373373
if row.desc:

0 commit comments

Comments
 (0)