Git Product home page Git Product logo

terminaltables's Introduction

terminaltables's People

Contributors

aleivag avatar bcho avatar kovacsbalu avatar liiight avatar msabramo avatar robpol86 avatar zqqf16 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terminaltables's Issues

Add API for truncating/fitting/handling long titles.

Implement table.title_cb which accepts a function/lambda that handles titles that won't fit in the top border.

Function signature expected:

:param str title: The title to overlay on the top border.
:param int max_len: Maximum number of characters that can be shown right now.

:return: Processed title and its length.
:rtype: (str, int)

Must return title that will fit in the border (else the table will appear broken/misaligned/wrapped) as well as the length of the string.

Length values are for visible characters. When using CJK (Chinese/Japanese/Korean) characters some may be len() of 1 but take up 2 visible spaces in terminals. Hence API expects function to return title length in case the function truncates the string and the last character is one short of the maximum width available due to it being a CJK character.

e.g. terminal with 7 spaces available for the title and the title is "世界你好" That's 8 visible spaces so if the function truncates it to "世界你" API expects length of 6 to be returned.

Add support for merging cells.

So this can be done:

+--------------------------+-----+---------+
| Item                     | Qty |   Price |
+--------------------------+-----+---------+
| SUPERMICRO MBD-X9SCM-F-O |   1 | $168.99 |
| Intel Core i3-2100       |   1 |  $99.99 |
| Syba SD-CF-IDE-DI        |   2 |   $7.89 |
+--------------------------+-----+---------+
|                         Total: | $284.76 |
+--------------------------+-----+---------+

combine terminaltables and prettytables?

https://github.com/smeggingsmegger/VeryPrettyTable can do more things like excel, for example

  1. get column(s). x.get_string(fields=["City name", "Population"])
  2. get row(s). x.get_string(start=1,end=4)
  3. sort. x.get_string(sortby="Population")
  4. and more

this is useful to extract and display info on a small dos console

So, can terminaltables use prettytables' such function?

or, is there a package for dos console on windows so that we can render big tables, which support

  1. use arrow key to navigate it
  2. support CJK

Thanks

Re-enable screen shot tests on AppVeyor.

Something recently changed with AppVeyor (maybe when they moved hosting to RackSpace) and now pillow cannot take screen shots in the RDP session.

[00:02:44]         with RunNewConsole(command) as gen:
[00:02:44] >           screenshot_until_match(str(screenshot), 15, sub_images, 1, gen)
[00:02:44] tests\test_all_tables_e2e\test_ascii_table.py:144: 
[00:02:44] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[00:02:44] tests\screenshot.py:285: in screenshot_until_match
[00:02:44]     with ImageGrab.grab(next(gen)) as rgba:
[00:02:44] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[00:02:44] 
[00:02:44] bbox = (26, 26, 703, 369)
[00:02:44] 
[00:02:44]     def grab(bbox=None):
[00:02:44]         if sys.platform == "darwin":
[00:02:44]             fh, filepath = tempfile.mkstemp('.png')
[00:02:44]             os.close(fh)
[00:02:44]             subprocess.call(['screencapture', '-x', filepath])
[00:02:44]             im = Image.open(filepath)
[00:02:44]             im.load()
[00:02:44]             os.unlink(filepath)
[00:02:44]         else:
[00:02:44] >           size, data = grabber()
[00:02:44] E           OSError: screen grab failed

Can this be used to print a table row-by-row?

It's unclear to me from reading the documentation how I can use this to print a table row by row over time?

I am looking to do something like:

with AsciiTable(headers=headers, column_widths=col_widths) as table:
    info = process_lots_of_data()
    table.add_row(info)

Where process_lots_of_data takes a few seconds.

Migrate to granular character control.

Migrate from this:

CHAR_CORNER_LOWER_LEFT
CHAR_CORNER_LOWER_RIGHT
CHAR_CORNER_UPPER_LEFT
CHAR_CORNER_UPPER_RIGHT
CHAR_HORIZONTAL
CHAR_INTERSECT_BOTTOM
CHAR_INTERSECT_CENTER
CHAR_INTERSECT_LEFT
CHAR_INTERSECT_RIGHT
CHAR_INTERSECT_TOP
CHAR_VERTICAL

To this:

