Просмотр значений, разделенных вкладками, в терминале (вкладки не отображаются)

241
CMCDragonkai

Если у меня есть файл значений, разделенных табуляцией, и я говорю catэто, он прекрасно отображает файл для меня, все выстроено правильно. Теперь, если я попытаюсь скопировать вставить (используя мою мышь), в другой текстовый редактор. Вкладки становятся пробелами !?

Есть ли эмулятор терминала, который отображает вкладки как буквальные вкладки, а не как пробелы?

Вот тест:

echo -e "first"$'\t'"second"$'\t'"third"$'\n'"1"$'\t'"2"$'\t'"3" > tsv.tsv cat tsv.tsv 

Теперь попробуйте скопировать и вставить в текстовый редактор с графическим интерфейсом.

0

2 ответа на вопрос

1
infixed

You probably won't find one. In my experience, even the terminals that terminal-emulators are emulating rendered tabs into spaces on display. Certainly you could set tab stops on VT100s, so it was not a hard bound definition of what a tab was on the screen. If you sent the escape sequence to print screen on a real Digital Equipment Corporation VT100, it would send spaces to the printer where tabs had been rendered as spaces.

As an alternate solution, consider opening your tabbed source document in a separate session of your GUI editor. Then select your required text, cut and paste into your target document that you have open in a different session. For instance, I know gvim will copy tab characters into the clipboard.

Whether your particular GUI editor supports it is just a matter of conjecture at this point.

1
egmont

Terminal emulators based on the vte widget (e.g. gnome-terminal) preserve TABs in this case.

Note that it's limited to the simplest usage scenario only, when the TAB character doesn't advance over already existing content.

Most terminal emulators convert it to spaces because for terminals TAB is not a printable character, it is a control sequence that relocates the cursor. E.g. if you TAB over existing characters, those characters remain there and are not wiped out (not replaced by spaces).

Вот это да. Оно работает. Благодарю. Только хотелось бы, чтобы Konsole тоже могла это сделать. CMCDragonkai 7 лет назад 0

Похожие вопросы