Skip to content

Commit

Permalink
[aggregators- join- go_col-] replace len() by dispwidth()
Browse files Browse the repository at this point in the history
  • Loading branch information
midichef committed Jan 6, 2025
1 parent 1c707a1 commit 066db54
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions visidata/aggregators.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from copy import copy

from visidata import Progress, Sheet, Column, ColumnsSheet, VisiData
from visidata import vd, anytype, vlen, asyncthread, wrapply, AttrDict, date, INPROGRESS
from visidata import vd, anytype, vlen, asyncthread, wrapply, AttrDict, date, INPROGRESS, dispwidth

vd.help_aggregators = '''# Choose Aggregators
Start typing an aggregator name or description.
Expand Down Expand Up @@ -264,7 +264,7 @@ def chooseAggregators(vd):
prompt = 'choose aggregators: '
def _fmt_aggr_summary(match, row, trigger_key):
formatted_aggrname = match.formatted.get('key', row.key) if match else row.key
r = ' '*(len(prompt)-3)
r = ' '*(dispwidth(prompt)-3)
r += f'[:keystrokes]{trigger_key}[/] '
r += formatted_aggrname
if row.desc:
Expand Down
3 changes: 2 additions & 1 deletion visidata/features/go_col.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def nextColName(sheet, show_cells=True):

def _fmt_colname(match, row, trigger_key):
name = match.formatted.get('name', row.name) if match else row.name
r = ' '*(len(prompt)-3)
r = ' '*(dispwidth(prompt)-3)
r += f'[:keystrokes]{trigger_key}[/] '
if show_cells and len(sheet.rows) > 0:
# pad the right side with spaces
Expand All @@ -46,6 +46,7 @@ def _fmt_colname(match, row, trigger_key):
else:
r += name
return r

name = vd.activeSheet.inputPalette(prompt,
colnames,
value_key='name',
Expand Down
4 changes: 2 additions & 2 deletions visidata/features/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import functools
from copy import copy

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

vd.help_join = '# Join Help\nHELPTODO'

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

0 comments on commit 066db54

Please sign in to comment.