CHAR_FOOTER_INNER_HORIZONTAL
CHAR_FOOTER_INNER_INTERSECT
CHAR_FOOTER_INNER_VERTICAL
CHAR_FOOTER_OUTER_LEFT_INTERSECT
CHAR_FOOTER_OUTER_LEFT_VERTICAL
CHAR_FOOTER_OUTER_RIGHT_INTERSECT
CHAR_FOOTER_OUTER_RIGHT_VERTICAL
CHAR_HEADER_INNER_HORIZONTAL
CHAR_HEADER_INNER_INTERSECT
CHAR_HEADER_INNER_VERTICAL
CHAR_HEADER_OUTER_LEFT_INTERSECT
CHAR_HEADER_OUTER_LEFT_VERTICAL
CHAR_HEADER_OUTER_RIGHT_INTERSECT
CHAR_HEADER_OUTER_RIGHT_VERTICAL
CHAR_INNER_HORIZONTAL
CHAR_INNER_INTERSECT
CHAR_INNER_VERTICAL
CHAR_OUTER_BOTTOM_HORIZONTAL
CHAR_OUTER_BOTTOM_INTERSECT
CHAR_OUTER_BOTTOM_LEFT
CHAR_OUTER_BOTTOM_RIGHT
CHAR_OUTER_LEFT_INTERSECT
CHAR_OUTER_LEFT_VERTICAL
CHAR_OUTER_RIGHT_INTERSECT
CHAR_OUTER_RIGHT_VERTICAL
CHAR_OUTER_TOP_HORIZONTAL
CHAR_OUTER_TOP_INTERSECT
CHAR_OUTER_TOP_LEFT
CHAR_OUTER_TOP_RIGHT

Feature Request: Sort table by column key.

It would be nice if the table could be sorted according to any of the column keys.

Example -

Column1 Column 2
22 37
11 50
33 10

Something like this-

table = AsciiTable(table_data, sortby="Column1")

Which would generate this -

Column1 Column 2
11 50
22 37
33 10

is this project still maintained? need help?

Hello! I'm using this project in undertime and we're suffering from a major alignment issue described in #55. that has been opened for almost two years now and a fix by @mgedmin, for over a year.

So now I'm a bit worried about depending on a project that hasn't seen a release in three years. :) Do you need help? Is there someone else that can push new releases to PyPI? I'd be happy to scratch my own itch here - of course I probably don't have time to review other PRs and respond to issues, but just issuing a new release with the approved pending PRs merged would be a great start...

SingleTable lines are rendering as letters

SingleTable is rendering oddly in my terminal.

lJetta SportWagenqqqqqqwqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Platform x Years     x                    Notes x
tqqqqqqqqqqnqqqqqqqqqqqnqqqqqqqqqqqqqqqqqqqqqqqqqqu
x Mk5      x 2007-2009 x The Golf Mk5 Variant was x
x          x           x      introduced in 2007. x
x MKVI     x 2009-2013 x   Might actually be Mk5. x
mqqqqqqqqqqvqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqqqqj

I suspect this could be a quirk of connecting via PuTTY. I've tried a few solutions I found online, like export NCURSES_NO_UTF8_ACS=1, changing locale, and changing PuTTY settings, but nothing helps.

The oddest thing is the problem goes away if I run the same command inside screen.

encoding error

UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 0: unexpected end of data

arr = []
arr.append([1, 2, "\xe9"])
table_data = [['a', 'b', 'c']]
for item in arr:
	table_data.append(item)
table = AsciiTable(table_data)
print "\n%s" % table.table

I suggest this edit string.decode('u8', 'ignore') on width_and_alignment.py#L28
As a workaround doing it explicitly eg: "\xe9".decode('u8', 'ignore') also does the job.

Add support for ReStructuredText tables

While there are other python table libraries that can generate ReStructuredText tables out there, it would be nice if terminaltables did it, and it's extensible enough to do so. There may even be a way to get the default implementation to do it? But being that RST is pretty strict about what is and isn't a valid table, it would be good to define these rules in a high-level manner.

The specification for the table output is here: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#tables

This is probably something that I could write at home and send a pull request for, but figured I'd ask before starting the work. Any feedback would be appreciated.

Support for Colored Text w/o relying on colorclass

Since the current functionality relating to colors is only limited to calculating the string_width, I would suggest a single line addition that removes ANSI color control sequences from the string before calculating the length. The reason I suggest it is, this leaves the user the freedom to use his color library of choice (e.g. colorama). For example, now that I use colorama extensively in my project, switching to colorclass becomes a bit of a pain now.

