Skip to content

Commit

Permalink
fix: Take into account width if set customLocatePosition option
Browse files Browse the repository at this point in the history
  • Loading branch information
unlight committed Feb 19, 2021
1 parent 456b459 commit 29d7d02
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/message-column-width.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ export function messageColumnWidth(
options: NestologOptions,
log: ololog = ololog.configure(options),
): number {
const { contextLimit = 0 } = options;
const { contextLimit = 0, customLocatePosition, customLocateColumnLimit } = options;
let result = 0;
log = log.configure({
render: (input: string) => {
result =
termSize().columns -
ansicolor.strip(input).replace(/\t/g, ' '.repeat(4)).length -
(Math.max(0, contextLimit) || 0);
if (customLocatePosition === 'column') {
result -= customLocateColumnLimit;
}
result = Math.max(0, result) || 0;
},
});
Expand Down

0 comments on commit 29d7d02

Please sign in to comment.