[GH-ISSUE #340] The tabstop replacement for TextView is incorrect #256

Closed
opened 2026-03-04 01:03:24 +03:00 by kerem · 3 comments
Owner

Originally created by @dzpao on GitHub (Aug 30, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/340

The result of the tabstop replacement should be an integer multiple of tabsize. Instead of simply replacing tabstop with an equal amount of space.

For example, the result of replacing "abc\tdef" should be "abc<space>def" instead of "abc<space><space><space><space>def".

Hope to fix this problem.

Originally created by @dzpao on GitHub (Aug 30, 2019). Original GitHub issue: https://github.com/rivo/tview/issues/340 The result of the tabstop replacement should be an integer multiple of tabsize. Instead of simply replacing tabstop with an equal amount of space. For example, the result of replacing `"abc\tdef"` should be `"abc<space>def"` instead of `"abc<space><space><space><space>def"`. Hope to fix this problem.
kerem closed this issue 2026-03-04 01:03:24 +03:00
Author
Owner

@rivo commented on GitHub (Oct 17, 2019):

The handling of tabs in tview is not as it is in other applications. See here:

Tab characters will be replaced with TabSize space characters.

Granted, this is not the original meaning of a tab. It's a very simple approximation. But I don't see proper tab handling implemented any time soon. It's extremely difficult to make it work, especially with Unicode, wide characters, word-wrapping etc. So for the time being, it will remain as it is.

I'd be open to changing TabSize to 2, though, if enough people agree.

<!-- gh-comment-id:543108950 --> @rivo commented on GitHub (Oct 17, 2019): The handling of tabs in `tview` is not as it is in other applications. See [here](https://godoc.org/github.com/rivo/tview#TextView.Write): > Tab characters will be replaced with TabSize space characters. Granted, this is not the original meaning of a tab. It's a very simple approximation. But I don't see proper tab handling implemented any time soon. It's extremely difficult to make it work, especially with Unicode, wide characters, word-wrapping etc. So for the time being, it will remain as it is. I'd be open to changing `TabSize` to `2`, though, if enough people agree.
Author
Owner

@rivo commented on GitHub (Nov 27, 2019):

Will reopen if this becomes important again.

<!-- gh-comment-id:559184507 --> @rivo commented on GitHub (Nov 27, 2019): Will reopen if this becomes important again.
Author
Owner

@dotnwat commented on GitHub (Apr 23, 2022):

I stumbled upon this issue @rivo debugging tabs in virtual table. For example in this

func (d *TableData) GetCell(row, column int) *tview.TableCell {
    return tview.NewTableCell(d.lines[row])
}

if the text added into the table cell contains one or more leading tabs then they are displayed as if TabSize=0.

<!-- gh-comment-id:1107535720 --> @dotnwat commented on GitHub (Apr 23, 2022): I stumbled upon this issue @rivo debugging tabs in virtual table. For example in this ``` func (d *TableData) GetCell(row, column int) *tview.TableCell { return tview.NewTableCell(d.lines[row]) } ``` if the text added into the table cell contains one or more leading tabs then they are displayed as if TabSize=0.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#256
No description provided.