Expand justification.

Currently we only have:
self.justify_columns = dict() # {0: 'right', 1: 'left', 2: 'center'}

Add:
self.justify_rows = dict() # {0: 'top', 1: 'middle', 2: 'bottom'}
self.justify_cells = dict() # {(0, 0): ('center', 'middle')}

justify_columns and justify_rows override defaults (left and top is the default). justify_cells overrides defaults for specific cells. Keys are (x, y) coords from left/top corner and values are one or two justification values (horizontal or vertical justifications).

WindowsTable and WindowsDoubleTable causing exception

Robpol

I'm a bit of newbie so this may be simple user error. However, on a Windows 7/64 with Anaconda python 3.4, I can only get AsciiTables to work. DoubleTable and other fancy tables fail with various encoding errors.

I installed terminaltables-1.1.1 via pip

Here is an example of the console output for example1.py

-------------------------- snip
B:\python\anaconda3\envs\testTable\python.exe D:/wspace-git/_python/terminaltables/example1.py

Traceback (most recent call last):
File "D:/wspace-git/_python/terminaltables/example1.py", line 19, in
print(table.table)
File "B:\python\anaconda3\envs\testTable\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2554' in position 0: character maps to
----------------------- end snip

Any idea on what I may be missing?

Many thanks, Peter

Re-enable screenshot tests on AppVeyor.

test_ascii_table 1

Screenshot tests intermittently fail because sometimes the cmd window doesn't show up on the screen (maybe it's minimized?). Need to look into a way to either always show the window (maximize after spawning?) or conditionally disable screenshot tests when this happens (like 10% of the time).

Set table width

I have several tables and I'd like all have the same width.

pycharm_django_settings1

My idea is to get the size of the largest and set it on all tables, but there is no method to set the width.

Fix ugly README.rst

GitHub changed something since I last looked at this a month ago or so. It renders ugly now.

Investigate why ssh-add is prompting for password.

$ eval `ssh-agent -s`; ssh-add docs/key
Agent pid 3343
Enter passphrase for docs/key: 

No output has been received in the last 10 minutes, this potentially indicates a stalled build or something wrong with the build itself.

The build has been terminated

Maybe it's a new version or something.

please close/remove this issue. it is my fault

the supplied test always says "ImportError: cannot import name 'PROJECT_ROOT'"
I found that this is because I have a package E:\prg\py\Anaconda2_32\Lib\site-packages\tests\ already
so I suggest rename "tests" to "terminaltables_tests" or something else since everyone like simple package name which will lead to confliction easily

Add title_cb for truncating titles.

The default is to hide the title if it doesn't fit. I didn't remember this until I was done writing truncating code. Saving it here for future reference.

def build_border(column_widths, horizontal, left, intersect, right, title=None):
    """Build the top/bottom/middle row. Optionally embed the table title within the border.

    Title is truncated to fit in between left/right characters.

    Example return value:
    ('<', '-----', '+', '------', '+', '-------', '>')
    ('<', 'My Table', '----', '+', '------->')

    :param iter column_widths: List of integers representing column widths.
    :param str horizontal: Character to stretch across each column.
    :param str left: Left border.
    :param str intersect: Column separator.
    :param str right: Right border.
    :param str title: Overlay the title on the border between the left and right characters.

    :return: Prepared border as a tuple of strings.
    :rtype: tuple
    """
    if not title or not column_widths or not horizontal:
        return tuple(combine((horizontal * c for c in column_widths), left, intersect, right))
    title, length = truncate(title, sum(column_widths) + len(intersect) * (len(column_widths) - 1))

    # Handle title fitting in the first column.
    if length == column_widths[0]:
        return tuple(combine([title] + [horizontal * c for c in column_widths[1:]], left, intersect, right))
    if length < column_widths[0]:
        columns = [title + horizontal * (column_widths[0] - length)] + [horizontal * c for c in column_widths[1:]]
        return tuple(combine(columns, left, intersect, right))

    # Handle wide titles/narrow columns.
    columns_and_intersects = [title]
    for width in combine(column_widths, None, bool(intersect), None):
        # If title is taken care of.
        if length < 1:
            columns_and_intersects.append(intersect if width is True else horizontal * width)
        # If title's last character overrides an intersect character.
        elif width is True and length == 1:
            length = 0
        # If this is an intersect character that is overridden by the title.
        elif width is True:
            length -= 1
        # If title's last character is within a column.
        elif width >= length:
            columns_and_intersects[0] += horizontal * (width - length)  # Append horizontal chars to title.
            length = 0
        # If remainder of title won't fit in a column.
        else:
            length -= width

    return tuple(combine(columns_and_intersects, left, None, right))
