Skip to content

Commit

Permalink
Remove strlen()
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Dec 23, 2023
1 parent fc25634 commit 5de9271
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion denops/ddu/ddu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1978,7 +1978,7 @@ export class Ddu {

// Check text width.
const width = await fn.strdisplaywidth(denops, text.text);
const len = await fn.strlen(denops, text.text);
const len = (new TextEncoder()).encode(text.text).length;
if (width < len) {
// NOTE: Padding is needed. Because Vim/neovim highlight is length.
startCol += len - width;
Expand Down
4 changes: 2 additions & 2 deletions doc/ddu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ highlights (object[]) (Optional)

width (number)
The highlight end width.
NOTE: It is string length instead of display width.
NOTE: It is |strlen()| instead of |strdisplaywidth()|.

*ddu-item-attribute-status*
status (object) (Optional)
Expand Down Expand Up @@ -1300,7 +1300,7 @@ getText (function) (Required)
It is called to get column text with highlights.
The text length must be same with
|ddu-column-attribute-getLength|.
NOTE: The highlight length is not same with display width!
NOTE: The highlight length is not same with display width.
It is Vim/neovim highlight feature.

*ddu-column-attribute-onInit*
Expand Down

0 comments on commit 5de9271

Please sign in to comment.