def truncate(string, max_length):
    """Truncate string to a maximum length. Handles CJK characters.

    :param str string: String to operate on.
    :param int max_length: Truncate string to this visible size. May truncate to one shorter if CJK in the middle.

    :return: Truncated string and its length (str, int).
    :rtype: tuple
    """
    truncated = list()
    length = 0
    done = False

    # Convert to unicode.
    try:
        string = string.decode('u8')
    except (AttributeError, UnicodeEncodeError):
        pass

    for item in RE_COLOR_ANSI.split(string):
        if not item:
            continue
        if RE_COLOR_ANSI.match(item):
            truncated.append(item)
            continue
        if done:
            continue
        for char in item:
            width = 2 if unicodedata.east_asian_width(char) in ('F', 'W') else 1
            if length + width > max_length:
                done = True
                break
            truncated.append(char)
            length += width

    return ''.join(truncated), length

Tables in tables

Hi,

Doesn't seem to support tables in tables. I tried:

table = SingleTable(table_data,"Work logs")
outer_table = SingleTable([[""],[table.table]],"outer")
print outer_table.table

But got the following table, not sure if this will show correctly but the issue is that the "outer" right hand column lines are not in-line for the rows where the second table is inserted.

This doesn't make much sense to me as the second table is just a string with '\n' in it is it not? So it should be able to figure out the "width" of the inner table but doesn't seem to calculate it correctly.

┌outer────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                                 │
├─────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ┌Work logs──────┬─────────────────────────────────────────┬───────────┐             │
│ │ author        │ comment                                 │ timeSpent │ │
│ ├───────────────┼─────────────────────────────────────────┼───────────┤                   │
│ │ Alan Wakeford │ Review ODUC_MUX vplan (TP + initial TC) │ 1d        │ │
│ └───────────────┴─────────────────────────────────────────┴───────────┘                   │
└─────────────────────────────────────────────────────────────────────────────────────────────────┘

Support vertical alignment.

Currently everything is vertically aligned to the top. Add option to support middle and bottom alignments.

Colum width is wrong if emoji is used

Follow snippet draws a table with incorrect width for column with Unicode smile (for example 😵, dizzy face, Unicode: U+1F635, UTF-8: F0 9F 98 B5).

#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    table_data = [['😵'], ['😵']]
    from terminaltables import SingleTable
    table = SingleTable(table_data)
    print table.table

terminaltables will fail if one of the table_data is of integer type

Since terminaltables relies on the fact that all data present in the table_data list to be of string type, it will try to execute string operations on each of them. However, sometimes, people just want to print some integer or float data.

A good practice would be to sanitize the data, and turn it all to string before doing any operation. Or only do such operations on string data.

Traceback (most recent call last):
  File "main.py", line 208, in <module>
    cm.from_input(uInput, sInput)
  File "main.py", line 180, in from_input
    print(table.table)
  File "C:\Python27\lib\site-packages\terminaltables\base_table.py", line 126, in table
    padded_table_data = self.padded_table_data
  File "C:\Python27\lib\site-packages\terminaltables\base_table.py", line 113, in padded_table_
data
    widths = self.column_widths
  File "C:\Python27\lib\site-packages\terminaltables\base_table.py", line 92, in column_widths
    return column_widths(self.table_data)
  File "C:\Python27\lib\site-packages\terminaltables\width_and_alignment.py", line 93, in colum
n_widths
    widths[i] = max(widths[i], string_width(max(row[i].splitlines(), key=len)))
AttributeError: 'int' object has no attribute 'splitlines'

[SingleTable] Option to print Unicode box char instead of VT100 escaping

I think many terminals can now print Unicode box drawing characters.

In my case (in putty) I had to change my config to "Enable VT100 line drawing even in UTF-8 mode" whereas the terminal emulator can fully print all Unicode box drawing characters.

This ticket is a request to add an option to print Unicode chars instead.

I would suggest it to be the default behavior, but I guess there is a reason you didn't do that. Maybe you can explain it to me ?

Regards

Table show error

My Codes:

from terminaltables import SingleTable
...
    def show(self, nametuple):
        datas = []
        datas.append(("id",) + nametuple._fields[:-1])
        for i, data in enumerate(self.data):
            datas.append((i,) + data[:-1])
        print SingleTable(datas).table
.                                                                                                                                                              [ 19%]
test/test_dataBase.py .s..┌────┬────────────┬─────────┬─────────┐
│ id │ ip         │ web     │ pwn     │
├────┼────────────┼─────────┼─────────┤
│ 0  │ 10.10.10.1 │ 8080 80 │ 9090 90 │
│ 1  │ 10.10.10.2 │ 8080 80 │ 9090 90 │
│ 2  │ 10.10.10.3 │ 8080 80 │ 9090 90 │
│ 3  │ 10.10.10.4 │ 8080 80 │ 9090 90 │
│ 4  │ 10.10.10.5 │ 8080 80 │ 9090 90 │
└────┴────────────┴─────────┴─────────┘

it workds ok,but after i import pwntools

from terminaltables import SingleTable
...
from pwn import *
...
    def show(self, nametuple):
        datas = []
        datas.append(("id",) + nametuple._fields[:-1])
        for i, data in enumerate(self.data):
            datas.append((i,) + data[:-1])
        print SingleTable(datas).table
test/test_dataBase.py .s..lqqqqwqqqqqqqqqqqqwqqqqqqqqqwqqqqqqqqqk
x id x ip         x web     x pwn     x
tqqqqnqqqqqqqqqqqqnqqqqqqqqqnqqqqqqqqqu
x 0  x 10.10.10.1 x 8080 80 x 9090 90 x
x 1  x 10.10.10.2 x 8080 80 x 9090 90 x
x 2  x 10.10.10.3 x 8080 80 x 9090 90 x
x 3  x 10.10.10.4 x 8080 80 x 9090 90 x
x 4  x 10.10.10.5 x 8080 80 x 9090 90 x
mqqqqvqqqqqqqqqqqqvqqqqqqqqqvqqqqqqqqqj
.lqqqqwqqqqqqqqqqqqqwqqqqqqwqqqqqqqqqqwqqqqqqqqqqk

pager support

A bug report (#891381) was filed against the undertime Debian package, which uses this library, because it doesn't support piping the SingleTable through less or similar pagers.

I can confirm that terminaltables seriously garbles the terminal when piped into a pager:

[1015]anarcat@curie:~$ undertime | less 
qqqqqqqk
  EST  
qqqqqqqu
 00:00 
 01:00 
 02:00 
 03:00 
 04:00 
 05:00 
 06:00 
 07:00 
 08:00 
 09:00 
 10:00 
 11:00 
 12:00 
 13:00 
 13:12 
 14:00 
 15:00 
 16:00 
 17:00 
 18:00 
 19:00 
 20:00 
 21:00 
 22:00 
 23:00 
└───────┘
[1016]▒┼▒⎼␌▒├@␌┤⎼␋␊:·$ 

This requires a reset to get fixed.

One suggested fix was to send "proper" unicode or ANSI escape sequences to avoid freaking out pages like less. There are three pending pull requests to implement the former: #42, #47 (which supersedes #42) and #50. I haven't tested if those fix the issue, but it would be great to have a solution for this implemented somehow, so I figured I would document the issue to facilitate the tracking across projects.

Ability to add row delimiters at arbitrary places

It would be great if you added the ability to insert borders separators between rows even when Table.inner_row_border is False.

For example, if I wanted to divide "February stuff" from other stuff (see the image below) I'd have to manually append an empty "---..." entry to the table.

1

center-formatting broken with certain escape sequences

it seems that the "center" alignment can get confused if there is some escape sequences in a column.

for example, this program will generate this misaligned table:

[997]anarcat@angela:undertime$ ./undertime.py --start 7 --end 20 --date "in two weeks, at 15:00" America/Montreal US/Pacific Europe/London Australia/Melbourne
┌───────┬────────────┬───────────────┬─────────────────────┐
│  EST  │ US/Pacific │ Europe/London │ Australia/Melbourne │
├───────┼────────────┼───────────────┼─────────────────────┤
│ 00:00 │   21:00    │     05:00     │        16:00        │
│ 01:00 │   22:00    │     06:00     │        17:00        │
│ 02:00 │   23:00    │     07:00     │        18:00        │
│ 03:00 │   00:00    │     08:00     │        19:00        │
│ 04:00 │   01:00    │     09:00     │        20:00        │
│ 05:00 │   02:00    │     10:00     │        21:00        │
│ 06:00 │   03:00    │     11:00     │        22:00        │
│ 07:00 │   04:00    │     12:00     │        23:00        │
│ 08:00 │   05:00    │     13:00     │        00:00        │
│ 09:00 │   06:00    │     14:00     │        01:00        │
│ 10:00 │    07:00   │     15:00     │        02:00        │
│ 11:00 │    08:00   │     16:00     │        03:00        │
│ 12:00 │    09:00   │     17:00     │        04:00        │
│ 13:00 │    10:00   │     18:00     │        05:00        │
│ 14:00 │    11:00   │     19:00     │        06:00        │
│ 15:00 │    12:00   │     20:00     │        07:00        │
│ 16:00 │    13:00   │     21:00     │        08:00        │
│ 17:00 │    14:00   │     22:00     │        09:00        │
│ 18:00 │    15:00   │     23:00     │        10:00        │
│ 19:00 │    16:00   │     00:00     │        11:00        │
│ 20:00 │    17:00   │     01:00     │        12:00        │
│ 21:00 │    18:00   │     02:00     │        13:00        │
│ 22:00 │    19:00   │     03:00     │        14:00        │
│ 23:00 │    20:00   │     04:00     │        15:00        │
└───────┴────────────┴───────────────┴─────────────────────┘

if the colors are disabled, the column is aligned fine:

$ ./undertime.py --start 7 --end 20 --date "in two weeks, at 15:00" America/Montreal US/Pacific Europe/London Australia/Melbourne --no-colors
┌───────┬────────────┬───────────────┬─────────────────────┐
│  EST  │ US/Pacific │ Europe/London │ Australia/Melbourne │
├───────┼────────────┼───────────────┼─────────────────────┤
│ 00:00 │   21:00    │     05:00     │        16:00        │
│ 01:00 │   22:00    │     06:00     │        17:00        │
│ 02:00 │   23:00    │     07:00     │        18:00        │
│ 03:00 │   00:00    │     08:00     │        19:00        │
│ 04:00 │   01:00    │     09:00     │        20:00        │
│ 05:00 │   02:00    │     10:00     │        21:00        │
│ 06:00 │   03:00    │     11:00     │        22:00        │
│ 07:00 │   04:00    │     12:00     │        23:00        │
│ 08:00 │   05:00    │     13:00     │        00:00        │
│ 09:00 │   06:00    │     14:00     │        01:00        │
│ 10:00 │   07:00    │     15:00     │        02:00        │
│ 11:00 │   08:00    │     16:00     │        03:00        │
│ 12:00 │   09:00    │     17:00     │        04:00        │
│ 13:00 │   10:00    │     18:00     │        05:00        │
│ 14:00 │   11:00    │     19:00     │        06:00        │
│ 15:00 │   12:00    │     20:00     │        07:00        │
│ 16:00 │   13:00    │     21:00     │        08:00        │
│ 17:00 │   14:00    │     22:00     │        09:00        │
│ 18:00 │   15:00    │     23:00     │        10:00        │
│ 19:00 │   16:00    │     00:00     │        11:00        │
│ 20:00 │   17:00    │     01:00     │        12:00        │
│ 21:00 │   18:00    │     02:00     │        13:00        │
│ 22:00 │   19:00    │     03:00     │        14:00        │
│ 23:00 │   20:00    │     04:00     │        15:00        │
└───────┴────────────┴───────────────┴─────────────────────┘

not sure what's going on here but it sure seems like the escape sequence calculations go wrong at some point.

PS: I understand this is not exactly a minimal test case but I'm a little tired right now and would rather document this issue at this point. Let me know if you need help minimizing the code or understanding how the table is created.

[enhancement] option to use `=` on `inner_heading_row_border`

Feature request: option to use = on inner_heading_row_border

e.g.

+-------+------+---------+--------+
| head  | head | header  | header |
+=======+======+=========+========+
| 12    | 12   | 12      | 12     |
+-------+------+---------+--------+
| 123   | 123  | 123     | 123    |
+-------+------+---------+--------+
| 1     | 1    | 1       | 1      |
+-------+------+---------+--------+

Similarly for inner_footing_row_border.

examples used by other plain text tables:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.